qsvencoder: Clear caps after debug print
authorSeungha Yang <seungha@centricular.com>
Wed, 23 Mar 2022 17:52:45 +0000 (02:52 +0900)
committerSeungha Yang <seungha@centricular.com>
Wed, 23 Mar 2022 17:55:49 +0000 (02:55 +0900)
Otherwise debug function will print (null) for alread cleared pointer

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2012>

subprojects/gst-plugins-bad/sys/qsv/gstqsvh264enc.cpp
subprojects/gst-plugins-bad/sys/qsv/gstqsvh265enc.cpp
subprojects/gst-plugins-bad/sys/qsv/gstqsvvp9enc.cpp

index 5c94d58..bd2843f 100644 (file)
@@ -813,7 +813,6 @@ gst_qsv_h264_enc_getcaps (GstVideoEncoder * encoder, GstCaps * filter)
         downstream_profiles.insert (profile);
     }
   }
-  gst_clear_caps (&allowed_caps);
 
   GST_DEBUG_OBJECT (self, "Downstream specified %" G_GSIZE_FORMAT " profiles",
       downstream_profiles.size ());
@@ -824,9 +823,13 @@ gst_qsv_h264_enc_getcaps (GstVideoEncoder * encoder, GstCaps * filter)
     GST_WARNING_OBJECT (self,
         "Allowed caps holds no profile field %" GST_PTR_FORMAT, allowed_caps);
 
+    gst_clear_caps (&allowed_caps);
+
     return gst_video_encoder_proxy_getcaps (encoder, nullptr, filter);
   }
 
+  gst_clear_caps (&allowed_caps);
+
   /* Profile allows interlaced? */
   /* *INDENT-OFF* */
   gboolean can_support_interlaced = FALSE;
index 1fd726d..1804206 100644 (file)
@@ -503,7 +503,6 @@ gst_qsv_h265_enc_getcaps (GstVideoEncoder * encoder, GstCaps * filter)
       }
     }
   }
-  gst_clear_caps (&allowed_caps);
 
   GST_DEBUG_OBJECT (self, "Downstream specified %" G_GSIZE_FORMAT " profiles",
       downstream_profiles.size ());
@@ -514,9 +513,13 @@ gst_qsv_h265_enc_getcaps (GstVideoEncoder * encoder, GstCaps * filter)
     GST_WARNING_OBJECT (self,
         "Allowed caps holds no profile field %" GST_PTR_FORMAT, allowed_caps);
 
+    gst_clear_caps (&allowed_caps);
+
     return gst_video_encoder_proxy_getcaps (encoder, nullptr, filter);
   }
 
+  gst_clear_caps (&allowed_caps);
+
   template_caps = gst_pad_get_pad_template_caps (encoder->sinkpad);
   template_caps = gst_caps_make_writable (template_caps);
 
index c3ed19c..0c893f0 100644 (file)
@@ -391,7 +391,6 @@ gst_qsv_vp9_enc_getcaps (GstVideoEncoder * encoder, GstCaps * filter)
       }
     }
   }
-  gst_clear_caps (&allowed_caps);
 
   GST_DEBUG_OBJECT (self, "Downstream specified %" G_GSIZE_FORMAT " profiles",
       downstream_profiles.size ());
@@ -402,9 +401,13 @@ gst_qsv_vp9_enc_getcaps (GstVideoEncoder * encoder, GstCaps * filter)
     GST_WARNING_OBJECT (self,
         "Allowed caps holds no profile field %" GST_PTR_FORMAT, allowed_caps);
 
+    gst_clear_caps (&allowed_caps);
+
     return gst_video_encoder_proxy_getcaps (encoder, nullptr, filter);
   }
 
+  gst_clear_caps (&allowed_caps);
+
   template_caps = gst_pad_get_pad_template_caps (encoder->sinkpad);
   template_caps = gst_caps_make_writable (template_caps);