GNOME Bugzilla – Bug 576729
[rtspsrc] perform EOS handling earlier
Last modified: 2009-03-27 16:50:46 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:
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.
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.
I'll mark it back as a normal then.
Also, if the server sends a proper RTCP BYE message, EOS is triggered immediatly.
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?
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.
I'll be patient, don't worry =). I just wanted to help as much as I could although I'm not an expert.
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.