udp: Set ttl for read-write streams, too, not only for write-only ones
authorMartin Storsjö <martin@martin.st>
Thu, 8 Mar 2012 13:31:45 +0000 (15:31 +0200)
committerMartin Storsjö <martin@martin.st>
Fri, 9 Mar 2012 13:04:05 +0000 (15:04 +0200)
Signed-off-by: Martin Storsjö <martin@martin.st>
libavformat/udp.c

index 3c63f51..37b7655 100644 (file)
@@ -400,11 +400,12 @@ static int udp_open(URLContext *h, const char *uri, int flags)
     s->local_port = udp_port(&my_addr, len);
 
     if (s->is_multicast) {
-        if (!(h->flags & AVIO_FLAG_READ)) {
+        if (h->flags & AVIO_FLAG_WRITE) {
             /* output */
             if (udp_set_multicast_ttl(udp_fd, s->ttl, (struct sockaddr *)&s->dest_addr) < 0)
                 goto fail;
-        } else {
+        }
+        if (h->flags & AVIO_FLAG_READ) {
             /* input */
             if (udp_join_multicast_group(udp_fd, (struct sockaddr *)&s->dest_addr) < 0)
                 goto fail;