openh264: Register debug categories earlier
authorPhilippe Normand <philn@igalia.com>
Sat, 20 Aug 2022 15:15:15 +0000 (16:15 +0100)
committerGStreamer Marge Bot <gitlab-merge-bot@gstreamer-foundation.org>
Mon, 22 Aug 2022 13:34:33 +0000 (13:34 +0000)
Otherwise the GST_ERROR message logged in case of ABI mismatch would be done on
an uninitialized category.

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

subprojects/gst-plugins-bad/ext/openh264/gstopenh264dec.cpp
subprojects/gst-plugins-bad/ext/openh264/gstopenh264enc.cpp

index e42dc09..6d34646 100644 (file)
@@ -86,10 +86,7 @@ GST_STATIC_PAD_TEMPLATE ("src",
 
 /* class initialization */
 
-G_DEFINE_TYPE_WITH_CODE (GstOpenh264Dec, gst_openh264dec,
-    GST_TYPE_VIDEO_DECODER,
-    GST_DEBUG_CATEGORY_INIT (gst_openh264dec_debug_category, "openh264dec", 0,
-        "debug category for openh264dec element"));
+G_DEFINE_TYPE (GstOpenh264Dec, gst_openh264dec, GST_TYPE_VIDEO_DECODER);
 GST_ELEMENT_REGISTER_DEFINE_CUSTOM (openh264dec, openh264dec_element_init);
 
 static void
@@ -455,10 +452,12 @@ gst_openh264dec_decide_allocation (GstVideoDecoder * decoder, GstQuery * query)
 static gboolean
 openh264dec_element_init (GstPlugin * plugin)
 {
+  GST_DEBUG_CATEGORY_INIT (gst_openh264dec_debug_category, "openh264dec", 0,
+      "debug category for openh264dec element");
   if (openh264_element_init (plugin))
     return gst_element_register (plugin, "openh264dec", GST_RANK_MARGINAL,
         GST_TYPE_OPENH264DEC);
 
- GST_ERROR ("Incorrect library version loaded, expecting %s", g_strCodecVer);
- return FALSE;
 GST_ERROR ("Incorrect library version loaded, expecting %s", g_strCodecVer);
 return FALSE;
 }
index 3328d01..00ad6b1 100644 (file)
@@ -234,10 +234,7 @@ GST_STATIC_PAD_TEMPLATE ("src",
 /* class initialization */
 
 G_DEFINE_TYPE_WITH_CODE (GstOpenh264Enc, gst_openh264enc,
-    GST_TYPE_VIDEO_ENCODER,
-    G_IMPLEMENT_INTERFACE (GST_TYPE_PRESET, NULL);
-    GST_DEBUG_CATEGORY_INIT (gst_openh264enc_debug_category, "openh264enc", 0,
-        "debug category for openh264enc element"));
+    GST_TYPE_VIDEO_ENCODER, G_IMPLEMENT_INTERFACE (GST_TYPE_PRESET, NULL));
 GST_ELEMENT_REGISTER_DEFINE_CUSTOM (openh264enc, openh264enc_element_init);
 
 static void
@@ -1057,13 +1054,16 @@ gst_openh264enc_finish (GstVideoEncoder * encoder)
 
   return GST_FLOW_OK;
 }
+
 static gboolean
 openh264enc_element_init (GstPlugin * plugin)
 {
+  GST_DEBUG_CATEGORY_INIT (gst_openh264enc_debug_category, "openh264enc", 0,
+      "debug category for openh264enc element");
   if (openh264_element_init (plugin))
     return gst_element_register (plugin, "openh264enc", GST_RANK_MARGINAL,
-                                 GST_TYPE_OPENH264ENC);
+        GST_TYPE_OPENH264ENC);
 
- GST_ERROR ("Incorrect library version loaded, expecting %s", g_strCodecVer);
- return FALSE;
 GST_ERROR ("Incorrect library version loaded, expecting %s", g_strCodecVer);
 return FALSE;
 }