From d1eb5f727ca350a6c2e516684b7915c9c5c32dfc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Thu, 10 Aug 2017 23:25:13 +0300 Subject: [PATCH] openh264dec: Drop current frame if passing it to the decoder caused an error Otherwise we will get it again later for output, however this frame will never actually be output so we will shift timestamps. This is especially bad if we're handling a live stream where the first frames are not keyframes. We would output the keyframe with the timestamp of the first frame, and everything would be too late when arriving in the sink. --- ext/openh264/gstopenh264dec.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ext/openh264/gstopenh264dec.cpp b/ext/openh264/gstopenh264dec.cpp index ea197dfc85..4cabfe4da4 100644 --- a/ext/openh264/gstopenh264dec.cpp +++ b/ext/openh264/gstopenh264dec.cpp @@ -234,6 +234,9 @@ gst_openh264dec_handle_frame (GstVideoDecoder * decoder, } gst_buffer_unmap (frame->input_buffer, &map_info); + if (ret != dsErrorFree) + return gst_video_decoder_drop_frame (decoder, frame); + gst_video_codec_frame_unref (frame); frame = NULL; } else {