From 0151d621afbde1e267c64f2697da0146b72d7f6a 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: --- .../gst-plugins-bad/ext/openh264/gstopenh264dec.cpp | 11 +++++------ .../gst-plugins-bad/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 e42dc09..6d34646 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 3328d01..00ad6b1 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; } -- 2.7.4