From 158c1f23da9263e0c6aacf6a22e0a504c8909e37 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Fri, 5 Dec 2014 19:18:28 -0600 Subject: [PATCH] FS-7002 #resolve #comment please verify --- src/switch_core_media_bug.c | 9 ++++----- src/switch_ivr_async.c | 3 ++- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/switch_core_media_bug.c b/src/switch_core_media_bug.c index 6e9d746ac0..08f2ee30d7 100644 --- a/src/switch_core_media_bug.c +++ b/src/switch_core_media_bug.c @@ -227,9 +227,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_bug_read(switch_media_bug_t *b if (bug->record_frame_size && bug->record_pre_buffer_max && (do_read || do_write) && bug->record_pre_buffer_count < bug->record_pre_buffer_max) { bug->record_pre_buffer_count++; return SWITCH_STATUS_FALSE; - } - - if (!bug->record_frame_size) { + } else { uint32_t frame_size; switch_codec_implementation_t read_impl = { 0 }; //switch_codec_implementation_t other_read_impl = { 0 }; @@ -238,6 +236,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_bug_read(switch_media_bug_t *b switch_core_session_get_read_impl(bug->session, &read_impl); frame_size = read_impl.decoded_bytes_per_packet; bug->record_frame_size = frame_size; + #if 0 if (do_read && do_write) { if (switch_core_session_get_partner(bug->session, &other_session) == SWITCH_STATUS_SUCCESS) { @@ -255,7 +254,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_bug_read(switch_media_bug_t *b } } - bug->record_frame_size = frame_size; + bug->record_frame_size = bytes = frame_size; } #endif } @@ -278,7 +277,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_bug_read(switch_media_bug_t *b fill_read = !do_read; fill_write = !do_write; - if (fill_read && fill_write) { + if ((fill_read && fill_write) || (!fill && fill_read)) { return SWITCH_STATUS_FALSE; } diff --git a/src/switch_ivr_async.c b/src/switch_ivr_async.c index 25ec4d7285..3d3509b091 100644 --- a/src/switch_ivr_async.c +++ b/src/switch_ivr_async.c @@ -1313,12 +1313,13 @@ static switch_bool_t record_callback(switch_media_bug_t *bug, void *user_data, s uint8_t data[SWITCH_RECOMMENDED_BUFFER_SIZE]; switch_frame_t frame = { 0 }; switch_status_t status; + int x = 0; frame.data = data; frame.buflen = SWITCH_RECOMMENDED_BUFFER_SIZE; for (;;) { - status = switch_core_media_bug_read(bug, &frame, SWITCH_FALSE); + status = switch_core_media_bug_read(bug, &frame, x++ == 0); if (status == SWITCH_STATUS_SUCCESS || status == SWITCH_STATUS_BREAK) {