[FFmpeg-devel] [patch] fix problem receiving udp multicast
Deti Fliegl
deti at fliegl.de
Wed Nov 20 19:39:34 CET 2013
On 20.11.13 17:54, Deti Fliegl wrote:
> On 20.11.13 10:23, Ed Torbett wrote:
>>
>> Full RFC4570 support was added early august. The lack of binding is not what's stopping decoding, as udp.c contains code to filter based on source address outside of the binding.
>>
>> If you're not using SDP files, make sure you use the ?sources= parameter to set the multicast source addresses. If you are using SDP files then as stated in RFC4570 you should be using the source-filter attribute to specify the source address.
> It clearly does not work with rtsp URLs and rtsp_transport set to
> udp_multicast. The SDP cannot contain any predefined IP address as the
> server could answer in unicast or multicast. In my example the SDP looks
> like this:
> v=0
> o=- 1188340656180883 1 IN IP4 172.16.1.147
> s=Session streamed with GStreamer
> i=rtsp-server
> t=0 0
> a=tool:GStreamer
> a=type:broadcast
> a=control:*
> a=range:npt=now-
> a=clock-domain:PTPv2 0
> a=sync-time:0
> m=audio 0 RTP/AVP 97
> c=IN IP4 0.0.0.0
> a=rtpmap:97 L16/48000/2
> a=control:stream=0
>
> The resulting URL in rtsp.c line 1530 is rtp://224.3.2.0:5000?ttl=1
>
> IMHO the rtsp code does not use sources when they are needed most. So
> what would you?
Instead of allowing bind in udp.c I now added 'sources' to the URL in
rtsp.c (see the patch attached) and did not receive any data. It seems
udp.c does not properly filter sources for multicast addresses.
Deti
-------------- next part --------------
diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c
index 3b88fc7..dc5baf8 100644
--- a/libavformat/rtsp.c
+++ b/libavformat/rtsp.c
@@ -1508,7 +1508,7 @@ int ff_rtsp_make_setup_request(AVFormatContext *s, const char *host, int port,
break;
}
case RTSP_LOWER_TRANSPORT_UDP_MULTICAST: {
- char url[1024], namebuf[50], optbuf[20] = "";
+ char url[1024], namebuf[50], optbuf[60] = "";
struct sockaddr_storage addr;
int port, ttl;
@@ -1522,11 +1522,12 @@ int ff_rtsp_make_setup_request(AVFormatContext *s, const char *host, int port,
ttl = rtsp_st->sdp_ttl;
}
if (ttl > 0)
- snprintf(optbuf, sizeof(optbuf), "?ttl=%d", ttl);
+ snprintf(optbuf, sizeof(optbuf), "&ttl=%d", ttl);
getnameinfo((struct sockaddr*) &addr, sizeof(addr),
namebuf, sizeof(namebuf), NULL, 0, NI_NUMERICHOST);
ff_url_join(url, sizeof(url), "rtp", NULL, namebuf,
- port, "%s", optbuf);
+ port, "?sources=%s%s", namebuf, optbuf);
+ av_log(s, AV_LOG_DEBUG, "URL: %s\n", url);
if (ffurl_open(&rtsp_st->rtp_handle, url, AVIO_FLAG_READ_WRITE,
&s->interrupt_callback, NULL) < 0) {
err = AVERROR_INVALIDDATA;
More information about the ffmpeg-devel
mailing list