From 43461432ec1af623d2b6f58693868023d9bf7288 Mon Sep 17 00:00:00 2001 From: Seungha Yang Date: Sat, 6 May 2023 04:14:49 +0900 Subject: [PATCH] h264decoder: Drop nonexisting picture silently without error If end_picture() was not successful, we do drop corresponding GstVideoCodecFrame and therefore gst_video_decoder_get_frame() will return nullptr which is expected behavior. Part-of: --- .../gst-plugins-bad/gst-libs/gst/codecs/gsth264decoder.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/subprojects/gst-plugins-bad/gst-libs/gst/codecs/gsth264decoder.c b/subprojects/gst-plugins-bad/gst-libs/gst/codecs/gsth264decoder.c index 86a45aa..fc7d3a1 100644 --- a/subprojects/gst-plugins-bad/gst-libs/gst/codecs/gsth264decoder.c +++ b/subprojects/gst-plugins-bad/gst-libs/gst/codecs/gsth264decoder.c @@ -1792,10 +1792,16 @@ gst_h264_decoder_do_output_picture (GstH264Decoder * self, picture->system_frame_number); if (!frame) { - GST_ERROR_OBJECT (self, - "No available codec frame with frame number %d", - picture->system_frame_number); - UPDATE_FLOW_RETURN (ret, GST_FLOW_ERROR); + /* The case where the end_picture() got failed and corresponding + * GstVideoCodecFrame was dropped already */ + if (picture->nonexisting) { + GST_DEBUG_OBJECT (self, "Dropping non-existing picture %p", picture); + } else { + GST_ERROR_OBJECT (self, + "No available codec frame with frame number %d", + picture->system_frame_number); + UPDATE_FLOW_RETURN (ret, GST_FLOW_ERROR); + } gst_h264_picture_unref (picture); -- 2.7.4