From 59de6b8c5e0dbfb0c86acdcb8b8519c51ace9af8 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Wed, 4 Mar 2009 23:15:13 +0000 Subject: [PATCH] FSCORE-320 git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@12428 d0543943-73ff-0310-b7d9-9358b9ac24b2 --- src/switch_core_media_bug.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/switch_core_media_bug.c b/src/switch_core_media_bug.c index 753d4f56c8..a8d8ec5e36 100644 --- a/src/switch_core_media_bug.c +++ b/src/switch_core_media_bug.c @@ -122,7 +122,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_bug_read(switch_media_bug_t *b return SWITCH_STATUS_FALSE; } - if (!(bug->raw_read_buffer && bug->raw_write_buffer)) { + if (!(bug->raw_read_buffer && (bug->raw_write_buffer || !switch_test_flag(bug, SMBF_WRITE_STREAM)))) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "%sBuffer Error\n", switch_channel_get_name(bug->session->channel)); } @@ -136,13 +136,15 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_bug_read(switch_media_bug_t *b } switch_mutex_unlock(bug->read_mutex); - switch_mutex_lock(bug->write_mutex); - datalen = (uint32_t) switch_buffer_read(bug->raw_write_buffer, bug->data, bytes); - if (datalen < bytes) { - memset(((unsigned char *)bug->data) + datalen, 0, bytes - datalen); - datalen = bytes; + if (switch_test_flag(bug, SMBF_WRITE_STREAM)) { + switch_mutex_lock(bug->write_mutex); + datalen = (uint32_t) switch_buffer_read(bug->raw_write_buffer, bug->data, bytes); + if (datalen < bytes) { + memset(((unsigned char *)bug->data) + datalen, 0, bytes - datalen); + datalen = bytes; + } + switch_mutex_unlock(bug->write_mutex); } - switch_mutex_unlock(bug->write_mutex); tp = bug->tmp; dp = (int16_t *) bug->data;