[vlc-devel] commit: RTP: open the RTCP port ( Rémi Denis-Courmont )
git version control
git at videolan.org
Sun Jul 6 11:23:44 CEST 2008
vlc | branch: master | Rémi Denis-Courmont <rdenis at simphalempin.com> | Sun Jul 6 12:25:24 2008 +0300| [63dbcdb802838799d9aa53d0106d9fbf12baca35]
RTP: open the RTCP port
At least, we won't be sending ICMP errors from now.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=63dbcdb802838799d9aa53d0106d9fbf12baca35
---
modules/demux/rtp.c | 12 ++++++++++--
modules/demux/rtp.h | 1 +
2 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/modules/demux/rtp.c b/modules/demux/rtp.c
index 58e1a1e..380fcad 100644
--- a/modules/demux/rtp.c
+++ b/modules/demux/rtp.c
@@ -176,7 +176,7 @@ static int Open (vlc_object_t *obj)
dport = 5004; /* avt-profile-1 port */
/* Try to connect */
- int fd = -1;
+ int fd = -1, rtcp_fd = -1;
switch (tp)
{
@@ -184,6 +184,10 @@ static int Open (vlc_object_t *obj)
case IPPROTO_UDPLITE:
fd = net_OpenDgram (obj, dhost, (dport + 1) & ~1,
shost, (sport + 1) & ~1, AF_UNSPEC, tp);
+ if (fd == -1)
+ break;
+ rtcp_fd = net_OpenDgram (obj, dhost, dport | 1, shost,
+ sport ? (sport | 1) : 0, AF_UNSPEC, tp);
break;
case IPPROTO_DCCP:
@@ -194,7 +198,7 @@ static int Open (vlc_object_t *obj)
#endif
#ifdef SOCK_DCCP
var_Create (obj, "dccp-service", VLC_VAR_STRING);
- var_SetString (obj, "dccp-service", "RTPV");
+ var_SetString (obj, "dccp-service", "RTPV"); /* FIXME: RTPA? */
fd = net_Connect (obj, shost, (sport + 1) & ~1, SOCK_DCCP, tp);
#else
msg_Err (obj, "DCCP support not included");
@@ -216,6 +220,8 @@ static int Open (vlc_object_t *obj)
if (p_sys == NULL)
{
net_Close (fd);
+ if (rtcp_fd != -1)
+ net_Close (rtcp_fd);
return VLC_EGENERIC;
}
@@ -279,6 +285,8 @@ static void Close (vlc_object_t *obj)
srtp_destroy (p_sys->srtp);
if (p_sys->session)
rtp_session_destroy (demux, p_sys->session);
+ if (p_sys->rtcp_fd != -1)
+ net_Close (p_sys->rtcp_fd);
net_Close (p_sys->fd);
free (p_sys);
}
diff --git a/modules/demux/rtp.h b/modules/demux/rtp.h
index e363878..c8daa66 100644
--- a/modules/demux/rtp.h
+++ b/modules/demux/rtp.h
@@ -45,6 +45,7 @@ struct demux_sys_t
rtp_session_t *session;
struct srtp_session_t *srtp;
int fd;
+ int rtcp_fd;
unsigned caching;
unsigned timeout;
More information about the vlc-devel
mailing list