GNOME Bugzilla – Bug 559543
rtspsrc doesn't send EOS when playing finished
Last modified: 2008-11-26 08:55:05 UTC
We use rtspsrc in gst-plugins-good to play the rtsp video from m.youtube.com. We found rtspsrc will not send out a EOS event when playing finished. Currently, rtspsrc will send out EOS when the RTCP BYE packet received or the sender timeout(doesn't received any RTCP packet for a while) but this is not enough. We need rtspsrc sends out EOS immediately when the play finishs.
I made a patch seems to work now. I read the source code of openRTSP which is another open source RTSP impelementation and found out it uses a timeout callback to handle this EOS issue. In short words, when the playing starts, it sets up a timeout callback(the timeout time is the duration of current clip), when the timeout occurs -- sends out the EOS. According to this logic, I created some codes in <gst-plugins-good>/gst/rtspsrc/gstrtspsrc.c and make EOS happens. Refer to my patch file attached for details. By the way: I think this is a ugly EOS implementation but it works. RTSP 1.0 doesn't support EOS while RTSP 2.0(draft) supports it in PLAY_NOTIFY method. In RTSP 2.0 in the future, maybe we can got a graceful EOS implementation.
Created attachment 122068 [details] [review] patch for gstrtspsrc.c for EOS issue
Created attachment 122069 [details] [review] patch file of gstrtspsrc.h for EOS issue
It is indeed a very ugly way of doing things. Maybe it's better to have an element monitor the stream-time on the buffers (rtpbin, jitterbuffer or maybe the depayloader) and emit EOS when it reaches the duration. This would be more accurate and more flexible,