[vlc-devel] commit: RTP out: hint the IP stack we won' t be receiving anything on UDP sockets ( Rémi Denis-Courmont )

git version control git at videolan.org
Mon Dec 7 19:47:33 CET 2009


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Mon Dec  7 20:45:59 2009 +0200| [5656d43c43708f75bd0d6795de5b08745dfa8a1d] | committer: Rémi Denis-Courmont 

RTP out: hint the IP stack we won't be receiving anything on UDP sockets

Currently, we never read from RTP and RTCP sockets, so we might as well
set their RX buffer size to zero.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=5656d43c43708f75bd0d6795de5b08745dfa8a1d
---

 modules/stream_out/rtcp.c |    6 ++++--
 modules/stream_out/rtp.c  |    4 ++++
 modules/stream_out/rtsp.c |    3 +++
 3 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/modules/stream_out/rtcp.c b/modules/stream_out/rtcp.c
index 5680e9b..54e2c83 100644
--- a/modules/stream_out/rtcp.c
+++ b/modules/stream_out/rtcp.c
@@ -106,15 +106,17 @@ rtcp_sender_t *OpenRTCP (vlc_object_t *obj, int rtp_fd, int proto,
         dport++;
 
         fd = net_OpenDgram (obj, src, sport, dst, dport, AF_UNSPEC, proto);
-
-        /* Copy the multicast IPv4 TTL value (useless for IPv6) */
         if (fd != -1)
         {
+            /* Copy the multicast IPv4 TTL value (useless for IPv6) */
             int ttl;
             socklen_t len = sizeof (ttl);
 
             if (!getsockopt (rtp_fd, SOL_IP, IP_MULTICAST_TTL, &ttl, &len))
                 setsockopt (fd, SOL_IP, IP_MULTICAST_TTL, &ttl, len);
+
+            /* Ignore all incoming RTCP-RR packets */
+            setsockopt (fd, SOL_SOCKET, SO_RCVBUF, &(int){ 0 }, sizeof (int));
         }
     }
 
diff --git a/modules/stream_out/rtp.c b/modules/stream_out/rtp.c
index f7f80ed..edd53fd 100644
--- a/modules/stream_out/rtp.c
+++ b/modules/stream_out/rtp.c
@@ -1029,6 +1029,10 @@ static sout_stream_id_t *Add( sout_stream_t *p_stream, es_format_t *p_fmt )
                     msg_Err( p_stream, "cannot create RTP socket" );
                     goto error;
                 }
+                /* Ignore any unexpected incoming packet (including RTCP-RR
+                 * packets in case of rtcp-mux) */
+                setsockopt (fd, SOL_SOCKET, SO_RCVBUF, &(int){ 0 },
+                            sizeof (int));
                 rtp_add_sink( id, fd, p_sys->rtcp_mux );
             }
         }
diff --git a/modules/stream_out/rtsp.c b/modules/stream_out/rtsp.c
index 2e29e15..1dca3de 100644
--- a/modules/stream_out/rtsp.c
+++ b/modules/stream_out/rtsp.c
@@ -557,6 +557,9 @@ static int RtspHandler( rtsp_stream_t *rtsp, rtsp_stream_id_t *id,
                         continue;
                     }
 
+                    /* Ignore any unexpected incoming packet */
+                    setsockopt (track.fd, SOL_SOCKET, SO_RCVBUF, &(int){ 0 },
+                                sizeof (int));
                     net_GetSockAddress( track.fd, src, &sport );
 
                     vlc_mutex_lock( &rtsp->lock );




More information about the vlc-devel mailing list