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 };
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) {
}
}
- bug->record_frame_size = frame_size;
+ bug->record_frame_size = bytes = frame_size;
}
#endif
}
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;
}
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) {