follow up to last commit

This commit is contained in:
Anthony Minessale committed 2013-08-16 12:17:00 -04:00
1 parent 80e2633bb7
commit d35db852a8
6 files changed
+27 -15

No files matched your search

+8 -1
View File
@@ -1225,12 +1225,19 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_read_frame(switch_core_session
switch_assert(engine->rtp_session != NULL);
engine->read_frame.datalen = 0;
if (!switch_channel_up_nosig(session->channel) || !switch_rtp_ready(engine->rtp_session) || switch_channel_test_flag(session->channel, CF_NOT_READY)) {
return SWITCH_STATUS_FALSE;
}
if (switch_mutex_trylock(engine->read_mutex) != SWITCH_STATUS_SUCCESS) {
/* return CNG for now */
/* return CNG, another thread is already reading */
*frame = &engine->read_frame;
switch_set_flag((*frame), SFF_CNG);
(*frame)->datalen = engine->read_impl.encoded_bytes_per_packet;
memset((*frame)->data, 0, (*frame)->datalen);
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG1, "%s is already being read for %s\n",
switch_channel_get_name(session->channel), type2str(type));
switch_yield(10000);
return SWITCH_STATUS_SUCCESS;
}