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 797304 - rtpsession: The RTP timestamp in the RTCP Sender Report may be completely wrong
rtpsession: The RTP timestamp in the RTCP Sender Report may be completely wrong
Status: RESOLVED OBSOLETE
Product: GStreamer
Classification: Platform
Component: gst-plugins-good
git master
Other Linux
: Normal normal
: git master
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2018-10-18 12:37 UTC by Linus Svensson
Modified: 2018-11-03 15:33 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Reset the RTPSession object in PAUSED->READY (3.17 KB, patch)
2018-10-18 12:37 UTC, Linus Svensson
none Details | Review
Reset RTP Source (3.29 KB, patch)
2018-10-19 16:16 UTC, Linus Svensson
needs-work Details | Review

Description Linus Svensson 2018-10-18 12:37:44 UTC
Created attachment 373962 [details] [review]
Reset the RTPSession object in PAUSED->READY

The RTP timestamp used for RTCP Sender Report is generated from a cached extended RTP timestamp, which in turn is updated for every pushed RTP buffer. The timestamp generation does not work with a gst-rtsp-server that uses GST_RTSP_SUSPEND_MODE_RESET.

If the reset suspend mode is used, the server will configure a media and prepare it in RTSP DESCRIBE/SETUP, which will trigger rtpsource to cache an extended RTP timestamp. The pipeline will now be set to GST_STATE_NULL.

In RTSP PLAY, the pipeline will be set to GST_STATE_PLAYING again. A new random offset will be used for the RTP timestamp, but the previously cached extended RTP timestamp in all RTPSource objects remains, which leads to a situation where gst_rtp_buffer_ext_timestamp() sometimes return 0. When this happens, the RTP timestamp in the RTCP Sender Report is completely broken.

I have implemented rtp_session_reset() that will iterate over all it's RTPSource's and reset them. The important part is to clear RTPSource.last_rtptime. Does it make sense to reset the whole RTPSession object?
Comment 1 Sebastian Dröge (slomo) 2018-10-18 12:44:39 UTC
Review of attachment 373962 [details] [review]:

Makes sense. Did you check if there are more things to reset similarly?
Comment 2 Linus Svensson 2018-10-18 14:20:17 UTC
I checked in RTPSource if there where anything more obvious, but couldn't find anything. rtp_source_reset() already reset a lot of things, but I'm not familiar with all the details here. The retained_feedback list in RTPSource might also make sense to reset, but I don't know what the impact would be for rtspsrc/rtpbin.

I have not looked at RTPSession.
Comment 3 Sebastian Dröge (slomo) 2018-10-18 15:20:46 UTC
(In reply to Linus Svensson from comment #2)
> The retained_feedback list in RTPSource might also make sense to reset

Yes :) Can you add that?
Comment 4 Linus Svensson 2018-10-19 09:51:38 UTC
(In reply to Sebastian Dröge (slomo) from comment #3)
> Yes :) Can you add that?

Yes. I'll add it and run our RTSP tests. Will probably have something ready at afternoon today.
Comment 5 Linus Svensson 2018-10-19 16:16:59 UTC
Created attachment 373976 [details] [review]
Reset RTP Source
Comment 6 Sebastian Dröge (slomo) 2018-10-27 10:59:26 UTC
Review of attachment 373976 [details] [review]:

::: gst/rtpmanager/rtpsession.c
@@ +1079,3 @@
+
+  g_hash_table_foreach (sess->ssrcs[sess->mask_idx], (GHFunc) reset_source,
+      NULL);

I think we should actually remove all the sources here. They're not going to make any sense the next time the element is started up again.

But there are a couple of other things that should also be reset in rtpsession: last_rtcp_check_time and the other timeout related fields, first_rtcp, and various other fields.

::: gst/rtpmanager/rtpsource.c
@@ +258,3 @@
+  g_queue_foreach (src->retained_feedback, (GFunc) gst_buffer_unref, NULL);
+  g_queue_clear (src->retained_feedback);
+  src->last_rtptime = -1;

This looks correct
Comment 7 GStreamer system administrator 2018-11-03 15:33:32 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/issues/510.