When joining multicast groups, ffmpeg was using INADDR_ANY as interface address
which leads to enabling the multicast group on the interface with "default gateway".
Often multicast traffic is received over dedicated interface, which scenario ffmpeg was
unable to handle. With this patch, ffmpeg will enable multicast group to the interfaces
configured with address specified in &localaddr= parameter of udp:// URL. To avoid
loacal_addr resolve at udp_close(...) the UDPContext structure was extended with
struct sockaddr_storage local_addr_storage member, which is populated in udp_open(..)
and passed to udp_join_multicast_group() and udp_leave_multicast_group().
Signed-off-by: Stoian Ivanov <s.ivanov@teracomm.bg>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This allows us to explicitly fail if the caller tried to set
both inclusions and exclusions at the same time.
Signed-off-by: Martin Storsjö <martin@martin.st>
Previously this only allowed literal IP addresses. When these
are conveyed in a SDP file as in RFC4570, host names are allowed
as well.
Signed-off-by: Martin Storsjö <martin@martin.st>
This updated version does not deviate from previous behavior on default value of 'buffer_size'
I skipped porting 'sources', 'block' options for now as they're parsed seriously. So i added TODO remarks.
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This patch accepts 'timeout' option for input mode only. As far as i know, UDP output cannot introduce delays.
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This happens with for example mplayer.
Fixing it in ffmpeg allows new ffmpeg to be compiled with older mplayer
which would not be possible if the fix was just in mplayer.
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This heaader is required for close() for sockets in network
code. For winsock, the equivalent function is defined in the
winsock2.h header.
This avoids having the HAVE_UNISTD_H in all files dealing with
raw sockets.
Signed-off-by: Martin Storsjö <martin@martin.st>
Also use ff_neterrno() instead of errno directly (which doesn't work
on windows), for getting the error code.
Signed-off-by: Martin Storsjö <martin@martin.st>
getnameinfo doesn't set errno on failure, it returns an error code,
which should be handled by gai_strerror instead of the normal
strerror.
Signed-off-by: Martin Storsjö <martin@martin.st>
In non-blocking mode, lowest-level read protocols are
supposed block only for a short amount of time to let
retry_transfer_wrapper() check for interrupts.
Also, checking the interrupt_callback in the receiving thread is
wrong, as interrupt_callback is not guaranteed to be thread-safe
and the job is already done by retry_transfer_wrapper(). The error
code was also incorrect.
Bug reported by Andrey Utkin.
This fixes sending back RTCP RR packets if receiving RTP over
multicast.
If the multicast stream is sent on demand (set up and signalled
via RTSP), the sender might depend on getting RTCP RR packets
knowing that there are listeners, otherwise the stream can be
closed after a certain timeout.
This fixes receiving RTSP streams over multicast on unix, from
certain Axis cameras.
Signed-off-by: Martin Storsjö <martin@martin.st>
When this code was added in 36b532815c, the new code was added
between the existing comment and the existing line of code, making
the old comment seem to refer to the new code. This makes it read
correctly.
Signed-off-by: Martin Storsjö <martin@martin.st>
This definition is in two files, since the definitions will move
to the private header at the next bump.
Signed-off-by: Martin Storsjö <martin@martin.st>
When no data was available both the buffer thread as well as
the main thread would block in select(), when data becomes
available both should move forward and as data is read in the
buffer thread the main thread would block in select() later
the read data was put in the fifo but the main thread still
would be blocked in select() until either the timeout or
another packet would come in.
This is solved in this commit by using a mutex and a condition
variable
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This simplifies the open functions by avoiding one function
call that needs error checking, reducing the amount of
extra bulk code.
Signed-off-by: Martin Storsjö <martin@martin.st>