GNOME Bugzilla – Bug 736017
Sequence number is not monotonic after PAUSE command
Last modified: 2014-09-13 13:50:43 UTC
While using RTSP-server and g726payloader in gstreamer, sequence number is not monotonic while going from pause to play again. According to the RFC "both RTP sequence numbers and RTP timestamps MUST be continuous and monotonic across jumps of NPT". So while going from PAUSE to PLAY on live media, the sequence number generated by the basepayloader is random. So the sequence number is not monotonically increasing from previous play request to the next play request. This issue is combination of both rtsp-server and basepayloader issue. In RTSP server for pause, the pipeline is set to NULL state and in basepayloader the sequence number is generated randomly everytime it change state from READY TO PAUSE.
I am working on this issue.
(In reply to comment #0) > This issue is combination of both rtsp-server and basepayloader issue. In RTSP > server for pause, the pipeline is set to NULL state I think that is only done when you enable suspend for the media.
Created attachment 285455 [details] [review] Patch for monotonic sequence number As per the discussion over IRC, solution is to keep a flag in basepayloader to generate random sequence number only first time during READY to PAUSE state transition.
Comment on attachment 285455 [details] [review] Patch for monotonic sequence number This doesn't seem correct. All stream related status should be reset when going back to READY.
Hi, Can you explain me little more on this? What exactly you need to reset here?
As discussed on IRC: <Trollkarlen> Am I suppose to take care of any reset for sequence number when moving from PAUSED_TO_READY state? <slomo> i think it should get a new random start seqnum whenever it goes from READY to PAUSED <slomo> and not only the very first time <Trollkarlen> but when using rtsp-server with payloader, it always generates a random sequence number when you pause. <Trollkarlen> because in pause state rtsp-server goes to null state. <slomo> yes, but that's a problem of the rtsp-server, not the payloader <Trollkarlen> But as per the rfc, it should be monotonic. <slomo> maybe the rtsp-server should be able to set the sequence number itself when starting it again <slomo> yes, it's definitely a bug but imho not in the payloader
Created attachment 285637 [details] [review] Sequence number need to be monotonic after pause
Review of attachment 285637 [details] [review]: ::: gst/rtsp-server/rtsp-media.c @@ +2719,3 @@ + guint16 seq_num; + seq_num = gst_rtsp_stream_get_seqnum (stream); + gst_rtsp_stream_set_seqnum (stream, seq_num + 1); Just these two lines seem weird :) Maybe rename the functions to get_current_seqnum() and set_seqnum_offset()? Otherwise looks good to me
Created attachment 285795 [details] [review] Sequence number need to be monotonic after pause
commit 376488d8c7d0a92c56065070f9003e699533c3e5 Author: Srimanta Panda <srimanta@axis.com> Date: Mon Sep 8 09:26:23 2014 +0200 rtsp-media: Make sure that sequence numbers are monotonic after pause The sequence number is not monotonic for RTP packets after pause. The reason is basepayloader generates a randon sequence number when the pipeline goes from ready to pause. With this fix generation of sequence number will be monotonic when going from pause to play request. https://bugzilla.gnome.org/show_bug.cgi?id=736017