Skip to content

v4l2: fix debug category initialisation again

Would spew warnings on the rpi4 when calling into gst_v4l2_object_get_codec_caps() from the probe_and_register() function since the v4l2_debug category initialisation would only be done later as part of the element/device provider registration.

Also log things in the probe function to the v4l2 category instead of the default category while we're at it.

Stack trace for posterity
Starting program: /home/pi/Devel/gst-build/b/subprojects/gstreamer/tools/gst-launch-1.0 v4l2src num-buffers=1 \! fakesink
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/arm-linux-gnueabihf/libthread_db.so.1".

Breakpoint 1, 0xb6d98da4 in g_logv () from /usr/lib/arm-linux-gnueabihf/libglib-2.0.so.0
(gdb) bt
#0  0xb6d98da4 in g_logv () at /usr/lib/arm-linux-gnueabihf/libglib-2.0.so.0
#1  0xb6d99168 in g_log () at /usr/lib/arm-linux-gnueabihf/libglib-2.0.so.0
#2  0xb6d99980 in g_return_if_fail_warning () at /usr/lib/arm-linux-gnueabihf/libglib-2.0.so.0
#3  0xb6ef8dfc in gst_debug_log_valist (category=0x0, level=level@entry=GST_LEVEL_DEBUG, file=, function=, line=1590, line@entry=0, object=0x0, 
    object@entry=0xb6542de8, format=0xb6577090 "Unsupported fourcc 0x%08x %c%c%c%c", format@entry=0x636 , args=..., args@entry=...)
    at ../subprojects/gstreamer/gst/gstinfo.c:531
#4  0xb6ef8ee8 in gst_debug_log
    (category=, level=level@entry=GST_LEVEL_DEBUG, file=, function=, line=line@entry=1590, object=object@entry=0x0, format=format@entry=0xb6577090 "Unsupported fourcc 0x%08x %c%c%c%c") at ../subprojects/gstreamer/gst/gstinfo.c:480
#5  0xb6542de8 in gst_v4l2_object_v4l2fourcc_to_bare_struct (fourcc=fourcc@entry=875967053) at ../subprojects/gst-plugins-good/sys/v4l2/gstv4l2object.c:1589
#6  0xb6545f20 in gst_v4l2_object_get_caps_helper (flags=flags@entry=GST_V4L2_CODEC) at ../subprojects/gst-plugins-good/sys/v4l2/gstv4l2object.c:1659
#7  0xb6548650 in gst_v4l2_object_get_codec_caps () at ../subprojects/gst-plugins-good/sys/v4l2/gstv4l2object.c:1735
#8  0xb6565b34 in gst_v4l2_is_video_dec (sink_caps=sink_caps@entry=0x1f8318, src_caps=src_caps@entry=0x1f8368) at ../subprojects/gst-plugins-good/sys/v4l2/gstv4l2videodec.c:1120
#9  0xb653c498 in gst_v4l2_probe_and_register (plugin=0x1dd808) at ../subprojects/gst-plugins-good/sys/v4l2/gstv4l2.c:189
#10 0xb653c498 in plugin_init (plugin=0x1dd808) at ../subprojects/gst-plugins-good/sys/v4l2/gstv4l2.c:257
#11 0xb6f1de90 in gst_plugin_register_func (user_data=0x0, desc=0xb658fc58 , plugin=0x1dd808) at ../subprojects/gstreamer/gst/gstplugin.c:532
#12 0xb6f1de90 in gst_plugin_register_func (plugin=0x1dd808, desc=0xb658fc58 , user_data=0x0) at ../subprojects/gstreamer/gst/gstplugin.c:486
#13 0xb6f2054c in _priv_gst_plugin_load_file_for_registry (filename=0x1def68 "/home/pi/Devel/gst-build/b/subprojects/gst-plugins-good/sys/v4l2/libgstvideo4linux2.so", registry=0x49850, 
    registry@entry=0x0, error=0xb6d4fb78, error@entry=0xbeff8a14) at ../subprojects/gstreamer/gst/gstplugin.c:899
#14 0xb6f210f8 in gst_plugin_load_file (filename=, error=error@entry=0xbeff8a14) at ../subprojects/gstreamer/gst/gstplugin.c:689
#15 0xb6f21678 in gst_plugin_load_by_name (name=0x1dc015 "video4linux2") at ../subprojects/gstreamer/gst/gstplugin.c:1339
#16 0xb6f22218 in gst_plugin_feature_load (feature=0x1db5a0) at ../subprojects/gstreamer/gst/gstpluginfeature.c:112
#17 0xb6eeafc0 in gst_element_factory_create (factory=factory@entry=0x1db5a0, name=name@entry=0x0) at ../subprojects/gstreamer/gst/gstelementfactory.c:350
#18 0xb6eeb444 in gst_element_factory_make (factoryname=0x209438 "v4l2src", name=name@entry=0x0) at ../subprojects/gstreamer/gst/gstelementfactory.c:456
#19 0xb6eaf190 in priv_gst_parse_yyparse (scanner=, graph=graph@entry=0xbeff976c) at subprojects/gstreamer/gst/parse/grammar.y:847
#20 0xb6eb06c4 in priv_gst_parse_launch (str=str@entry=0x1fd480 "v4l2src num-buffers=1 ! fakesink ", error=0x0, error@entry=0xbeff97bc, ctx=ctx@entry=0x0, flags=flags@entry=GST_PARSE_FLAG_NONE)
    at subprojects/gstreamer/gst/parse/grammar.y:1213
#21 0xb6f724fc in gst_parse_launch_full (pipeline_description=0x1fd480 "v4l2src num-buffers=1 ! fakesink ", context=0x0, context@entry=0xb6fb6000, flags=GST_PARSE_FLAG_NONE, 
    flags@entry=(unknown: 3204421728), error=0xbeff9860, error@entry=0xb6fa2e7c) at ../subprojects/gstreamer/gst/gstparse.c:347
#22 0xb6f727d0 in gst_parse_launchv_full (argv=argv@entry=0x2fe70, context=0xb6fb6000, context@entry=0x0, flags=(unknown: 3204421728), flags@entry=GST_PARSE_FLAG_NONE, error=0xb6fa2e7c, 
    error@entry=0xbeff9858) at ../subprojects/gstreamer/gst/gstparse.c:275
#23 0xb6f728b8 in gst_parse_launchv (argv=argv@entry=0x2fe70, error=error@entry=0xbeff9858) at ../subprojects/gstreamer/gst/gstparse.c:227
#24 0x00012e2c in main (argc=, argv=) at ../subprojects/gstreamer/tools/gst-launch.c:1139

Merge request reports