Rtsp stream, rtspsrc -- how to know if connection established?


Given pipeline like
rtspsrc ! rtph264depay ! h264parse ...
is there any way to know if connection is established? Any signal? Should I add some other elements for this, what signals to use then?

Also, I have bus message handler, is there any message which can help me to understand if data flow is successful?

Thanks in advance.

Can I use on-sdp event as a fact of successfully established connection?

you will get bus error message like
“Could not open resource for reading or writing”
if source is not ready.

If connection is OK, you see video.

Onvif is the tool for you to know if camera is available or not. Nowadays, most cameras are Onvif compatible.

1 Like

Thank you for reply!

I mean programmatically understand that I’m connected and stream is going on. Are there any useful events for this?

not sure about your purpose?

I need to understand that I’ve successfully connected to source. For example, I’m using on-sdp event, but there is problem that even it is raised (I assume that connection established in that case) it not gurunteed that connection is actually established. For, example log below, where Connected event is printed in “on-sdp” handler, but connection is not actually established:

21:14:54.729 [15948:9 ] [WRN] [myapp] Gst.DebugMessage
0:14:59.545515400 15948 000001AC99BE03C0 WARN                 default gstrtspconnection.c:1417:writev_bytes: Operation was cancelled
21:14:54.735 [15948:9 ] [WRN] [myapp] Gst.DebugMessage
0:14:59.548078500 15948 000001AC99BE03C0 WARN                 rtspsrc gstrtspsrc.c:6773:gst_rtspsrc_try_send:<rtspsrc1> error: Could not send message. (Received end-of-file)
21:14:54.737 [15948:9 ] [WRN] [myapp] Gst.DebugMessage
0:14:59.550764800 15948 000001AC99BE03C0 WARN                 rtspsrc gstrtspsrc.c:9244:gst_rtspsrc_pause:<rtspsrc1> error: Could not send message. (Received end-of-file)
21:14:55.101 [15948:29] [INF] [Vocord.Overview.Infrastructure.GStreamer.GStreamerWorker] Connected to camera, ip=
21:14:55.649 [15948:25] [WRN] [myapp] Gst.DebugMessage
0:15:00.462503000 15948 000001AC99E460C0 WARN                 basesrc gstbasesrc.c:3132:gst_base_src_loop:<udpsrc23> error: Internal data stream error.
21:14:55.652 [15948:25] [WRN] [myapp] Gst.DebugMessage
0:15:00.464982400 15948 000001AC99E460C0 WARN                 basesrc gstbasesrc.c:3132:gst_base_src_loop:<udpsrc23> error: streaming stopped, reason not-linked (-1)
21:14:55.658 [15948:11] [WRN] [myservice] GLib.GException: Internal data stream error.```

You can connect to the rtspsrc on new manager signal, then get the RtpBin and connect to some/one of its signals (perhaps: rtpbin on-ssrc-active)

1 Like