GST_DEBUG=7 and a custom logger causes Gst.Pipeline.new to return incorrect object
This is a fun one!
- Debian Buster Linux x86_64
- PyGObject version 3.42.2 (took the latest release to test this)
- Python version: 3.7.3 (though reproduces on 3.8.x as well)
- Gstreamer 1.14.4-2+deb10u1 from Debian (though reproduces on 1.20.3 as well)
Test case (test.py
):
#!/usr/bin/python3
import gi
gi.require_version('Gst', '1.0')
from gi.repository import Gst
Gst.init(None)
def no_op(*args):
pass
Gst.debug_add_log_function(no_op,None)
gst_pipeline = Gst.Pipeline.new("pipeline")
print(gst_pipeline)
gst_pipeline.add(Gst.Bin.new("foo1"))
Now run the script and get output:
% python3 ./test.py
<Gst.Pipeline object at 0x7f9f554f97e0 (GstPipeline at 0x11a61d0)>
Next do it with the debug level set:
% GST_DEBUG=7 python3 ./test.py 2>&1 | tail -10
0:00:00.240019846 868933 0x260a300 TRACE GST_REFCOUNTING gstobject.c:264:gst_object_unref:<bus1> 0x29c3060 unref 2->1
0:00:00.240043970 868933 0x260a300 TRACE GST_REFCOUNTING gstobject.c:264:gst_object_unref:<pipeline> 0x2799140 unref 4->3
0:00:00.240057129 868933 0x260a300 DEBUG GST_ELEMENT_FACTORY gstelementfactory.c:522:gst_element_factory_create_with_properties: created element "pipeline"
0:00:00.240077696 868933 0x260a300 TRACE GST_REFCOUNTING gstobject.c:264:gst_object_unref:<pipeline> 0x2799140 unref 3->2
0:00:00.240110332 868933 0x260a300 TRACE GST_REFCOUNTING gstobject.c:264:gst_object_unref:<pipeline> 0x2799140 unref 2->1
<Gst.Object object at 0x7f8109ae6200 (GstPipeline at 0x29e21a0)>
Traceback (most recent call last):
File "./test.py", line 14, in <module>
gst_pipeline.add(Gst.Bin.new("foo1"))
AttributeError: 'Object' object has no attribute 'add'
Removing the call to Gst.debug_add_log_function
eliminates the issue.
So for some reason Gst.Pipeline.new
returns an Object
if GST_DEBUG=7 (6 won't do) and custom logging is set.
I debugged it a bit but didn't even manage yet to determine if it's on the C or Python side :(.
Edited by Erkki Seppälä