diff options
author | twilson <twilson@f38db490-d61c-443f-a65b-d21fe96a405b> | 2010-03-12 22:04:51 +0000 |
---|---|---|
committer | twilson <twilson@f38db490-d61c-443f-a65b-d21fe96a405b> | 2010-03-12 22:04:51 +0000 |
commit | 88bfcb671328040b79c9d6ca966402539524326d (patch) | |
tree | 24326afc8f1cbf64c5dc15d7013b19991584bf86 /channels | |
parent | 19019525545806c438b9877c638a0bcc410267f5 (diff) |
Only change the RTP ssrc when we see that it has changed
This change basically reverts the change reviewed in
https://reviewboard.asterisk.org/r/374/ and instead limits the
updating of the RTP synchronization source to only those times when we
detect that the other side of the conversation has changed the ssrc.
The problem is that SRCUPDATE control frames are sent many times where
we don't want a new ssrc, including whenever Asterisk has to send DTMF
in a normal bridge. This is also not the first time that this mistake
has been made. The initial implementation of the ast_rtp_new_source
function also changed the ssrc--and then it was removed because of
this same issue. Then, we put it back in again to fix a different
issue. This patch attempts to only change the ssrc when we see that
the other side of the conversation has changed the ssrc.
It also renames some functions to make their purpose more clear.
Review: https://reviewboard.asterisk.org/r/540/
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@252089 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'channels')
-rw-r--r-- | channels/chan_h323.c | 6 | ||||
-rw-r--r-- | channels/chan_mgcp.c | 5 | ||||
-rw-r--r-- | channels/chan_sip.c | 24 | ||||
-rw-r--r-- | channels/chan_skinny.c | 5 | ||||
-rw-r--r-- | channels/sip/include/sip.h | 3 |
5 files changed, 22 insertions, 21 deletions
diff --git a/channels/chan_h323.c b/channels/chan_h323.c index 145a3f5bb..f2a6bc511 100644 --- a/channels/chan_h323.c +++ b/channels/chan_h323.c @@ -914,7 +914,11 @@ static int oh323_indicate(struct ast_channel *c, int condition, const void *data res = 0; break; case AST_CONTROL_SRCUPDATE: - ast_rtp_instance_new_source(pvt->rtp); + ast_rtp_instance_update_source(pvt->rtp); + res = 0; + break; + case AST_CONTROL_SRCCHANGE: + ast_rtp_instance_change_source(pvt->rtp); res = 0; break; case AST_CONTROL_PROCEEDING: diff --git a/channels/chan_mgcp.c b/channels/chan_mgcp.c index 5dfafb84a..16195cb2e 100644 --- a/channels/chan_mgcp.c +++ b/channels/chan_mgcp.c @@ -1456,7 +1456,10 @@ static int mgcp_indicate(struct ast_channel *ast, int ind, const void *data, siz ast_moh_stop(ast); break; case AST_CONTROL_SRCUPDATE: - ast_rtp_instance_new_source(sub->rtp); + ast_rtp_instance_update_source(sub->rtp); + break; + case AST_CONTROL_SRCCHANGE: + ast_rtp_instance_change_source(sub->rtp); break; case AST_CONTROL_PROGRESS: case AST_CONTROL_PROCEEDING: diff --git a/channels/chan_sip.c b/channels/chan_sip.c index b8f93b583..ae1cbb3a2 100644 --- a/channels/chan_sip.c +++ b/channels/chan_sip.c @@ -3903,7 +3903,6 @@ static int create_addr_from_peer(struct sip_pvt *dialog, struct sip_peer *peer) if (dialog->rtp) { /* Audio */ ast_rtp_instance_set_prop(dialog->rtp, AST_RTP_PROPERTY_DTMF, ast_test_flag(&dialog->flags[0], SIP_DTMF) == SIP_DTMF_RFC2833); ast_rtp_instance_set_prop(dialog->rtp, AST_RTP_PROPERTY_DTMF_COMPENSATE, ast_test_flag(&dialog->flags[1], SIP_PAGE2_RFC2833_COMPENSATE)); - ast_rtp_instance_set_prop(dialog->rtp, AST_RTP_PROPERTY_CONSTANT_SSRC, ast_test_flag(&dialog->flags[1], SIP_PAGE2_CONSTANT_SSRC)); ast_rtp_instance_set_timeout(dialog->rtp, peer->rtptimeout); ast_rtp_instance_set_hold_timeout(dialog->rtp, peer->rtpholdtimeout); /* Set Frame packetization */ @@ -3913,7 +3912,6 @@ static int create_addr_from_peer(struct sip_pvt *dialog, struct sip_peer *peer) if (dialog->vrtp) { /* Video */ ast_rtp_instance_set_timeout(dialog->vrtp, peer->rtptimeout); ast_rtp_instance_set_hold_timeout(dialog->vrtp, peer->rtpholdtimeout); - ast_rtp_instance_set_prop(dialog->vrtp, AST_RTP_PROPERTY_CONSTANT_SSRC, ast_test_flag(&dialog->flags[1], SIP_PAGE2_CONSTANT_SSRC)); } if (dialog->trtp) { /* Realtime text */ ast_rtp_instance_set_timeout(dialog->trtp, peer->rtptimeout); @@ -4970,7 +4968,7 @@ static int sip_answer(struct ast_channel *ast) ast_setstate(ast, AST_STATE_UP); ast_debug(1, "SIP answering channel: %s\n", ast->name); - ast_rtp_instance_new_source(p->rtp); + ast_rtp_instance_update_source(p->rtp); res = transmit_response_with_sdp(p, "200 OK", &p->initreq, XMIT_CRITICAL, FALSE, TRUE); ast_set_flag(&p->flags[1], SIP_PAGE2_DIALOG_ESTABLISHED); } @@ -5002,7 +5000,7 @@ static int sip_write(struct ast_channel *ast, struct ast_frame *frame) if ((ast->_state != AST_STATE_UP) && !ast_test_flag(&p->flags[0], SIP_PROGRESS_SENT) && !ast_test_flag(&p->flags[0], SIP_OUTGOING)) { - ast_rtp_instance_new_source(p->rtp); + ast_rtp_instance_update_source(p->rtp); if (!global_prematuremediafilter) { p->invitestate = INV_EARLY_MEDIA; transmit_provisional_response(p, "183 Session Progress", &p->initreq, TRUE); @@ -5333,11 +5331,11 @@ static int sip_indicate(struct ast_channel *ast, int condition, const void *data res = -1; break; case AST_CONTROL_HOLD: - ast_rtp_instance_new_source(p->rtp); + ast_rtp_instance_update_source(p->rtp); ast_moh_start(ast, data, p->mohinterpret); break; case AST_CONTROL_UNHOLD: - ast_rtp_instance_new_source(p->rtp); + ast_rtp_instance_update_source(p->rtp); ast_moh_stop(ast); break; case AST_CONTROL_VIDUPDATE: /* Request a video frame update */ @@ -5356,7 +5354,10 @@ static int sip_indicate(struct ast_channel *ast, int condition, const void *data } break; case AST_CONTROL_SRCUPDATE: - ast_rtp_instance_new_source(p->rtp); + ast_rtp_instance_update_source(p->rtp); + break; + case AST_CONTROL_SRCCHANGE: + ast_rtp_instance_change_source(p->rtp); break; case AST_CONTROL_CONNECTED_LINE: update_connectedline(p, data, datalen); @@ -19232,12 +19233,6 @@ static int handle_request_invite(struct sip_pvt *p, struct sip_request *req, int res = -1; goto request_invite_cleanup; } - if (p->rtp) { - ast_rtp_instance_set_prop(p->rtp, AST_RTP_PROPERTY_CONSTANT_SSRC, ast_test_flag(&p->flags[1], SIP_PAGE2_CONSTANT_SSRC)); - } - if (p->vrtp) { - ast_rtp_instance_set_prop(p->vrtp, AST_RTP_PROPERTY_CONSTANT_SSRC, ast_test_flag(&p->flags[1], SIP_PAGE2_CONSTANT_SSRC)); - } } else { /* No SDP in invite, call control session */ p->jointcapability = p->capability; ast_debug(2, "No SDP in Invite, third party call control\n"); @@ -22595,9 +22590,6 @@ static int handle_common_options(struct ast_flags *flags, struct ast_flags *mask } else if (!strcasecmp(v->name, "buggymwi")) { ast_set_flag(&mask[1], SIP_PAGE2_BUGGY_MWI); ast_set2_flag(&flags[1], ast_true(v->value), SIP_PAGE2_BUGGY_MWI); - } else if (!strcasecmp(v->name, "constantssrc")) { - ast_set_flag(&mask[1], SIP_PAGE2_CONSTANT_SSRC); - ast_set2_flag(&flags[1], ast_true(v->value), SIP_PAGE2_CONSTANT_SSRC); } else res = 0; diff --git a/channels/chan_skinny.c b/channels/chan_skinny.c index 136e2699c..a19fdc15f 100644 --- a/channels/chan_skinny.c +++ b/channels/chan_skinny.c @@ -4304,7 +4304,10 @@ static int skinny_indicate(struct ast_channel *ast, int ind, const void *data, s case AST_CONTROL_PROCEEDING: break; case AST_CONTROL_SRCUPDATE: - ast_rtp_instance_new_source(sub->rtp); + ast_rtp_instance_update_source(sub->rtp); + break; + case AST_CONTROL_SRCCHANGE: + ast_rtp_instance_change_source(sub->rtp); break; case AST_CONTROL_CONNECTED_LINE: update_connectedline(sub, data, datalen); diff --git a/channels/sip/include/sip.h b/channels/sip/include/sip.h index 6ae1ce069..57fac84ca 100644 --- a/channels/sip/include/sip.h +++ b/channels/sip/include/sip.h @@ -308,7 +308,6 @@ #define SIP_PAGE2_Q850_REASON (1 << 4) /*!< DP: Get/send cause code via Reason header */ /* Space for addition of other realtime flags in the future */ -#define SIP_PAGE2_CONSTANT_SSRC (1 << 7) /*!< GDP: Don't change SSRC on reinvite */ #define SIP_PAGE2_SYMMETRICRTP (1 << 8) /*!< GDP: Whether symmetric RTP is enabled or not */ #define SIP_PAGE2_STATECHANGEQUEUE (1 << 9) /*!< D: Unsent state pending change exists */ @@ -346,7 +345,7 @@ SIP_PAGE2_VIDEOSUPPORT | SIP_PAGE2_T38SUPPORT | SIP_PAGE2_RFC2833_COMPENSATE | \ SIP_PAGE2_BUGGY_MWI | SIP_PAGE2_TEXTSUPPORT | SIP_PAGE2_FAX_DETECT | \ SIP_PAGE2_UDPTL_DESTINATION | SIP_PAGE2_VIDEOSUPPORT_ALWAYS | SIP_PAGE2_PREFERRED_CODEC | \ - SIP_PAGE2_RPID_IMMEDIATE | SIP_PAGE2_RPID_UPDATE | SIP_PAGE2_SYMMETRICRTP | SIP_PAGE2_CONSTANT_SSRC |\ + SIP_PAGE2_RPID_IMMEDIATE | SIP_PAGE2_RPID_UPDATE | SIP_PAGE2_SYMMETRICRTP |\ SIP_PAGE2_Q850_REASON) /*@}*/ |