FS-6887 #resolve #comment new bug flag always_auto_adjust (also implicitly sets accept_any_packets)

This commit is contained in:
Anthony Minessale 2014-10-02 11:55:53 -05:00
parent 9e9175321a
commit 6bfc05b81e
3 changed files with 34 additions and 5 deletions

View File

@ -839,7 +839,7 @@ typedef enum {
/* FLUSH JITTERBUFFER When getting RFC2833 to reduce bleed through */
RTP_BUG_ACCEPT_ANY_PAYLOAD = (1 << 11)
RTP_BUG_ACCEPT_ANY_PAYLOAD = (1 << 11),
/*
Make FS accept any payload type instead of dropping and returning CNG frame. Workaround while FS only supports a single payload per rtp session.
@ -847,6 +847,15 @@ typedef enum {
This should probably be a flag, but flag enum is already full!
*/
RTP_BUG_ALWAYS_AUTO_ADJUST = (1 << 12)
/*
Leave the auto-adjust behavior enableed permenantly rather than only at appropriate times. (IMPLICITLY sets RTP_BUG_ACCEPT_ANY_PACKETS)
*/
} switch_rtp_bug_flag_t;
#ifdef _MSC_VER

View File

@ -859,6 +859,14 @@ SWITCH_DECLARE(void) switch_core_media_parse_rtp_bugs(switch_rtp_bug_flag_t *fla
if (switch_stristr("~FLUSH_JB_ON_DTMF", str)) {
*flag_pole &= ~RTP_BUG_FLUSH_JB_ON_DTMF;
}
if (switch_stristr("ALWAYS_AUTO_ADJUST", str)) {
*flag_pole |= (RTP_BUG_ALWAYS_AUTO_ADJUST | RTP_BUG_ACCEPT_ANY_PACKETS);
}
if (switch_stristr("~ALWAYS_AUTO_ADJUST", str)) {
*flag_pole &= ~(RTP_BUG_ALWAYS_AUTO_ADJUST | RTP_BUG_ACCEPT_ANY_PACKETS);
}
}

View File

@ -1002,7 +1002,11 @@ static void handle_ice(switch_rtp_t *rtp_session, switch_rtp_ice_t *ice, void *d
return;
}
switch_rtp_clear_flag(rtp_session, SWITCH_RTP_FLAG_AUTOADJ);
if ((rtp_session->rtp_bugs & RTP_BUG_ALWAYS_AUTO_ADJUST)) {
switch_rtp_set_flag(rtp_session, SWITCH_RTP_FLAG_AUTOADJ);
} else {
switch_rtp_clear_flag(rtp_session, SWITCH_RTP_FLAG_AUTOADJ);
}
}
}
@ -5804,19 +5808,27 @@ static int rtp_common_read(switch_rtp_t *rtp_session, switch_payload_t *payload_
}
rtp_session->auto_adj_used = 1;
switch_rtp_set_remote_address(rtp_session, tx_host, switch_sockaddr_get_port(rtp_session->from_addr), 0, SWITCH_FALSE, &err);
switch_rtp_clear_flag(rtp_session, SWITCH_RTP_FLAG_AUTOADJ);
if ((rtp_session->rtp_bugs & RTP_BUG_ALWAYS_AUTO_ADJUST)) {
switch_rtp_set_flag(rtp_session, SWITCH_RTP_FLAG_AUTOADJ);
} else {
switch_rtp_clear_flag(rtp_session, SWITCH_RTP_FLAG_AUTOADJ);
}
if (rtp_session->ice.ice_user) {
rtp_session->ice.addr = rtp_session->remote_addr;
}
}
} else {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_DEBUG, "Correct ip/port confirmed.\n");
switch_rtp_clear_flag(rtp_session, SWITCH_RTP_FLAG_AUTOADJ);
if ((rtp_session->rtp_bugs & RTP_BUG_ALWAYS_AUTO_ADJUST)) {
switch_rtp_set_flag(rtp_session, SWITCH_RTP_FLAG_AUTOADJ);
} else {
switch_rtp_clear_flag(rtp_session, SWITCH_RTP_FLAG_AUTOADJ);
}
rtp_session->auto_adj_used = 0;
}
}
if (bytes && rtp_session->autoadj_window) {
if (bytes && !(rtp_session->rtp_bugs & RTP_BUG_ALWAYS_AUTO_ADJUST) && rtp_session->autoadj_window) {
if (--rtp_session->autoadj_window == 0) {
switch_rtp_clear_flag(rtp_session, SWITCH_RTP_FLAG_AUTOADJ);
}