From 755b4233ffe131b9221b954d97d5eabd334a4d5c Mon Sep 17 00:00:00 2001 From: itsmattkc Date: Fri, 29 Nov 2019 01:35:53 +1100 Subject: [PATCH] fixed bug where a timecode of 0 wouldn't always return the first frame Not all media starts with a timecode of 0 and the Decoder class needs to handle such a situation. This commit corrects that. --- app/decoder/ffmpeg/ffmpegdecoder.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/app/decoder/ffmpeg/ffmpegdecoder.cpp b/app/decoder/ffmpeg/ffmpegdecoder.cpp index ad67ba04b..85bc93a7d 100644 --- a/app/decoder/ffmpeg/ffmpegdecoder.cpp +++ b/app/decoder/ffmpeg/ffmpegdecoder.cpp @@ -834,14 +834,16 @@ int64_t FFmpegDecoder::GetClosestTimestampInIndex(const int64_t &ts) } if (ts <= 0) { - return 0; + return frame_index_.first(); } // Use index to find closest frame in file for (int i=1;i ts) { + } else if (this_ts > ts) { return frame_index_.at(i - 1); } }