h264decoder: Drop nonexisting picture silently without error
authorSeungha Yang <seungha@centricular.com>
Fri, 5 May 2023 19:14:49 +0000 (04:14 +0900)
committerGStreamer Marge Bot <gitlab-merge-bot@gstreamer-foundation.org>
Tue, 9 May 2023 23:19:39 +0000 (23:19 +0000)
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: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4586>

subprojects/gst-plugins-bad/gst-libs/gst/codecs/gsth264decoder.c

index 86a45aa..fc7d3a1 100644 (file)
@@ -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);