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 736017 - Sequence number is not monotonic after PAUSE command
Sequence number is not monotonic after PAUSE command
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gst-rtsp-server
1.4.0
Other Linux
: Normal major
: 1.4.2
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2014-09-04 09:27 UTC by Srimanta Panda (trollkarlen)
Modified: 2014-09-13 13:50 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Patch for monotonic sequence number (2.30 KB, patch)
2014-09-05 07:50 UTC, Srimanta Panda (trollkarlen)
reviewed Details | Review
Sequence number need to be monotonic after pause (3.78 KB, patch)
2014-09-08 09:56 UTC, Srimanta Panda (trollkarlen)
reviewed Details | Review
Sequence number need to be monotonic after pause (3.82 KB, patch)
2014-09-10 07:44 UTC, Srimanta Panda (trollkarlen)
committed Details | Review

Description Srimanta Panda (trollkarlen) 2014-09-04 09:27:14 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.
Comment 1 Srimanta Panda (trollkarlen) 2014-09-04 09:28:11 UTC
I am working on this issue.
Comment 2 Wim Taymans 2014-09-04 14:44:40 UTC
(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.
Comment 3 Srimanta Panda (trollkarlen) 2014-09-05 07:50:31 UTC
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 4 Sebastian Dröge (slomo) 2014-09-05 08:41:55 UTC
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.
Comment 5 Srimanta Panda (trollkarlen) 2014-09-05 10:05:12 UTC
Hi,

Can you explain me little more on this? What exactly you need to reset here?
Comment 6 Sebastian Dröge (slomo) 2014-09-05 10:25:01 UTC
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
Comment 7 Srimanta Panda (trollkarlen) 2014-09-08 09:56:54 UTC
Created attachment 285637 [details] [review]
Sequence number need to be monotonic after pause
Comment 8 Sebastian Dröge (slomo) 2014-09-08 15:45:09 UTC
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
Comment 9 Srimanta Panda (trollkarlen) 2014-09-10 07:44:32 UTC
Created attachment 285795 [details] [review]
Sequence number need to be monotonic after pause
Comment 10 Sebastian Dröge (slomo) 2014-09-12 14:30:06 UTC
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