diff --git a/src/mod/formats/mod_local_stream/mod_local_stream.c b/src/mod/formats/mod_local_stream/mod_local_stream.c index a5c82cbb64..49ca2bafa7 100644 --- a/src/mod/formats/mod_local_stream/mod_local_stream.c +++ b/src/mod/formats/mod_local_stream/mod_local_stream.c @@ -32,7 +32,7 @@ */ #include /* for apr_pstrcat */ -#define DEFAULT_PREBUFFER_SIZE 1024 * 32 +#define DEFAULT_PREBUFFER_SIZE 1024 * 64 SWITCH_MODULE_LOAD_FUNCTION(mod_local_stream_load); SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_local_stream_shutdown); diff --git a/src/switch_core_file.c b/src/switch_core_file.c index e810297a21..bf6bf51667 100644 --- a/src/switch_core_file.c +++ b/src/switch_core_file.c @@ -158,8 +158,9 @@ SWITCH_DECLARE(switch_status_t) switch_core_file_read(switch_file_handle_t *fh, int asis = switch_test_flag(fh, SWITCH_FILE_NATIVE); if (!switch_test_flag(fh, SWITCH_FILE_BUFFER_DONE)) { - if (!switch_buffer_inuse(fh->pre_buffer)) { - rlen = asis ? fh->pre_buffer_datalen : fh->pre_buffer_datalen / 2; + rlen = asis ? fh->pre_buffer_datalen : fh->pre_buffer_datalen / 2; + + if (switch_buffer_inuse(fh->pre_buffer) < rlen * 2) { if ((status = fh->file_interface->file_read(fh, fh->pre_buffer_data, &rlen)) != SWITCH_STATUS_SUCCESS || !rlen) { switch_set_flag(fh, SWITCH_FILE_BUFFER_DONE); } else {