mild decoder adjustment

This commit is contained in:
itsmattkc
2019-08-26 15:15:20 +10:00
parent 09a6a5a12a
commit 46ea071b99
2 changed files with 5 additions and 2 deletions
+3 -1
View File
@@ -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