[asterisk-commits] oej: branch oej/blackberry-a-rtcp-sdp-support-1.8 r402907 - in /team/oej/blac...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Wed Nov 20 09:04:41 CST 2013
Author: oej
Date: Wed Nov 20 09:04:39 2013
New Revision: 402907
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=402907
Log:
Let's not be shy and commit some buggy code. Let the world send feedback. :-)
Modified:
team/oej/blackberry-a-rtcp-sdp-support-1.8/channels/chan_sip.c
team/oej/blackberry-a-rtcp-sdp-support-1.8/include/asterisk/rtp_engine.h
team/oej/blackberry-a-rtcp-sdp-support-1.8/main/rtp_engine.c
team/oej/blackberry-a-rtcp-sdp-support-1.8/res/res_rtp_asterisk.c
Modified: team/oej/blackberry-a-rtcp-sdp-support-1.8/channels/chan_sip.c
URL: http://svnview.digium.com/svn/asterisk/team/oej/blackberry-a-rtcp-sdp-support-1.8/channels/chan_sip.c?view=diff&rev=402907&r1=402906&r2=402907
==============================================================================
--- team/oej/blackberry-a-rtcp-sdp-support-1.8/channels/chan_sip.c (original)
+++ team/oej/blackberry-a-rtcp-sdp-support-1.8/channels/chan_sip.c Wed Nov 20 09:04:39 2013
@@ -1314,6 +1314,7 @@
static int process_sdp_a_audio(const char *a, struct sip_pvt *p, struct ast_rtp_codecs *newaudiortp, int *last_rtpmap_codec);
static int process_sdp_a_video(const char *a, struct sip_pvt *p, struct ast_rtp_codecs *newvideortp, int *last_rtpmap_codec);
static int process_sdp_a_text(const char *a, struct sip_pvt *p, struct ast_rtp_codecs *newtextrtp, char *red_fmtp, int *red_num_gen, int *red_data_pt, int *last_rtpmap_codec);
+static int process_sdp_a_rtcp(const char *a, unsigned int *rtcpport);
static int process_sdp_a_image(const char *a, struct sip_pvt *p);
static void add_codec_to_sdp(const struct sip_pvt *p, format_t codec,
struct ast_str **m_buf, struct ast_str **a_buf,
@@ -9562,6 +9563,7 @@
/* Media stream specific parameters */
while ((type = get_sdp_line(&iterator, next - 1, req, &value)) != '\0') {
int processed = FALSE;
+ unsigned int rtcpport = 0;
switch (type) {
case 'c':
@@ -9597,6 +9599,9 @@
processed = TRUE;
} else if (process_sdp_a_audio(value, p, &newaudiortp, &last_rtpmap_codec)) {
processed = TRUE;
+ } else if (process_sdp_a_rtcp(value, &rtcpport)) {
+ ast_rtp_instance_set_remote_rtcp_port(p->rtp, rtcpport);
+ processed = TRUE;
}
}
/* Video specific scanning */
@@ -9605,6 +9610,9 @@
processed_crypto = TRUE;
processed = TRUE;
} else if (process_sdp_a_video(value, p, &newvideortp, &last_rtpmap_codec)) {
+ processed = TRUE;
+ } else if (process_sdp_a_rtcp(value, &rtcpport)) {
+ ast_rtp_instance_set_remote_rtcp_port(p->vrtp, rtcpport);
processed = TRUE;
}
}
@@ -10043,6 +10051,30 @@
if (*sendonly == -1)
*sendonly = 0;
found = TRUE;
+ }
+ return found;
+}
+
+/*! \brief Find rtcp header and change RTCP port for remote party */
+static int process_sdp_a_rtcp(const char *a, unsigned int *rtcpport)
+{
+ int found = FALSE;
+ char *tmp;
+ unsigned int port = 0;
+
+ if (strcasecmp(a, "rtcp")) {
+ return found;
+ }
+
+ tmp = strrchr(a, ':');
+ if (tmp) {
+ tmp++;
+ port = (unsigned int) atoi(tmp);
+ if (port > 0) {
+ ast_debug(2, "-- RTCP port set to %d (a=rtcp) \n", port);
+ *rtcpport = port;
+ found = TRUE;
+ }
}
return found;
}
Modified: team/oej/blackberry-a-rtcp-sdp-support-1.8/include/asterisk/rtp_engine.h
URL: http://svnview.digium.com/svn/asterisk/team/oej/blackberry-a-rtcp-sdp-support-1.8/include/asterisk/rtp_engine.h?view=diff&rev=402907&r1=402906&r2=402907
==============================================================================
--- team/oej/blackberry-a-rtcp-sdp-support-1.8/include/asterisk/rtp_engine.h (original)
+++ team/oej/blackberry-a-rtcp-sdp-support-1.8/include/asterisk/rtp_engine.h Wed Nov 20 09:04:39 2013
@@ -341,6 +341,8 @@
void (*packetization_set)(struct ast_rtp_instance *instance, struct ast_codec_pref *pref);
/*! Callback for setting the remote address that RTP is to be sent to */
void (*remote_address_set)(struct ast_rtp_instance *instance, struct ast_sockaddr *sa);
+ /*! Callback for setting the remote port that RTCP is to be sent to */
+ void (*remote_rtcp_port_set)(struct ast_rtp_instance *instance, unsigned int port);
/*! Callback for setting an alternate remote address */
void (*alt_remote_address_set)(struct ast_rtp_instance *instance, struct ast_sockaddr *sa);
/*! Callback for changing DTMF mode */
Modified: team/oej/blackberry-a-rtcp-sdp-support-1.8/main/rtp_engine.c
URL: http://svnview.digium.com/svn/asterisk/team/oej/blackberry-a-rtcp-sdp-support-1.8/main/rtp_engine.c?view=diff&rev=402907&r1=402906&r2=402907
==============================================================================
--- team/oej/blackberry-a-rtcp-sdp-support-1.8/main/rtp_engine.c (original)
+++ team/oej/blackberry-a-rtcp-sdp-support-1.8/main/rtp_engine.c Wed Nov 20 09:04:39 2013
@@ -400,6 +400,14 @@
}
return 0;
+}
+
+int ast_rtp_instance_set_remote_rtcp_port(struct ast_rtp_instance *instance,
+ unsigned int port)
+{
+ if (instance->engine->remote_rtcp_port_set) {
+ instance->engine->remote_rtcp_port_set(instance, port);
+ }
}
int ast_rtp_instance_set_alt_remote_address(struct ast_rtp_instance *instance,
Modified: team/oej/blackberry-a-rtcp-sdp-support-1.8/res/res_rtp_asterisk.c
URL: http://svnview.digium.com/svn/asterisk/team/oej/blackberry-a-rtcp-sdp-support-1.8/res/res_rtp_asterisk.c?view=diff&rev=402907&r1=402906&r2=402907
==============================================================================
--- team/oej/blackberry-a-rtcp-sdp-support-1.8/res/res_rtp_asterisk.c (original)
+++ team/oej/blackberry-a-rtcp-sdp-support-1.8/res/res_rtp_asterisk.c Wed Nov 20 09:04:39 2013
@@ -312,6 +312,7 @@
.prop_set = ast_rtp_prop_set,
.fd = ast_rtp_fd,
.remote_address_set = ast_rtp_remote_address_set,
+ .remote_rtcp_port_set = ast_rtp_remote_rtcp_port_set,
.alt_remote_address_set = ast_rtp_alt_remote_address_set,
.red_init = rtp_red_init,
.red_buffer = rtp_red_buffer,
@@ -2619,6 +2620,15 @@
return;
}
+static void ast_rtp_remote_rtcp_port_set(struct ast_rtp_instance *instance, unsigned int port)
+{
+ struct ast_rtp *rtp = ast_rtp_instance_get_data(instance);
+ if (!ast_sockaddr_isnull(&rtp->rtcp->them)) {
+ ast_sockaddr_set_port(&rtp->rtcp->them, port);
+ ast_debug(1, "Setting RTCP port on RTP instance '%p' to %d\n", instance, port);
+ }
+}
+
static void ast_rtp_alt_remote_address_set(struct ast_rtp_instance *instance, struct ast_sockaddr *addr)
{
struct ast_rtp *rtp = ast_rtp_instance_get_data(instance);
More information about the asterisk-commits
mailing list