gst-rtsp-server shared media not working as expected

Alan dartagnan64b at gmail.com
Wed Jul 21 04:46:52 UTC 2021


 Nirbheek, thanks for replying.

I'm now setting gst_rtsp_media_set_shared(media, TRUE); in
"media-configure" signal, not clear when
gst_rtsp_media_factory_set_shared(factory, TRUE)  might be needed instead,
in either case problems exist.

So when using gst_rtsp_media_set_shared(media, TRUE) on rtsp server end,
and hitting the server with 3 instances of gst-launch-1.0 rtspsrc
location="rtsp://127.0.0.1:8554/test" protocols=4 ! rtph264depay !
h264parse ! avdec_h264 ! videoconvert ! autovideosink, I get one RTSP
client  pausing and one dropping out. Console logs showed:

rtsp client 2:
rtspsrc gstrtspsrc.c:3567:on_timeout_common:<rtspsrc0> source 651c0106,
stream 651c0106 in session 0 timed out

rtsp client 3:
videodecoder
gstvideodecoder.c:3302:gst_video_decoder_clip_and_push_buf:<avdec_h264-0>
Dropping frame due to QoS. start:0:00:50.959420524
deadline:0:00:50.959420524 earliest_time:0:00:50.964597906

1) There seems to be a few bugs here. Are they filed and any plans of
fixing these?

2) Any specific GST_DEBUG level to use and log lines to look for? (one can
easily get lost in GST_DEBUG=5/6/or7

PS: all this is over TCP, gst_rtsp_media_factory_set_protocols(factory,
GST_RTSP_LOWER_TRANS_TCP);, I've included RTSP handshake from VLC and
gstreamer, only difference I see is that VLC uses "Range: npt=0.000-" in
PLAY whereas gstreamer properly uses "Range: npt=0-598.733333333" since it
parses start/end time.

Thank you!

On Tue, Jul 13, 2021 at 6:50 AM Nirbheek Chauhan <nirbheek.chauhan at gmail.com>
wrote:

> Hi Alan,
>
> You would need to look at the GST_DEBUG logs of gst-rtsp-server to
> figure out what RTSP commands are being sent on connect / disconnect
> by VLC and rtspsrc. If I remember correctly, VLC uses live555 which
> has a sub-par RTSP client implementation and it may just be doing the
> wrong thing. For instance, it may be sending a Range header in the
> PLAY request that forces the server to seek to the beginning of the
> file.
>
> As for rtspsrc, it actually sends a PAUSE request when stopping, so
> you need to intercept that using the "before-send" signal. See also:
>
> https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/908
> where I had to revert my attempt at fixing this. I am sure there are
> other bugs there too, but they should be fixable.
>
> You may also like to use gstreamer master for rtspsrc. There have been
> a number of fixes for shared RTSP playback and seeking there
> (multicast, udp, etc).
>
> Cheers,
> Nirbheek
>
> On Mon, Jul 12, 2021 at 12:15 PM Alan via gstreamer-devel
> <gstreamer-devel at lists.freedesktop.org> wrote:
> >
> > Hello,
> >
> > I've been experimenting with the gst-rtsp-server test-launch.c example,
> I noticed that gst_rtsp_media_factory_set_shared(factory, TRUE) is not
> working as expected.  That is, when a second rtsp client connects and
> requests the video stream, the server restarts the first rtsp client video
> stream. So both clients end up getting video from the beginning of the
> stream (file).
> >
> > Is this a bug or as designed?
> >
> > Steps to reproduce:
> > 1) ./test-launch "( filesrc location=input.mp4 ! qtdemux name=d ! tee
> name=t ! queue ! h264parse config-interval=-1 ! rtph264pay pt=96 name=pay0
> )"
> > 2) start VLC Player and connect to rtsp://127.0.0.1:8554/test and wait
> for video to stream a few minutes
> > 3) start another instance of VLC Player and connect to rtsp://
> 127.0.0.1:8554/test, wait for video to stream, the stream starts at the
> beginning of the input.mp4 and the video stream in step 2 above stops and
> plays from the beginning of the file.
> >
> > The behavior is the same for rtsp server 1.16.2 and 1.18.4. Oddly, if I
> start two gst-launch-1.0 rtspsrc location=rtsp://127.0.0.1:8554/test !
> ... instead of VLC Player this works: the second stream plays at time of
> connection; however, if I start/stop one of the rtsp clients, video freezes
> and doesn't play for the newly started client (at times, the stream totally
> ends for both rtsp clients) . So it doesn't seem to be robust or reliable.
> >
> > Thanks
> >
> > _______________________________________________
> > gstreamer-devel mailing list
> > gstreamer-devel at lists.freedesktop.org
> > https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/gstreamer-devel/attachments/20210721/9074c430/attachment.htm>
-------------- next part --------------
VLC play rtsp://127.0.0.1:8554/test


