From 46ea071b993b2f9258a93453e719a2dedebb8eb8 Mon Sep 17 00:00:00 2001 From: itsmattkc Date: Mon, 26 Aug 2019 15:15:20 +1000 Subject: [PATCH] mild decoder adjustment --- app/decoder/ffmpeg/ffmpegdecoder.cpp | 4 +++- app/node/processor/renderer/renderer.cpp | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/app/decoder/ffmpeg/ffmpegdecoder.cpp b/app/decoder/ffmpeg/ffmpegdecoder.cpp index 246f3a4bb..38b99a202 100644 --- a/app/decoder/ffmpeg/ffmpegdecoder.cpp +++ b/app/decoder/ffmpeg/ffmpegdecoder.cpp @@ -211,13 +211,14 @@ FramePtr FFmpegDecoder::Retrieve(const rational &timecode, const rational &lengt // Set up seeking loop int64_t seek_ts = target_ts; int64_t second_ts = qRound(rational(avstream_->time_base).flipped().toDouble()); + bool got_frame = false; bool last_backtrack = false; // FFmpeg frame retrieve loop while (ret >= 0 && frame_->pts != target_ts) { // If the frame timestamp is too large, we need to seek back a little - if (frame_->pts > target_ts || frame_->pts == AV_NOPTS_VALUE) { + if (got_frame && (frame_->pts > target_ts || frame_->pts == AV_NOPTS_VALUE)) { // If we already tried seeking to 0 though, there's nothing we can do so we error here if (last_backtrack) { Error(tr("FFmpeg failed to seek to the correct location")); @@ -238,6 +239,7 @@ FramePtr FFmpegDecoder::Retrieve(const rational &timecode, const rational &lengt } ret = GetFrame(); + got_frame = true; } // Handle any errors received during the frame retrieve process diff --git a/app/node/processor/renderer/renderer.cpp b/app/node/processor/renderer/renderer.cpp index 489a28a2f..e49537590 100644 --- a/app/node/processor/renderer/renderer.cpp +++ b/app/node/processor/renderer/renderer.cpp @@ -249,6 +249,8 @@ void RendererProcessor::CacheNext() rational time_to_cache = cache_queue_.takeFirst(); + qDebug() << "Caching" << time_to_cache.toDouble(); + Node* node_to_cache = texture_input_->edges().first()->output()->parent(); // Run this probe in another thread @@ -257,7 +259,6 @@ void RendererProcessor::CacheNext() cache_return_count_ = 0; for (int i=0;iQueue(path.GetThreadPath(i), time_to_cache); }