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
+1
View File
@@ -71,6 +71,7 @@ void PlaybackCache::SetLength(const rational &r)
} else if (r > length_) {
// If new length is greater, simply extend the invalidated range for now
invalidated_.InsertTimeRange(range_diff);
jobs_.append({range_diff, QDateTime::currentMSecsSinceEpoch()});
} else {
// If new length is smaller, removed hashes
invalidated_.RemoveTimeRange(range_diff);
+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
-2
View File
@@ -49,8 +49,6 @@ private:
QHash<rational, FramePtr> time_map_;
QList< QFuture<bool> > write_frame_futures_;
ColorManager* color_manager_;
ExportParams params_;