From 06c241a233988c967fa6090832a28219af9dfa57 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Thu, 11 Dec 2014 20:57:55 -0600 Subject: [PATCH] FS-6891 FS-7002 FS-7059 FS-7072 FS-7073 FS-7076 #close #comment All of these bugs are invalidated due to a botched revert -- commit 72c3df5ed39b724590b5266fb31eea090f56dba7 was supposed to revert commit 1b612fecb6e8db11da9b15c5522b87e7b642423d but it only reverted part of it. commit 158c1f23da9263e0c6aacf6a22e0a504c8909e37 from the other day was erroneously created to work around the result of the botched revert so it is reverted. The result of this commit should be to bring it back to effectively properly revert 1b612fecb6e8db11da9b15c5522b87e7b642423d and now you can test and open new bugs if necessary. This includes the segfault in eavesdrop, and any media bug releated reports. Consider working together and only reporting one new bug if you still encounter any more problems and be sure to include details and make sure the jitter buffer is being used. --- src/include/private/switch_core_pvt.h | 3 -- src/switch_core_io.c | 54 +-------------------------- src/switch_ivr_async.c | 3 +- 3 files changed, 3 insertions(+), 57 deletions(-) diff --git a/src/include/private/switch_core_pvt.h b/src/include/private/switch_core_pvt.h index e64541b309..d7933b4880 100644 --- a/src/include/private/switch_core_pvt.h +++ b/src/include/private/switch_core_pvt.h @@ -179,9 +179,6 @@ struct switch_core_session { switch_media_handle_t *media_handle; uint32_t decoder_errors; - switch_time_t last_read_time; - switch_time_t last_write_time; - }; struct switch_media_bug { diff --git a/src/switch_core_io.c b/src/switch_core_io.c index 8a1dd97120..cb056adb73 100644 --- a/src/switch_core_io.c +++ b/src/switch_core_io.c @@ -762,26 +762,11 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_read_frame(switch_core_sessi switch_media_bug_t *bp; switch_bool_t ok = SWITCH_TRUE; int prune = 0; - switch_time_t now = switch_micro_time_now(); - switch_time_t diff = 0; - switch_size_t len = session->read_impl.decoded_bytes_per_packet; - unsigned char fill_data[SWITCH_RECOMMENDED_BUFFER_SIZE] = {0}; - switch_thread_rwlock_rdlock(session->bug_rwlock); - if (session->last_read_time && session->last_read_time < now) { - diff = ((now - session->last_read_time) + 3000 ) / session->read_impl.microseconds_per_packet; - - if (diff > 1) { - memset(fill_data, 255, len); - } - } - - session->last_read_time = switch_micro_time_now(); - for (bp = session->bugs; bp; bp = bp->next) { ok = SWITCH_TRUE; - + if (switch_channel_test_flag(session->channel, CF_PAUSE_BUGS) && !switch_core_media_bug_test_flag(bp, SMBF_NO_PAUSE)) { continue; } @@ -801,17 +786,6 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_read_frame(switch_core_sessi if (ok && bp->ready && switch_test_flag(bp, SMBF_READ_STREAM)) { switch_mutex_lock(bp->read_mutex); - - if (diff > 1) { - switch_time_t tdiff = diff; - - while(tdiff > 1) { - switch_buffer_write(bp->raw_read_buffer, fill_data, len); - tdiff--; - } - - } - if (bp->read_demux_frame) { uint8_t data[SWITCH_RECOMMENDED_BUFFER_SIZE]; int bytes = read_frame->datalen / 2; @@ -1371,23 +1345,8 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_write_frame(switch_core_sess if (session->bugs) { switch_media_bug_t *bp; int prune = 0; - switch_time_t now = switch_micro_time_now(); - switch_time_t diff = 0; - switch_size_t len = session->read_impl.decoded_bytes_per_packet; - unsigned char fill_data[SWITCH_RECOMMENDED_BUFFER_SIZE] = {0}; - + switch_thread_rwlock_rdlock(session->bug_rwlock); - - if (session->last_write_time && session->last_write_time < now) { - diff = ((now - session->last_write_time) + 3000 ) / session->read_impl.microseconds_per_packet; - - if (diff > 1) { - memset(fill_data, 255, len); - } - } - - session->last_write_time = switch_micro_time_now(); - for (bp = session->bugs; bp; bp = bp->next) { switch_bool_t ok = SWITCH_TRUE; @@ -1410,15 +1369,6 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_write_frame(switch_core_sess if (switch_test_flag(bp, SMBF_WRITE_STREAM)) { switch_mutex_lock(bp->write_mutex); - if (diff > 1) { - switch_time_t tdiff = diff; - - while(tdiff > 1) { - switch_buffer_write(bp->raw_read_buffer, fill_data, len); - tdiff--; - } - } - switch_buffer_write(bp->raw_write_buffer, write_frame->data, write_frame->datalen); switch_mutex_unlock(bp->write_mutex); diff --git a/src/switch_ivr_async.c b/src/switch_ivr_async.c index 3d3509b091..25ec4d7285 100644 --- a/src/switch_ivr_async.c +++ b/src/switch_ivr_async.c @@ -1313,13 +1313,12 @@ 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, x++ == 0); + status = switch_core_media_bug_read(bug, &frame, SWITCH_FALSE); if (status == SWITCH_STATUS_SUCCESS || status == SWITCH_STATUS_BREAK) {