Skip to content

Commit adf56fb

Browse files
authored
Merge pull request #469 from arch1t3cht/end_of_stream_dist
Fixes to the minimum distance to end of stream when seeking
2 parents 9276b12 + a33cd4a commit adf56fb

1 file changed

Lines changed: 1 addition & 6 deletions

File tree

src/core/videosource.cpp

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -919,12 +919,7 @@ bool FFMS_VideoSource::SeekTo(int n, int SeekOffset) {
919919
// Seeking too close to the end of the stream can result in a different decoder delay since
920920
// frames are returned as soon as draining starts, so avoid this to keep the delay predictable.
921921
// Is the +1 necessary here? Not sure, but let's keep it to be safe.
922-
int EndOfStreamDist = CodecContext->has_b_frames + 1;
923-
924-
if (CodecContext->codec_id == AV_CODEC_ID_H264)
925-
// Work around a bug in ffmpeg's h264 decoder where frames are skipped when seeking too
926-
// close to the end in open-gop files: https://trac.ffmpeg.org/ticket/10936
927-
EndOfStreamDist *= 2;
922+
int EndOfStreamDist = Delay.ReorderDelay + Delay.ThreadDelay + 1;
928923

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

0 commit comments

Comments
 (0)