After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 576729 - [rtspsrc] perform EOS handling earlier
[rtspsrc] perform EOS handling earlier
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gst-plugins-good
0.10.21
Other Linux
: Normal normal
: 0.10.15
Assigned To: Wim Taymans
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2009-03-25 14:26 UTC by Javier Gálvez
Modified: 2009-03-27 16:50 UTC
See Also:
GNOME target: ---
GNOME version: 2.23/2.24



Description Javier Gálvez 2009-03-25 14:26:17 UTC
Please describe the problem:
When receiving an RTSP/RTP stream, at the end of the stream there's no message reported by the pipeline bus, so it's impossible to manage properly some application level tasks, such as playlist management.

During the RTSP message exchange, the server (tested with VLC 0.9.4 and Live555MediaServer) replies to the client DESCRIBE RTSP message with a SDP file, which includes the 'range' session attribute (e.g. 'range:npt=0-249.102'). 

However, when the client (gstreamer 0.10.21) sends a PLAY RTSP message, the 'Range' header has the value of 'npt=0-\r\n'.

The gstreamer RTP session manager should consider the 'range' attribute of the SDP file sent by the server in order to know when the EOS of the configured RTSP/RTP stream should be fired.

Steps to reproduce:
1. Use an RTSP server (I tested with both VLC 0.9.4 and Live555MediaServer) to configure a VoD streaming environment.
2. Add a watch to the message bus of the gstreamer pipeline and try to get any trace when the message type matches GST_MESSAGE_EOS.
3. Start receiving any content through an RTSP session and wait for the content to finish.


Actual results:
No GST_MESSAGE_EOS (nor GST_STATE_CHANGED) is fired when the stream reaches its end.

Expected results:
A GST_MESSAGE_EOS message fired just when the RTP stream finishes, so itcould be handled in order to, for example, start the next local or RTSP content in a playlist.

Does this happen every time?
Yes.

Other information:
Comment 1 Wim Taymans 2009-03-25 16:12:22 UTC
This is not entirely true, rtspsrc will post an EOS message after the RTP session manager times out (5-8 seconds).

Also the Range header in the PLAY request is proper. It is allowed to leave the end time blank when you intend to play the full range.

I think what you are asking is that EOS (or SEGMENT_DONE) is performed earlier, based on when the stream reaches the stream_time as given in the npt end time.

Also some servers (WMS) have a special in-band message to inform the client about EOS.
Comment 2 Javier Gálvez 2009-03-25 16:21:00 UTC
Yes, I would like to handle an EOS message when this end of stream is actually reached; i.e. when the npt end time is reached, not 5-8 seconds later.

In order to develop applications that manage playlists and seamless services it is needed to know when media streams (both local and remote) start and end.

Maybe I'm missing an alternative to get this information, but I thought that this issue could be considered as a bug. 

Any feedback will be appreciated.
Thank you.
Comment 3 Wim Taymans 2009-03-25 16:27:42 UTC
I'll mark it back as a normal then.
Comment 4 Wim Taymans 2009-03-27 12:33:01 UTC
Also, if the server sends a proper RTCP BYE message, EOS is triggered immediatly.
Comment 5 Javier Gálvez 2009-03-27 15:08:10 UTC
What RTSP server are you using? AFAIK, RTCP BYE messages are sent by clients not by servers.

I've tried different client-server combinations (clients: gstreamer and VLC; servers: VLC and Live555MediaServer) and when the client is Gstreamer, RTCP messages are indefinitely sent from both sides, even when the stream media has ended. The difference with VLC when behaving as a client is that this one sends a RTSP TEARDOWN message when the stream ends and, after the server RTSP reply, the client sends the RTCP BYE messages.

Why doesn't Gstreamer (client) send any RTSP TEARDOWN message when the stream reaches its end? Am I missing something here?
Comment 6 Wim Taymans 2009-03-27 15:45:41 UTC
I'm using my own server. AFAIK Darwin sends a custom RTCP packet to signal EOS. Maybe it should not send BYE, I don't know.

As for why GStreamer doesn't send the TEARDOWN when the stream ends, it seems that the RTCP messages from both sides keep the session alive.

Also GStreamer does not yet use the Range attribute to stop playback when the last RTP packet of the range has been received. So the thing you seem to be missing here is that someone needs to write code to make this work.

Also note that I assigned this bug to myself, meaning that I'm implementing it right now. So, just relax and be patient.
Comment 7 Javier Gálvez 2009-03-27 16:33:22 UTC
I'll be patient, don't worry =). I just wanted to help as much as I could although I'm not an expert.
Comment 8 Wim Taymans 2009-03-27 16:50:46 UTC
requires an update of -good and -bad with these two commits.

commit d6550696d45170fe6a712b03b82c21881ef40bb7
Author: Wim Taymans <wim.taymans@collabora.co.uk>
Date:   Fri Mar 27 17:44:57 2009 +0100

    rtpbin: add on_npt_stop signal
    
    Add the on_npt_stop signal to rtpbin and rtpjitterbuffer to notify the
    application that the NPT stop position has been reached.

commit fd18185d44da1c774c02aa9ce88e844f6587c0f0
Author: Wim Taymans <wim.taymans@collabora.co.uk>
Date:   Fri Mar 27 17:48:13 2009 +0100

    rtspsrc: link to the on_npt_stop signal to EOS
    
    Connect to the on_npt_stop signal of the session manager to schedule the EOS
    actions.