avfdeviceprovider: Fix debug category initialization

The device monitor calls into avfvideosrc functions without
initializing the debug category, which causes multiple criticals.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7192>
This commit is contained in:
Nirbheek Chauhan 2024-07-17 23:44:09 +05:30 committed by GStreamer Marge Bot
parent 5929829131
commit 65ff618bb6
3 changed files with 16 additions and 2 deletions

View file

@ -48,6 +48,8 @@ gst_avf_device_provider_class_init (GstAVFDeviceProviderClass * klass)
// https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/issues/886 // https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/issues/886
dm_class->probe = gst_avf_device_provider_probe; dm_class->probe = gst_avf_device_provider_probe;
gst_avf_video_src_debug_init ();
gst_device_provider_class_set_static_metadata (dm_class, gst_device_provider_class_set_static_metadata (dm_class,
"AVF Device Provider", "Source/Video", "AVF Device Provider", "Source/Video",
"List and provide AVF source devices", "List and provide AVF source devices",

View file

@ -83,6 +83,7 @@ struct _GstAVFVideoSrcClass
GType gst_avf_video_src_get_type (void); GType gst_avf_video_src_get_type (void);
void gst_avf_video_src_debug_init (void);
GstCaps *gst_av_capture_device_get_caps (AVCaptureDevice *device, AVCaptureVideoDataOutput *output, GstAVFVideoSourceOrientation orientation); GstCaps *gst_av_capture_device_get_caps (AVCaptureDevice *device, AVCaptureVideoDataOutput *output, GstAVFVideoSourceOrientation orientation);
G_END_DECLS G_END_DECLS

View file

@ -1181,6 +1181,18 @@ static gboolean gst_avf_video_src_decide_allocation (GstBaseSrc * bsrc,
static void gst_avf_video_src_set_context (GstElement * element, static void gst_avf_video_src_set_context (GstElement * element,
GstContext * context); GstContext * context);
void
gst_avf_video_src_debug_init (void)
{
static gsize _init = 0;
if (g_once_init_enter (&_init)) {
GST_DEBUG_CATEGORY_INIT (gst_avf_video_src_debug, "avfvideosrc",
0, "iOS/MacOS AVFoundation video source");
g_once_init_leave (&_init, 1);
}
}
static void static void
gst_avf_video_src_class_init (GstAVFVideoSrcClass * klass) gst_avf_video_src_class_init (GstAVFVideoSrcClass * klass)
{ {
@ -1277,8 +1289,7 @@ gst_avf_video_src_class_init (GstAVFVideoSrcClass * klass)
0, G_MAXUINT, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); 0, G_MAXUINT, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
#endif #endif
GST_DEBUG_CATEGORY_INIT (gst_avf_video_src_debug, "avfvideosrc", gst_avf_video_src_debug_init ();
0, "iOS/MacOS AVFoundation video source");
gst_type_mark_as_plugin_api (GST_TYPE_AVF_VIDEO_SOURCE_POSITION, 0); gst_type_mark_as_plugin_api (GST_TYPE_AVF_VIDEO_SOURCE_POSITION, 0);
gst_type_mark_as_plugin_api (GST_TYPE_AVF_VIDEO_SOURCE_ORIENTATION, 0); gst_type_mark_as_plugin_api (GST_TYPE_AVF_VIDEO_SOURCE_ORIENTATION, 0);