Skip to content

Commit

Permalink
videosource: Only apply PAFF adjustment if the frame is marked as int…
Browse files Browse the repository at this point in the history
…erlaced

Otherwise seeking can be jank in certain types of streams like open GOP HEVC
or MP4s with huge edit list trims a the very start.

Fixe #394.

Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
  • Loading branch information
dwbuiten committed Jun 18, 2022
1 parent 90975ec commit ff61bca
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/core/videosource.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -629,7 +629,7 @@ bool FFMS_VideoSource::DecodePacket(AVPacket *Packet) {
// H.264 (PAFF) and HEVC can have one field per packet, and decoding delay needs
// to be adjusted accordingly.
if (CodecContext->codec_id == AV_CODEC_ID_H264 || CodecContext->codec_id == AV_CODEC_ID_HEVC) {
if (!PAFFAdjusted && DelayCounter > Delay && LastDecodedFrame->repeat_pict == 0 && Ret != 0) {
if (!PAFFAdjusted && DelayCounter > Delay && LastDecodedFrame->interlaced_frame == 1 && LastDecodedFrame->repeat_pict == 0 && Ret != 0) {
int OldBFrameDelay = Delay - (CodecContext->thread_count - 1);
Delay = 1 + OldBFrameDelay * 2 + (CodecContext->thread_count - 1);
PAFFAdjusted = true;
Expand Down

0 comments on commit ff61bca

Please sign in to comment.