vaav1dec: Remove double caps unref.
authorVictor Manuel Jaquez Leal <vjaquez@igalia.com>
Fri, 16 Dec 2022 17:15:04 +0000 (18:15 +0100)
committerGStreamer Marge Bot <gitlab-merge-bot@gstreamer-foundation.org>
Fri, 16 Dec 2022 19:18:25 +0000 (19:18 +0000)
There was a duplicated caps unref raising a warning.

Also it reorgs the sorrounding code for simplicity.

Fixes: #1196
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3587>

subprojects/gst-plugins-bad/sys/va/gstvaav1dec.c

index fc59340..5b6cbe6 100644 (file)
@@ -277,7 +277,7 @@ _create_internal_pool (GstVaAV1Dec * self, gint width, gint height)
   gst_video_info_set_format (&info, self->preferred_format, width, height);
 
   caps = gst_video_info_to_caps (&info);
-  if (caps == NULL) {
+  if (!caps) {
     GST_WARNING_OBJECT (self, "Failed to create caps for internal pool");
     return NULL;
   }
@@ -291,17 +291,15 @@ _create_internal_pool (GstVaAV1Dec * self, gint width, gint height)
   pool = gst_va_pool_new_with_config (caps, GST_VIDEO_INFO_SIZE (&info),
       1, 0, VA_SURFACE_ATTRIB_USAGE_HINT_DECODER, GST_VA_FEATURE_AUTO,
       allocator, &params);
+
   gst_clear_caps (&caps);
+  gst_object_unref (allocator);
 
   if (!pool) {
     GST_WARNING_OBJECT (self, "Failed to create internal pool");
-    gst_object_unref (allocator);
     return NULL;
   }
 
-  gst_object_unref (allocator);
-  gst_caps_unref (caps);
-
   gst_buffer_pool_set_active (pool, TRUE);
 
   return pool;