mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-04-18 17:41:53 +00:00
improve bad timestamp detection
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@14979 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
parent
673aa31ad0
commit
374925d9ba
@ -761,7 +761,8 @@ static switch_status_t sofia_read_frame(switch_core_session_t *session, switch_f
|
|||||||
return SWITCH_STATUS_GENERR;
|
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) {
|
if (!tech_pvt->read_impl.encoded_bytes_per_packet) {
|
||||||
tech_pvt->check_frames = MAX_CODEC_CHECK_FRAMES;
|
tech_pvt->check_frames = MAX_CODEC_CHECK_FRAMES;
|
||||||
goto skip;
|
goto skip;
|
||||||
@ -770,7 +771,6 @@ static switch_status_t sofia_read_frame(switch_core_session_t *session, switch_f
|
|||||||
if (tech_pvt->last_ts && tech_pvt->read_frame.datalen != tech_pvt->read_impl.encoded_bytes_per_packet) {
|
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 -
|
switch_size_t codec_ms = (int)(tech_pvt->read_frame.timestamp -
|
||||||
tech_pvt->last_ts) / (tech_pvt->read_impl.samples_per_second / 1000);
|
tech_pvt->last_ts) / (tech_pvt->read_impl.samples_per_second / 1000);
|
||||||
|
|
||||||
if ((codec_ms % 10) != 0) {
|
if ((codec_ms % 10) != 0) {
|
||||||
tech_pvt->check_frames = MAX_CODEC_CHECK_FRAMES;
|
tech_pvt->check_frames = MAX_CODEC_CHECK_FRAMES;
|
||||||
goto skip;
|
goto skip;
|
||||||
@ -871,6 +871,9 @@ static switch_status_t sofia_read_frame(switch_core_session_t *session, switch_f
|
|||||||
tech_pvt->mismatch_count = 0;
|
tech_pvt->mismatch_count = 0;
|
||||||
}
|
}
|
||||||
tech_pvt->last_ts = tech_pvt->read_frame.timestamp;
|
tech_pvt->last_ts = tech_pvt->read_frame.timestamp;
|
||||||
|
} else {
|
||||||
|
tech_pvt->mismatch_count = 0;
|
||||||
|
tech_pvt->last_ts = 0;
|
||||||
}
|
}
|
||||||
skip:
|
skip:
|
||||||
|
|
||||||
|
@ -53,7 +53,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define MAX_CODEC_CHECK_FRAMES 50
|
#define MAX_CODEC_CHECK_FRAMES 50
|
||||||
#define MAX_MISMATCH_FRAMES 3
|
#define MAX_MISMATCH_FRAMES 5
|
||||||
#define MODNAME "mod_sofia"
|
#define MODNAME "mod_sofia"
|
||||||
#define SOFIA_DEFAULT_CONTACT_USER MODNAME
|
#define SOFIA_DEFAULT_CONTACT_USER MODNAME
|
||||||
static const switch_state_handler_table_t noop_state_handler = { 0 };
|
static const switch_state_handler_table_t noop_state_handler = { 0 };
|
||||||
|
Loading…
x
Reference in New Issue
Block a user