I am running RTSP stream in a .devcontainer in VSCode, in Python.
When running in release mode all works perfectly.
When I run in debug mode, soon after setting pipeline to PLAY, I get total crash.
Sometimes this message appears, but I have no clue where it comes from:
terminate called after throwing an instance of 'std::runtime_error'
what(): Unable to read configuration
I am running on a machine with NVidia GPU, could not figure out if it may be related.
This is minimal sample that fails on debug-
import gi
gi.require_version('Gst', '1.0')
from gi.repository import Gst, GLib
def on_pad_added(rtspsrc, pad, decodebin):
print(f"New pad detected from RTSP source: {pad.get_name()}")
# Get the pad's capabilities
caps = pad.query_caps()
if caps and caps.to_string().startswith('application/x-rtp'):
structure = caps.get_structure(0)
media_type = structure.get_value('media')
if media_type == 'video':
pad.link(decodebin.get_static_pad('sink'))
def on_decodebin_pad_added(decodebin, pad, videoconvert):
print("Decodebin pad detected")
caps = pad.get_current_caps()
if caps and caps.to_string().startswith('video'):
print(f"caps: {caps.to_string()}")
sink_pad = videoconvert.get_static_pad('sink')
res = pad.link(sink_pad)
if res != Gst.PadLinkReturn.OK:
print("Failed to link pad")
def main():
Gst.init(None)
pipeline = Gst.Pipeline()
rtspsrc = Gst.ElementFactory.make('rtspsrc', 'rtspsrc')
decodebin = Gst.ElementFactory.make('decodebin', 'decodebin')
videoconvert = Gst.ElementFactory.make('videoconvert', 'videoconvert')
# videosink = Gst.ElementFactory.make('autovideosink', 'videosink')
videosink = Gst.ElementFactory.make('fakesink', 'videosink')
pipeline.add(rtspsrc)
pipeline.add(decodebin)
pipeline.add(videoconvert)
pipeline.add(videosink)
videoconvert.link(videosink)
rtspsrc.set_property('location', some_stream')
rtspsrc.connect('pad-added', on_pad_added, decodebin)
decodebin.connect('pad-added', on_decodebin_pad_added, videoconvert)
loop = GLib.MainLoop()
state_return = pipeline.set_state(Gst.State.PLAYING)
if state_return == Gst.StateChangeReturn.FAILURE:
print("Failed to set pipeline to PLAYING state")
try:
loop.run()
except KeyboardInterrupt:
pass
pipeline.set_state(Gst.State.NULL)
if __name__ == '__main__':
main()
I would appreciate any advice on what the cause for that could be.