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: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2924>
This commit is contained in:
Philippe Normand 2022-08-20 16:15:15 +01:00 committed by Tim-Philipp Müller
parent 8d4f105fb7
commit d2110dfe1d
2 changed files with 12 additions and 13 deletions

View 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,6 +452,8 @@ 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);

View 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,9 +1054,12 @@ 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);