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 772740 - rtpbin: receiving RTP bundle support
rtpbin: receiving RTP bundle support
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gst-plugins-good
git master
Other Linux
: Normal enhancement
: 1.11.1
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2016-10-11 10:21 UTC by Philippe Normand
Modified: 2017-05-03 18:50 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
rtpbin: receive bundle support (15.56 KB, patch)
2016-10-11 11:14 UTC, Philippe Normand
none Details | Review
OpenWebRTC transport agent with bundling support (447.62 KB, image/svg+xml)
2016-10-11 11:28 UTC, Philippe Normand
  Details
OpenWebRTC transport agent with bundling support disabled (550.46 KB, image/svg+xml)
2016-10-11 11:28 UTC, Philippe Normand
  Details
rtpbin: receive bundle support (25.93 KB, patch)
2016-10-11 16:05 UTC, Philippe Normand
none Details | Review
rtpbin: receive bundle support (22.10 KB, patch)
2016-10-17 11:00 UTC, Philippe Normand
none Details | Review
rtpbin: receive bundle support (69.11 KB, patch)
2016-10-27 14:47 UTC, Philippe Normand
none Details | Review
rtpbin: receive bundle support (68.44 KB, patch)
2016-11-09 09:49 UTC, Philippe Normand
none Details | Review
rtpbin: receive bundle support (68.81 KB, patch)
2016-11-14 08:37 UTC, Philippe Normand
committed Details | Review

Description Philippe Normand 2016-10-11 10:21:14 UTC
As per the draft-ietf-mmusic-sdp-bundle-negotiation-33 [0] draft IETF spec, some changes would be needed in rtpbin to properly receive bundled RTP streams.

I'll attach a patch.

[0] https://datatracker.ietf.org/doc/draft-ietf-mmusic-sdp-bundle-negotiation/
Comment 1 Philippe Normand 2016-10-11 11:14:57 UTC
Created attachment 337401 [details] [review]
rtpbin: receive bundle support

The application can now instruct rtpbin to demultiplex incoming bundled
sessions and internally create the GstRtpSessions accordingly. To
enable this feature the application should request the
recv_bundle_rt{c}p_sink_%u pads.

Additionally a new signal named on-bundled-ssrc is provided and can be
used by the application to redirect the stream to a different
GstRtpSession or to keep the RTX stream grouped within the
GstRtpSession of the same media type.
Comment 2 Philippe Normand 2016-10-11 11:28:17 UTC
Created attachment 337402 [details]
OpenWebRTC transport agent with bundling support
Comment 3 Philippe Normand 2016-10-11 11:28:46 UTC
Created attachment 337403 [details]
OpenWebRTC transport agent with bundling support disabled
Comment 4 Philippe Normand 2016-10-11 15:59:32 UTC
Comment on attachment 337401 [details] [review]
rtpbin: receive bundle support

Hum this isn't the right version :)
Comment 5 Philippe Normand 2016-10-11 16:05:18 UTC
Created attachment 337448 [details] [review]
rtpbin: receive bundle support

The application can now instruct rtpbin to demultiplex incoming
bundled sessions and internally create the GstRtpSessions accordingly. To
enable this feature the application should request the
recv_bundle_rt{c}p_sink_%u pads.

Additionally a new signal named on-bundled-ssrc is provided and can be
used by the application to redirect the stream to a different
GstRtpSession or to keep the RTX stream grouped within the
GstRtpSession of the same media type.
Comment 6 Olivier Crête 2016-10-14 21:12:34 UTC
I'm not sure I like the API. Especially that bundling is negotiatable.. Another option would be to keep the same pads, but once a new SSRC is discovered on an incoming pad, have a new signal that will ask "do you want me to redirect this SSRC to another session?". And some API (maybe an actial signal) that says "Move this SSRC to that session".
Comment 7 Philippe Normand 2016-10-17 10:35:14 UTC
(In reply to Olivier Crête from comment #6)
> I'm not sure I like the API. Especially that bundling is negotiatable..
> Another option would be to keep the same pads, but once a new SSRC is
> discovered on an incoming pad, have a new signal that will ask "do you want
> me to redirect this SSRC to another session?". 

Ok this can be done without the separate recv_bundle sink pad templates indeed. I can update the patch accordingly, I think :)

I'm not sure what you mean with "do you want me to redirect this SSRC to another session?", I think the on-bundled-ssrc signal already allows something similar.

> And some API (maybe an actial
> signal) that says "Move this SSRC to that session".

When such signal would be needed? I don't understand the use-case for this.
Comment 8 Philippe Normand 2016-10-17 11:00:14 UTC
Created attachment 337827 [details] [review]
rtpbin: receive bundle support

A new signal named on-bundled-ssrc is provided and can be
used by the application to redirect an stream to a different
GstRtpSession or to keep the RTX stream grouped within the
GstRtpSession of the same media type.
Comment 9 Olivier Crête 2016-10-19 17:51:07 UTC
Review of attachment 337827 [details] [review]:

Except for the little nits below, this generally looks good. I'd really appreciate if there was a unit test to make sure this doesn't get broken in the future. I think it would also be beneficial to avoid plugin the extra ssrcdemux if the signal is not connected (or if it returns 0).

::: gst/rtpmanager/gstrtpbin.c
@@ +672,3 @@
+  g_value_init (&result, G_TYPE_UINT);
+  g_value_init (&params[0], GST_TYPE_ELEMENT);
+  g_value_set_object (&params[0], rtpbin);

You need to unset the params[0] after emitting the signal otherwise you'll leak the element.

