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 794789 - rtspclientsink: Fix client ports for the RTCP backchannel
rtspclientsink: Fix client ports for the RTCP backchannel
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gst-rtsp-server
unspecified
Other All
: Normal blocker
: 1.14.1
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2018-03-29 00:58 UTC by Mathieu Duponchelle
Modified: 2018-04-05 10:04 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
rtspclientsink: Fix client ports for the RTCP backchannel (2.10 KB, patch)
2018-03-29 00:58 UTC, Mathieu Duponchelle
none Details | Review
rtspclientsink: Fix client ports for the RTCP backchannel (6.02 KB, patch)
2018-03-30 15:11 UTC, Mathieu Duponchelle
committed Details | Review

Description Mathieu Duponchelle 2018-03-29 00:58:31 UTC
This was broken since the work for delayed transport creation
was merged: the creation of the transports string depends on
calling stream_get_server_port, which only starts returning
something meaningful after a call to stream_allocate_udp_sockets
has been made, this function expects a transport that we parse
from the transport string ...

Significant refactoring is in order, but does not look entirely
trivial, for now we put a band aid on and create a second transport
string after the stream has been completed, to pass it in
the request headers instead of the previous, incomplete one.
Comment 1 Mathieu Duponchelle 2018-03-29 00:58:35 UTC
Created attachment 370277 [details] [review]
rtspclientsink: Fix client ports for the RTCP backchannel
Comment 2 Sebastian Dröge (slomo) 2018-03-29 06:46:06 UTC
Comment on attachment 370277 [details] [review]
rtspclientsink: Fix client ports for the RTCP backchannel

Please add a FIXME comment explaining the situation before merging
Comment 3 Sebastian Dröge (slomo) 2018-03-29 07:42:37 UTC
Can you also put a testcase in this bug report to reproduce it, or at least the RTSP messages that go back and forth and are missing the ports?
Comment 4 Mathieu Duponchelle 2018-03-30 15:11:05 UTC
Created attachment 370346 [details] [review]
rtspclientsink: Fix client ports for the RTCP backchannel

This was broken since the work for delayed transport creation
was merged: the creation of the transports string depends on
calling stream_get_server_port, which only starts returning
something meaningful after a call to stream_allocate_udp_sockets
has been made, this function expects a transport that we parse
from the transport string ...

Significant refactoring is in order, but does not look entirely
trivial, for now we put a band aid on and create a second transport
string after the stream has been completed, to pass it in
the request headers instead of the previous, incomplete one.
Comment 5 Sebastian Dröge (slomo) 2018-03-30 15:30:39 UTC
Review of attachment 370346 [details] [review]:

::: gst/rtsp-server/rtsp-stream.c
@@ +1511,3 @@
   priv = stream->priv;
 
+  GST_ERROR_OBJECT (stream, "Allocating sockets");

This is not an error

@@ +3747,2 @@
       if (add) {
+        GST_ERROR_OBJECT (stream, "adding %s:%d-%d", dest, min, max);

and neither is this :)
Comment 6 Mathieu Duponchelle 2018-03-30 15:57:01 UTC
Attachment 370346 [details] pushed as 7f9b8c2 - rtspclientsink: Fix client ports for the RTCP backchannel
Comment 7 Mathieu Duponchelle 2018-03-30 20:12:33 UTC
backported to 1.14
Comment 8 Patricia Muscalu 2018-04-04 13:01:46 UTC
Why is there a dependency between client ports and server ports? It seems very strange. What if the "server ports" are already allocated on the client side?
Comment 9 Mathieu Duponchelle 2018-04-04 15:44:44 UTC
(In reply to Patricia Muscalu from comment #8)
> Why is there a dependency between client ports and server ports? It seems
> very strange.

That's because the stream API itself is very strange, gst_rtsp_stream_get_server_port is a bad and confusing name.

> What if the "server ports" are already allocated on the client
> side?

I don't understand that question.
Comment 10 Patricia Muscalu 2018-04-04 16:43:44 UTC
(In reply to Mathieu Duponchelle from comment #9)
> (In reply to Patricia Muscalu from comment #8)
> > Why is there a dependency between client ports and server ports? It seems
> > very strange.
> 
> That's because the stream API itself is very strange,
> gst_rtsp_stream_get_server_port is a bad and confusing name.

There is no need to call this function at all I think. It's just about allocating client ports for receiving RTP and RTCP, so it shouldn't be any dependencies to the server ports.

> > What if the "server ports" are already allocated on the client
> > side?
> 
> I don't understand that question.

The RTP/RTCP sockets are bound to the RTP/RTCP ports (<=> server ports). The client issues a SETUP request with the client_port pair of ports, so I guess that there are the corresponding sockets associated with these ports on the client side. Am I wrong?
Comment 11 Mathieu Duponchelle 2018-04-05 10:04:53 UTC
(In reply to Patricia Muscalu from comment #10)
> There is no need to call this function at all I think. It's just about
> allocating client ports for receiving RTP and RTCP, so it shouldn't be any
> dependencies to the server ports.
> 

You realize that RTCP goes both ways don't you? In the RECORD case, rtspclientsink will send RTP and RTCP (eg Sender Reports) to the server, but it also needs to inform the server, through "client_ports" in the transports string, about the port it will listen on for RTCP, to receive the Receiver Reports and potential retransmission requests. It obtains these ports through the confusingly named gst_rtsp_stream_get_server_port () API.

> > > What if the "server ports" are already allocated on the client
> > > side?
> > 
> > I don't understand that question.
> 
> The RTP/RTCP sockets are bound to the RTP/RTCP ports (<=> server ports). The
> client issues a SETUP request with the client_port pair of ports, so I guess
> that there are the corresponding sockets associated with these ports on the
> client side. Am I wrong?

See my answer above :)