]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
fix linksys bug
authorAnthony Minessale <anthony.minessale@gmail.com>
Mon, 17 Nov 2008 18:42:48 +0000 (18:42 +0000)
committerAnthony Minessale <anthony.minessale@gmail.com>
Mon, 17 Nov 2008 18:42:48 +0000 (18:42 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@10427 d0543943-73ff-0310-b7d9-9358b9ac24b2

src/mod/endpoints/mod_sofia/mod_sofia.c
src/mod/endpoints/mod_sofia/mod_sofia.h

index f5bf788e0bdd5a2be91bd184d4ea53f5f4823dd8..6a6995b3538b8ac2d0321a97f9c29fa73cc08e9c 100644 (file)
@@ -699,17 +699,18 @@ static switch_status_t sofia_read_frame(switch_core_session_t *session, switch_f
                                        }
 
 
-                                       if (tech_pvt->check_frames < 50) {
+                                       if (tech_pvt->check_frames < MAX_CODEC_CHECK_FRAMES) {
                                                if (tech_pvt->last_ts && tech_pvt->read_frame.datalen != tech_pvt->read_codec.implementation->encoded_bytes_per_packet) {
                                                        switch_size_t codec_ms = (int)(tech_pvt->read_frame.timestamp - 
                                                                                                                   tech_pvt->last_ts) / (tech_pvt->read_codec.implementation->samples_per_second / 1000);
                                                        
                                                        if ((codec_ms % 10) != 0) {
-                                                               tech_pvt->check_frames = 50;
+                                                               tech_pvt->check_frames = MAX_CODEC_CHECK_FRAMES;
                                                        } else {
                                                                if (switch_rtp_ready(tech_pvt->rtp_session) && codec_ms != tech_pvt->codec_ms) {
                                                                        tech_pvt->codec_ms = codec_ms;
-                                                                       switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Changing codec ptime to %d\n", tech_pvt->codec_ms);
+                                                                       switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, 
+                                                                                                         "Changing codec ptime to %d. I bet you have a linksys/sipura =D\n", tech_pvt->codec_ms);
                                                                        switch_core_codec_destroy(&tech_pvt->read_codec);
                                                                        switch_core_codec_destroy(&tech_pvt->write_codec);
                                                                        if (sofia_glue_tech_set_codec(tech_pvt, 2) != SWITCH_STATUS_SUCCESS) {
@@ -720,15 +721,17 @@ static switch_status_t sofia_read_frame(switch_core_session_t *session, switch_f
                                                                        switch_rtp_change_interval(tech_pvt->rtp_session, 
                                                                                                                           tech_pvt->read_codec.implementation->samples_per_packet,
                                                                                                                           tech_pvt->codec_ms * 1000);
+
+                                                                       tech_pvt->check_frames = MAX_CODEC_CHECK_FRAMES;
                                                                }
                                                        
                                                        }
                                                        tech_pvt->check_frames++;
-                                                       tech_pvt->last_ts = tech_pvt->read_frame.timestamp;
+
                                                }
+                                               tech_pvt->last_ts = tech_pvt->read_frame.timestamp;
                                        }
                                        
-                                       
                                        if ((bytes = tech_pvt->read_codec.implementation->encoded_bytes_per_packet)) {
                                                frames = (tech_pvt->read_frame.datalen / bytes);
                                        }
index f00349286434d50911e045c29844482228a0124c..1e94937781eb688ab2c94e5f35fc6347093cd6ed 100644 (file)
@@ -53,6 +53,7 @@
 #define HAVE_FUNC 1
 #endif
 
+#define MAX_CODEC_CHECK_FRAMES 50
 #define MODNAME "mod_sofia"
 static const switch_state_handler_table_t noop_state_handler = { 0 };
 struct sofia_gateway;