OPTIONS rtsp://127.0.0.1:8554/test RTSP/1.0
CSeq: 2
User-Agent: LibVLC/3.0.16 (LIVE555 Streaming Media v2016.11.28)

RTSP/1.0 200 OK
CSeq: 2
Public: OPTIONS, DESCRIBE, ANNOUNCE, GET_PARAMETER, PAUSE, PLAY, RECORD, SETUP, SET_PARAMETER, TEARDOWN
Server: GStreamer RTSP server
Date: Wed, 21 Jul 2021 04:21:08 GMT

DESCRIBE rtsp://127.0.0.1:8554/test RTSP/1.0
CSeq: 3
User-Agent: LibVLC/3.0.16 (LIVE555 Streaming Media v2016.11.28)
Accept: application/sdp

RTSP/1.0 200 OK
CSeq: 3
Content-Type: application/sdp
Content-Base: rtsp://127.0.0.1:8554/test/
Server: GStreamer RTSP server
Date: Wed, 21 Jul 2021 04:21:08 GMT
Content-Length: 433

v=0
o=- 6188516399227487991 1 IN IP4 127.0.0.1
s=Session streamed with GStreamer
i=rtsp-server
t=0 0
a=tool:GStreamer
a=type:broadcast
a=control:*
a=range:npt=0-598.733333333
m=video 0 RTP/AVP 96
c=IN IP4 0.0.0.0
a=rtpmap:96 H264/90000
a=framerate:30
a=fmtp:96 packetization-mode=1;profile-level-id=640029;sprop-parameter-sets=Z2QAKawbSAeAIn5YAg==,aO48sAAAAA==
a=control:stream=0
a=ts-refclk:local
a=mediaclk:sender
SETUP rtsp://127.0.0.1:8554/test/stream=0 RTSP/1.0
CSeq: 4
User-Agent: LibVLC/3.0.16 (LIVE555 Streaming Media v2016.11.28)
Transport: RTP/AVP/TCP;unicast;interleaved=0-1

RTSP/1.0 200 OK
CSeq: 4
Transport: RTP/AVP/TCP;unicast;interleaved=0-1;ssrc=C3FBBA7D;mode="PLAY"
Server: GStreamer RTSP server
Session: .fc+HI-nKJz94+gU
Date: Wed, 21 Jul 2021 04:21:08 GMT

PLAY rtsp://127.0.0.1:8554/test/ RTSP/1.0
CSeq: 5
User-Agent: LibVLC/3.0.16 (LIVE555 Streaming Media v2016.11.28)
Session: .fc+HI-nKJz94+gU
Range: npt=0.000-

