mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-04-14 00:00:44 +00:00
tweak
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@10497 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
parent
2c10f201e4
commit
52badf996d
@ -702,9 +702,13 @@ static switch_status_t sofia_read_frame(switch_core_session_t *session, switch_f
|
|||||||
*frame = NULL;
|
*frame = NULL;
|
||||||
return SWITCH_STATUS_GENERR;
|
return SWITCH_STATUS_GENERR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (tech_pvt->check_frames++ < MAX_CODEC_CHECK_FRAMES) {
|
||||||
|
if (!tech_pvt->read_codec.implementation->encoded_bytes_per_packet) {
|
||||||
|
tech_pvt->check_frames = MAX_CODEC_CHECK_FRAMES;
|
||||||
|
goto skip;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
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) {
|
if (tech_pvt->last_ts && tech_pvt->read_frame.datalen != tech_pvt->read_codec.implementation->encoded_bytes_per_packet) {
|
||||||
if (++tech_pvt->mismatch_count >= MAX_MISMATCH_FRAMES) {
|
if (++tech_pvt->mismatch_count >= MAX_MISMATCH_FRAMES) {
|
||||||
switch_size_t codec_ms = (int)(tech_pvt->read_frame.timestamp -
|
switch_size_t codec_ms = (int)(tech_pvt->read_frame.timestamp -
|
||||||
@ -712,6 +716,7 @@ static switch_status_t sofia_read_frame(switch_core_session_t *session, switch_f
|
|||||||
|
|
||||||
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;
|
||||||
} else {
|
} else {
|
||||||
if (switch_rtp_ready(tech_pvt->rtp_session) && codec_ms != tech_pvt->codec_ms) {
|
if (switch_rtp_ready(tech_pvt->rtp_session) && codec_ms != tech_pvt->codec_ms) {
|
||||||
const char *val;
|
const char *val;
|
||||||
@ -770,13 +775,13 @@ static switch_status_t sofia_read_frame(switch_core_session_t *session, switch_f
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
tech_pvt->check_frames++;
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
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;
|
||||||
}
|
}
|
||||||
|
skip:
|
||||||
|
|
||||||
if ((bytes = tech_pvt->read_codec.implementation->encoded_bytes_per_packet)) {
|
if ((bytes = tech_pvt->read_codec.implementation->encoded_bytes_per_packet)) {
|
||||||
frames = (tech_pvt->read_frame.datalen / bytes);
|
frames = (tech_pvt->read_frame.datalen / bytes);
|
||||||
|
@ -155,6 +155,8 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_read_frame(switch_core_sessi
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (session->endpoint_interface->io_routines->read_frame) {
|
if (session->endpoint_interface->io_routines->read_frame) {
|
||||||
|
switch_mutex_unlock(session->read_codec->mutex);
|
||||||
|
switch_mutex_unlock(session->codec_read_mutex);
|
||||||
if ((status = session->endpoint_interface->io_routines->read_frame(session, frame, flags, stream_id)) == SWITCH_STATUS_SUCCESS) {
|
if ((status = session->endpoint_interface->io_routines->read_frame(session, frame, flags, stream_id)) == SWITCH_STATUS_SUCCESS) {
|
||||||
for (ptr = session->event_hooks.read_frame; ptr; ptr = ptr->next) {
|
for (ptr = session->event_hooks.read_frame; ptr; ptr = ptr->next) {
|
||||||
if ((status = ptr->read_frame(session, frame, flags, stream_id)) != SWITCH_STATUS_SUCCESS) {
|
if ((status = ptr->read_frame(session, frame, flags, stream_id)) != SWITCH_STATUS_SUCCESS) {
|
||||||
@ -162,6 +164,14 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_read_frame(switch_core_sessi
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!session->read_codec) {
|
||||||
|
*frame = NULL;
|
||||||
|
return SWITCH_STATUS_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch_mutex_lock(session->codec_read_mutex);
|
||||||
|
switch_mutex_lock(session->read_codec->mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (status != SWITCH_STATUS_SUCCESS) {
|
if (status != SWITCH_STATUS_SUCCESS) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user