[FFmpeg-devel] [patch] fix problem receiving udp multicast
ed.torbett at simulation-systems.co.uk
Fri Nov 22 09:58:00 CET 2013
> Unfortunately this issue is result of a poor design. The UDP code relies
> on the assumption that only these multicast groups have been joined by
> the host that are relevant for the current UDP stream. This is not
> correct, because multicast groups are always joined system wide. So you
> will receive all the multicast packets sent to a single UDP port that
> are come from multicast groups joined by the system.
> The only way to limit the multicast packets that are sent to a single
> multicast group is using bind.
> So basically my first patch is the only one that works properly. I will
> keep it that way, because it fixes RTP and RTCP reception.
I must apologise for an error in my previous email - the code in question where the source IP address is checked in is rtpproto.c (a method named rtp_check_source_lists, to be exact). Please read it - you can confirm for yourself that exists specifically for this purpose.
You are quite right about the issue with receiving all multicast streams that the system is subscribed to - this is exactly why I wrote the code I'm referring you to. I have, by the sound of it, a very similar system to you - hundreds of RTSP video sources, each broadcasting to the same UDP multicast address and port, and also accessible by unicast. The only way to tell is what address you're given on connection.
RFC4570 states that for receiving a UDP multicast stream, you must specify the unicast ip address of the source in the SDP using the source-filter attribute. In your comment below:
> 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
You state that the source filter can't contain a hard-coded IP address. I fail to see how this is the case, given that your SDP file already does - 172.16.1.147. This is the same IP address that you should be using in your source-filter. It doesn't matter whether you're going to be receiving in unicast or multicast as the source-filter attribute only applies to multicast and is supposed to be the unicast IP address of the source (which you already specify).
Please try adding the source-filter SDP attribute and see what effect that has, before submitting this patch. I will also apply your patch and test it with the setup I have to ensure that it doesn't break anything.
More information about the ffmpeg-devel