RTSP/1.0 200 OK
CSeq: 5
RTP-Info: url=rtsp://127.0.0.1:8554/test/stream=0;seq=7057;rtptime=701314891
Range: npt=0-598.733333333
Server: GStreamer RTSP server
Session: .fc+HI-nKJz94+gU
Date: Wed, 21 Jul 2021 04:21:08 GMT
-------------- next part --------------
gst-launch-1.0 rtspsrc location="rtsp://127.0.0.1:8554/test" protocols=4 ! rtph264depay ! h264parse ! avdec_h264 ! videoconvert ! autovideosink

OPTIONS rtsp://127.0.0.1:8554/test RTSP/1.0
CSeq: 1
User-Agent: GStreamer/1.18.4
User-Agent: RealMedia Player Version 6.0.9.1235 (linux-2.0-libc6-i386-gcc2.95)
ClientChallenge: 9e26d33f2984236010ef6253fb1887f7
CompanyID: KnKV4M4I/B2FjJ1TToLycw==
GUID: 00000000-0000-0000-0000-000000000000
RegionData: 0
PlayerStarttime: [28/03/2003:22:50:23 00:00]
ClientID: Linux_2.4_6.0.9.1235_play32_RN01_EN_586
Date: Wed, 21 Jul 2021 04:23:32 GMT

RTSP/1.0 200 OK
CSeq: 1
Public: OPTIONS, DESCRIBE, ANNOUNCE, GET_PARAMETER, PAUSE, PLAY, RECORD, SETUP, SET_PARAMETER, TEARDOWN
Server: GStreamer RTSP server
Date: Wed, 21 Jul 2021 04:23:32 GMT

DESCRIBE rtsp://127.0.0.1:8554/test RTSP/1.0
CSeq: 2
User-Agent: GStreamer/1.18.4
Accept: application/sdp
Date: Wed, 21 Jul 2021 04:23:32 GMT

RTSP/1.0 200 OK
CSeq: 2
Content-Type: application/sdp
Content-Base: rtsp://127.0.0.1:8554/test/
Server: GStreamer RTSP server
Date: Wed, 21 Jul 2021 04:23:32 GMT
Content-Length: 434

v=0
o=- 10286354536211852710 1 IN IP4 127.0.0.1
s=Session streamed with GStreamer
i=rtsp-server
t=0 0
a=tool:GStreamer
a=type:broadcast
a=control:*
a=range:npt=0-598.733333333
m=video 0 RTP/AVP 96
c=IN IP4 0.0.0.0
a=rtpmap:96 H264/90000
a=framerate:30
a=fmtp:96 packetization-mode=1;profile-level-id=640029;sprop-parameter-sets=Z2QAKawbSAeAIn5YAg==,aO48sAAAAA==
a=control:stream=0
a=ts-refclk:local
a=mediaclk:sender
SETUP rtsp://127.0.0.1:8554/test/stream=0 RTSP/1.0
CSeq: 3
User-Agent: GStreamer/1.18.4
Transport: RTP/AVP/TCP;unicast;interleaved=0-1
Date: Wed, 21 Jul 2021 04:23:32 GMT

RTSP/1.0 200 OK
CSeq: 3
Transport: RTP/AVP/TCP;unicast;interleaved=0-1;ssrc=DF4E481A;mode="PLAY"
Server: GStreamer RTSP server
Session: R8g8g6ibhGL..7UN
Date: Wed, 21 Jul 2021 04:23:32 GMT

PLAY rtsp://127.0.0.1:8554/test/ RTSP/1.0
CSeq: 4
User-Agent: GStreamer/1.18.4
Range: npt=0-598.733333333
Session: R8g8g6ibhGL..7UN
Date: Wed, 21 Jul 2021 04:23:32 GMT

RTSP/1.0 200 OK
CSeq: 4
RTP-Info: url=rtsp://127.0.0.1:8554/test/stream=0;seq=2447;rtptime=2583029659
Range: npt=0-598.733333333
Server: GStreamer RTSP server
Session: R8g8g6ibhGL..7UN
Date: Wed, 21 Jul 2021 04:23:34 GMT


More information about the gstreamer-devel mailing list