Commit 5656d43c authored by Rémi Denis-Courmont's avatar 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.
parent b377e1af
......@@ -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));
}
}
......
......@@ -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 );
}
}
......
......@@ -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 );
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment