From 6d4d4edfcc6b3249d77626fe315d271deea77cd0 Mon Sep 17 00:00:00 2001 From: Havard Graff Date: Mon, 27 Sep 2021 00:53:34 +0200 Subject: [PATCH] videodecoder: request sync-points regularly on error If we are not receiving a sync-point for a very long time, we need to keep asking for them. The request-sync-point logic keeps track of how many keyunitrequests we are allowed to send, but that would not matter if we don't keep asking. Part-of: --- .../gst-libs/gst/video/gstvideodecoder.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/subprojects/gst-plugins-base/gst-libs/gst/video/gstvideodecoder.c b/subprojects/gst-plugins-base/gst-libs/gst/video/gstvideodecoder.c index 0e2e0b333b..40c3cd724a 100644 --- a/subprojects/gst-plugins-base/gst-libs/gst/video/gstvideodecoder.c +++ b/subprojects/gst-plugins-base/gst-libs/gst/video/gstvideodecoder.c @@ -3921,6 +3921,9 @@ gst_video_decoder_decode_frame (GstVideoDecoder * decoder, frame->pts = GST_BUFFER_PTS (frame->input_buffer); frame->dts = GST_BUFFER_DTS (frame->input_buffer); frame->duration = GST_BUFFER_DURATION (frame->input_buffer); + frame->deadline = + gst_segment_to_running_time (&decoder->input_segment, GST_FORMAT_TIME, + frame->pts); /* For keyframes, PTS = DTS + constant_offset, usually 0 to 3 frame * durations. */ @@ -3960,6 +3963,10 @@ gst_video_decoder_decode_frame (GstVideoDecoder * decoder, GST_WARNING_OBJECT (decoder, "Subclass requires a sync point but we didn't receive one yet, discarding input"); GST_OBJECT_UNLOCK (decoder); + if (priv->automatic_request_sync_points) { + gst_video_decoder_request_sync_point (decoder, frame, + priv->automatic_request_sync_point_flags); + } gst_video_decoder_release_frame (decoder, frame); return GST_FLOW_OK; } @@ -3992,10 +3999,6 @@ gst_video_decoder_decode_frame (GstVideoDecoder * decoder, "possible internal leaking?", priv->frames.length); } - frame->deadline = - gst_segment_to_running_time (&decoder->input_segment, GST_FORMAT_TIME, - frame->pts); - /* do something with frame */ ret = decoder_class->handle_frame (decoder, frame); if (ret != GST_FLOW_OK)