FS-7173 #comment please test

This commit is contained in:
Anthony Minessale 2015-01-23 11:03:33 -06:00
parent ca213338a0
commit fc93895624
2 changed files with 21 additions and 3 deletions

View File

@ -319,6 +319,9 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_get_read_impl(switch_core_se
if (session->read_impl.codec_id) {
*impp = session->read_impl;
return SWITCH_STATUS_SUCCESS;
} else {
memset(impp, 0, sizeof(*impp));
impp->number_of_channels = 1;
}
return SWITCH_STATUS_FALSE;
@ -329,6 +332,9 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_get_real_read_impl(switch_co
if (session->real_read_impl.codec_id) {
*impp = session->real_read_impl;
return SWITCH_STATUS_SUCCESS;
} else {
memset(impp, 0, sizeof(*impp));
impp->number_of_channels = 1;
}
return SWITCH_STATUS_FALSE;
@ -339,6 +345,9 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_get_write_impl(switch_core_s
if (session->write_impl.codec_id) {
*impp = session->write_impl;
return SWITCH_STATUS_SUCCESS;
} else {
memset(impp, 0, sizeof(*impp));
impp->number_of_channels = 1;
}
return SWITCH_STATUS_FALSE;
@ -349,6 +358,9 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_get_video_read_impl(switch_c
if (session->video_read_impl.codec_id) {
*impp = session->video_read_impl;
return SWITCH_STATUS_SUCCESS;
} else {
memset(impp, 0, sizeof(*impp));
impp->number_of_channels = 1;
}
return SWITCH_STATUS_FALSE;
@ -359,6 +371,9 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_get_video_write_impl(switch_
if (session->video_write_impl.codec_id) {
*impp = session->video_write_impl;
return SWITCH_STATUS_SUCCESS;
} else {
memset(impp, 0, sizeof(*impp));
impp->number_of_channels = 1;
}
return SWITCH_STATUS_FALSE;

View File

@ -1121,8 +1121,8 @@ static void *SWITCH_THREAD_FUNC recording_thread(switch_thread_t *thread, void *
switch_channel_t *channel = switch_core_session_get_channel(session);
struct record_helper *rh;
switch_size_t bsize = SWITCH_RECOMMENDED_BUFFER_SIZE, samples = 0, inuse = 0;
unsigned char *data = switch_core_session_alloc(session, bsize);
int channels = switch_core_media_bug_test_flag(bug, SMBF_STEREO) ? 2 : rh->read_impl.number_of_channels;
unsigned char *data;
int channels = 1;
if (switch_core_session_read_lock(session) != SWITCH_STATUS_SUCCESS) {
return NULL;
@ -1132,6 +1132,9 @@ static void *SWITCH_THREAD_FUNC recording_thread(switch_thread_t *thread, void *
switch_buffer_create_dynamic(&rh->thread_buffer, 1024 * 512, 1024 * 64, 0);
rh->thread_ready = 1;
channels = switch_core_media_bug_test_flag(bug, SMBF_STEREO) ? 2 : rh->read_impl.number_of_channels;
data = switch_core_session_alloc(session, bsize);
while(switch_test_flag(rh->fh, SWITCH_FILE_OPEN)) {
switch_mutex_lock(rh->buffer_mutex);
inuse = switch_buffer_inuse(rh->thread_buffer);
@ -1144,7 +1147,7 @@ static void *SWITCH_THREAD_FUNC recording_thread(switch_thread_t *thread, void *
switch_mutex_unlock(rh->buffer_mutex);
break;
}
samples = switch_buffer_read(rh->thread_buffer, data, bsize) / 2 / channels;
switch_mutex_unlock(rh->buffer_mutex);