export: fixed bug that broke audio on export

This commit is contained in:
itsmattkc
2020-06-19 20:25:49 +10:00
parent 65ccac1dfe
commit a94caa5737
3 changed files with 4 additions and 13 deletions
+3 -11
View File
@@ -96,21 +96,13 @@ bool ExportTask::Run()
if (params_.audio_enabled()) {
audio_range.append(range);
audio_data_.SetLength(range.length());
}
Render(video_range, audio_range, mat, false);
bool success = true;
foreach (QFuture<bool> f, write_frame_futures_) {
f.waitForFinished();
if (!f.result()) {
SetError(tr("Failed to write AVFrame"));
success = false;
}
}
if (params_.audio_enabled()) {
// Write audio data now
encoder_->WriteAudio(audio_params(), audio_data_.GetCacheFilename());
@@ -165,7 +157,7 @@ void ExportTask::FrameDownloaded(const QByteArray &hash, const std::list<rationa
// Unfortunately this can't be done in another thread since the frames need to be sent
// one after the other chronologically.
encoder_->WriteFrame(time_map_.value(real_time), real_time);
encoder_->WriteFrame(time_map_.take(real_time), real_time);
frame_time_++;
@@ -180,7 +172,7 @@ void ExportTask::AudioDownloaded(const TimeRange &range, SampleBufferPtr samples
adjusted_range -= params_.custom_range().in();
}
audio_data_.WritePCM(adjusted_range, samples, job_time());
audio_data_.WritePCM(adjusted_range, samples, QDateTime::currentMSecsSinceEpoch());
}
OLIVE_NAMESPACE_EXIT