@@ +678,3 @@
+  g_signal_emitv (params,
+      gst_rtp_bin_signals[SIGNAL_ON_BUNDLED_SSRC], 0, &result);
+  if (G_VALUE_HOLDS_UINT (&result)) {

This will always be true, you just initialized it to G_TYPE_UINT earlier.

@@ +3560,3 @@
+    goto no_name;
+
+  GST_DEBUG_OBJECT (rtpbin, "finding session %d", sessid);

Use %u for debug since it's a guint.
Comment 10 Philippe Normand 2016-10-20 09:17:20 UTC
(In reply to Olivier Crête from comment #9)
> Review of attachment 337827 [details] [review] [review]:
> 
> Except for the little nits below, this generally looks good. I'd really
> appreciate if there was a unit test to make sure this doesn't get broken in
> the future. I think it would also be beneficial to avoid plugin the extra
> ssrcdemux if the signal is not connected (or if it returns 0).
> 

With the current semantics, 0 means use the existing session. But thanks for the feedback, I'll work on a test and implement lazy ssrcdemux plugging :)

> ::: gst/rtpmanager/gstrtpbin.c
> @@ +672,3 @@
> +  g_value_init (&result, G_TYPE_UINT);
> +  g_value_init (&params[0], GST_TYPE_ELEMENT);
> +  g_value_set_object (&params[0], rtpbin);
> 
> You need to unset the params[0] after emitting the signal otherwise you'll
> leak the element.
> 

Ok!

> @@ +678,3 @@
> +  g_signal_emitv (params,
> +      gst_rtp_bin_signals[SIGNAL_ON_BUNDLED_SSRC], 0, &result);
> +  if (G_VALUE_HOLDS_UINT (&result)) {
> 
> This will always be true, you just initialized it to G_TYPE_UINT earlier.
> 

Ok!

> @@ +3560,3 @@
> +    goto no_name;
> +
> +  GST_DEBUG_OBJECT (rtpbin, "finding session %d", sessid);
> 
> Use %u for debug since it's a guint.

The rtpbin code is crippled with these %d where %u should be used. But yeah I can fix it!
Comment 11 Philippe Normand 2016-10-27 14:47:15 UTC
Created attachment 338614 [details] [review]
rtpbin: receive bundle support

A new signal named on-bundled-ssrc is provided and can be
used by the application to redirect an stream to a different
GstRtpSession or to keep the RTX stream grouped within the
GstRtpSession of the same media type.
Comment 12 Olivier Crête 2016-11-08 17:32:49 UTC
Review of attachment 338614 [details] [review]:

I'd rather see num-buffers on the testsrcs than g_timeout_add(), but the rest is fine so you can push it.
Comment 13 Philippe Normand 2016-11-09 09:49:30 UTC
Created attachment 339371 [details] [review]
rtpbin: receive bundle support

A new signal named on-bundled-ssrc is provided and can be
used by the application to redirect an stream to a different
GstRtpSession or to keep the RTX stream grouped within the
GstRtpSession of the same media type.


Updated the test, removing the g_timeout_add()'s.
Also fixed an issue in new_bundled_src_pad_found() where the rt(c)p
funnel sink pad would be left disconnected and we'd request a new pad
instead.
Comment 14 Philippe Normand 2016-11-09 09:51:46 UTC
The diff from the previous patch: https://bugzilla.gnome.org/attachment.cgi?oldid=338614&action=interdiff&newid=339371&headers=1
Comment 15 Olivier Crête 2016-11-11 15:05:10 UTC
Review of attachment 339371 [details] [review]:

::: gst/rtpmanager/gstrtpbin.c
@@ +712,3 @@
+  }
+
+  gst_pad_link (src_pad, recv_rtp_sink);

Please check the return value of gst_pad_link(), if you're 100% sure it will always work, try gst_pad_link_full(,GST_PAD_LINK_CHECK_NOTHING). That is only ok if there is nothing linked on the outside yet on either side of the link.

@@ +3154,3 @@
   rtpbin = stream->bin;
 
+  GST_DEBUG ("new payload pad %u", pt);

Any reason this is not GST_DEBUG_OBJECT() ?
Comment 16 Philippe Normand 2016-11-14 08:36:41 UTC
(In reply to Olivier Crête from comment #15)
> Review of attachment 339371 [details] [review] [review]:
> 
> ::: gst/rtpmanager/gstrtpbin.c
> @@ +712,3 @@
> +  }
> +
> +  gst_pad_link (src_pad, recv_rtp_sink);
> 
> Please check the return value of gst_pad_link(), if you're 100% sure it will
> always work, try gst_pad_link_full(,GST_PAD_LINK_CHECK_NOTHING). That is
> only ok if there is nothing linked on the outside yet on either side of the
> link.
> 

I'll check the gst_pad_link() result. The alternative can't be used, i'm afraid.

> @@ +3154,3 @@
>    rtpbin = stream->bin;
>  
> +  GST_DEBUG ("new payload pad %u", pt);
> 
> Any reason this is not GST_DEBUG_OBJECT() ?

I suppose not! Originally I was only fixing the format string :)
Comment 17 Philippe Normand 2016-11-14 08:37:41 UTC
Created attachment 339782 [details] [review]
rtpbin: receive bundle support

A new signal named on-bundled-ssrc is provided and can be
used by the application to redirect an stream to a different
GstRtpSession or to keep the RTX stream grouped within the
GstRtpSession of the same media type.
Comment 18 Philippe Normand 2016-11-16 07:58:29 UTC
Comment on attachment 339782 [details] [review]
rtpbin: receive bundle support

Thanks!
Comment 19 Carlos Alberto Lopez Perez 2017-05-03 18:50:01 UTC
This was merged on https://cgit.freedesktop.org/gstreamer/gst-plugins-good/commit/?id=dcd3ce9751cdef0b5ab1fa118355f92bdfe82cb3 (>= 1.11.1)