rtspsrc: Fix usage of IPv6 connections in SETUP
authorNirbheek Chauhan <nirbheek@centricular.com>
Tue, 1 Mar 2022 11:00:10 +0000 (16:30 +0530)
committerGStreamer Marge Bot <gitlab-merge-bot@gstreamer-foundation.org>
Tue, 27 Sep 2022 18:59:59 +0000 (18:59 +0000)
commit0aa9d8ade653a2c6af3867e0935801cda4fa4e6c
tree2391cf1d50ce53e93ba9a46f09b0aa8107d194d7
parentf8d56e5df6543b9121aaf0c81525868ad82baf43
rtspsrc: Fix usage of IPv6 connections in SETUP

If the SETUP request returns an IPv6 server address in the Transport
field, we would generate an incorrect URI, and multiudpsink would fail
to initialize:

```
     rtspsrc gstrtspsrc.c:9780:dump_key_value:<source>    key: 'Transport', value: 'RTP/AVP;unicast;source=fe80::dc27:25ff:fe5e:bd13:8080;client_port=62696-62697;server_port=4000-4001'
...
     rtspsrc gstrtspsrc.c:4595:gst_rtspsrc_stream_configure_udp_sinks:<source> configure RTP UDP sink for fe80::dc27:25ff:fe5e:bd13:8080:4000
...
multiudpsink gstmultiudpsink.c:1229:gst_multiudpsink_configure_client:<udpsink0> error: Invalid address family (got 23)
```

We can't look at stream->is_ipv6 because we can't rely on the server
returning the right value there. In the issue reported about this,
server reported itself as `KuP RTSP Server/0.1`, and the SDP was:

```
c=IN IP4
m=video 54608 RTP/AVP 96
a=rtpmap:96 H264/90000
```

So we need to parse the string value and figure out the family
ourselves.

Fixes https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/1058

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1819>
subprojects/gst-plugins-good/gst/rtsp/gstrtspsrc.c