From f5ece7dc15dd7231883ad8db411f9f221191e8b6 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Mon, 12 Jan 2009 23:14:55 +0000 Subject: [PATCH] fix another buffering regression git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@11152 d0543943-73ff-0310-b7d9-9358b9ac24b2 --- src/mod/formats/mod_local_stream/mod_local_stream.c | 2 +- src/switch_core_file.c | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) 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 {