Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 1 addition & 6 deletions src/core/videosource.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -919,12 +919,7 @@ bool FFMS_VideoSource::SeekTo(int n, int SeekOffset) {
// Seeking too close to the end of the stream can result in a different decoder delay since
// frames are returned as soon as draining starts, so avoid this to keep the delay predictable.
// Is the +1 necessary here? Not sure, but let's keep it to be safe.
int EndOfStreamDist = CodecContext->has_b_frames + 1;

if (CodecContext->codec_id == AV_CODEC_ID_H264)
// Work around a bug in ffmpeg's h264 decoder where frames are skipped when seeking too
// close to the end in open-gop files: https://trac.ffmpeg.org/ticket/10936
EndOfStreamDist *= 2;
int EndOfStreamDist = Delay.ReorderDelay + Delay.ThreadDelay + 1;

TargetFrame = std::min(TargetFrame, Frames.RealFrameNumber(std::max(0, VP.NumFrames - 1 - EndOfStreamDist)));

Expand Down
Loading