[FFmpeg-cvslog] udp: Only bind to the multicast address if in read-only mode
Martin Storsjö
git at videolan.org
Sat Mar 10 01:52:19 CET 2012
ffmpeg | branch: master | Martin Storsjö <martin at martin.st> | Thu Mar 8 15:17:15 2012 +0200| [c700fdb00f28a65c42b37c43d82a29733f1cc20e] | committer: Martin Storsjö
udp: Only bind to the multicast address if in read-only mode
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 at martin.st>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=c700fdb00f28a65c42b37c43d82a29733f1cc20e
---
libavformat/udp.c | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/libavformat/udp.c b/libavformat/udp.c
index e91b95c..3c63f51 100644
--- a/libavformat/udp.c
+++ b/libavformat/udp.c
@@ -382,8 +382,9 @@ static int udp_open(URLContext *h, const char *uri, int flags)
/* If multicast, try binding the multicast address first, to avoid
* receiving UDP packets from other sources aimed at the same UDP
- * port. This fails on windows. */
- if (s->is_multicast && (h->flags & AVIO_FLAG_READ)) {
+ * port. This fails on windows. This makes sending to the same address
+ * using sendto() fail, so only do it if we're opened in read-only mode. */
+ if (s->is_multicast && !(h->flags & AVIO_FLAG_WRITE)) {
bind_ret = bind(udp_fd,(struct sockaddr *)&s->dest_addr, len);
}
/* bind to the local address if not multicast or if the multicast
More information about the ffmpeg-cvslog
mailing list