I have a problem with RTSP streams from some cameras randomly resetting timestamp information in the RTP packets. I am using the Python bindings for GStreamer (and DeepStream) and I when using GST_DEBUG=2 I am able to observe the warning messages when this happens as follows:
0:00:06.294763481 1302530 0x7efb70011a40 WARN videodecoder gstvideodecoder.c:2761:gst_video_decoder_prepare_finish_frame:<nvv4l2decoder2> decreasing timestamp (0:00:03.117683019 < 0:00:15.618723844)
0:00:06.412505164 1302530 0x7efb70011a40 WARN videodecoder gstvideodecoder.c:2761:gst_video_decoder_prepare_finish_frame:<nvv4l2decoder2> decreasing timestamp (0:00:03.157683019 < 0:00:15.618723844)
When that happens the pipeline for the source hangs until the reported timestamp catches the previous one. I would like to capture the warning messages, and if they correspond to this problem, reset the RTSP connection.
I have followed many examples to capture all warning messages as follows:
loop = GLib.MainLoop()
bus = pipeline.get_bus()
bus.add_signal_watch()
connect("message", on_warning, loop)
def on_warning(bus, message: Gst.Message, loop):
t = message.type
if t == Gst.MessageType.WARNING:
err, debug = message.parse_warning()
sys.stderr.write(f"Warning: {err}: {debug}")
# CHECK MESSAGE HERE AND RESET CONNECTION IF RECEIVED MULTIPLE TIMES
The previous code is able to capture some of the warning messages I observe through the terminal output, but never the ones I would like it to (and many others I observe as decoding warnings).