Revision
14979
Author
anthm
Date
2009-09-25 13:25:45 -0500 (Fri, 25 Sep 2009)

Log Message

improve bad timestamp detection

Modified Paths

Diff

Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c (14978 => 14979)


--- freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c	2009-09-25 17:03:34 UTC (rev 14978)
+++ freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c	2009-09-25 18:25:45 UTC (rev 14979)
@@ -761,16 +761,16 @@
 						return SWITCH_STATUS_GENERR;
 					}
 					
-					if (sofia_test_pflag(tech_pvt->profile, PFLAG_AUTOFIX_TIMING) && tech_pvt->check_frames++ < MAX_CODEC_CHECK_FRAMES) {
+					if ((tech_pvt->read_frame.datalen % 10) == 0 &&
+						sofia_test_pflag(tech_pvt->profile, PFLAG_AUTOFIX_TIMING) && tech_pvt->check_frames++ < MAX_CODEC_CHECK_FRAMES) {
 						if (!tech_pvt->read_impl.encoded_bytes_per_packet) {
 							tech_pvt->check_frames = MAX_CODEC_CHECK_FRAMES;
 							goto skip;
 						}
-
+						
 						if (tech_pvt->last_ts && tech_pvt->read_frame.datalen != tech_pvt->read_impl.encoded_bytes_per_packet) {
 							switch_size_t codec_ms = (int)(tech_pvt->read_frame.timestamp - 
 														   tech_pvt->last_ts) / (tech_pvt->read_impl.samples_per_second / 1000);
-
 							if ((codec_ms % 10) != 0) {
 								tech_pvt->check_frames = MAX_CODEC_CHECK_FRAMES;
 								goto skip;
@@ -871,6 +871,9 @@
 							tech_pvt->mismatch_count = 0;
 						}
 						tech_pvt->last_ts = tech_pvt->read_frame.timestamp;
+					} else {
+						tech_pvt->mismatch_count = 0;
+						tech_pvt->last_ts = 0;
 					}
 				skip:
 					

Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.h (14978 => 14979)


--- freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.h	2009-09-25 17:03:34 UTC (rev 14978)
+++ freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.h	2009-09-25 18:25:45 UTC (rev 14979)
@@ -53,7 +53,7 @@
 #endif
 
 #define MAX_CODEC_CHECK_FRAMES 50
-#define MAX_MISMATCH_FRAMES 3
+#define MAX_MISMATCH_FRAMES 5
 #define MODNAME "mod_sofia"
 #define SOFIA_DEFAULT_CONTACT_USER MODNAME
 static const switch_state_handler_table_t noop_state_handler = { 0 };