]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
FS-6887 #resolve #comment new bug flag always_auto_adjust (also implicitly sets accep...
authorAnthony Minessale <anthm@freeswitch.org>
Thu, 2 Oct 2014 16:55:53 +0000 (11:55 -0500)
committerAnthony Minessale <anthm@freeswitch.org>
Thu, 2 Oct 2014 16:55:53 +0000 (11:55 -0500)
src/include/switch_types.h
src/switch_core_media.c
src/switch_rtp.c

index 145d743274bbb1630a8cab317032b201165e1f97..910b44b3380f5d3afb1ce43e2c7a7cecb1539f5f 100644 (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
index ffb54a744889212879e2e2a94c7a6623bd8cfdc7..b0b5ee4ec3b2fc9654a06740ed4ac9e11035074d 100644 (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);
+       }
 }
 
 
index 086d7b0e1c052a9a80ebd042635a51fa88933b00..306a3217d3d5f89ba903e0d0d5fefba34da5b88c 100644 (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);
                        }