From d2110dfe1d8824c4137c7169f4d560fcf78fa024 Mon Sep 17 00:00:00 2001 From: Philippe Normand Date: Sat, 20 Aug 2022 16:15:15 +0100 Subject: [PATCH] openh264: Register debug categories earlier Otherwise the GST_ERROR message logged in case of ABI mismatch would be done on an uninitialized category. Part-of: --- .../ext/openh264/gstopenh264dec.cpp | 11 +++++------ .../ext/openh264/gstopenh264enc.cpp | 14 +++++++------- 2 files changed, 12 insertions(+), 13 deletions(-) diff --git a/subprojects/gst-plugins-bad/ext/openh264/gstopenh264dec.cpp b/subprojects/gst-plugins-bad/ext/openh264/gstopenh264dec.cpp index e42dc093b7..6d3464628f 100644 --- a/subprojects/gst-plugins-bad/ext/openh264/gstopenh264dec.cpp +++ b/subprojects/gst-plugins-bad/ext/openh264/gstopenh264dec.cpp @@ -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; } diff --git a/subprojects/gst-plugins-bad/ext/openh264/gstopenh264enc.cpp b/subprojects/gst-plugins-bad/ext/openh264/gstopenh264enc.cpp index 3328d01d99..00ad6b1d65 100644 --- a/subprojects/gst-plugins-bad/ext/openh264/gstopenh264enc.cpp +++ b/subprojects/gst-plugins-bad/ext/openh264/gstopenh264enc.cpp @@ -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; }