forked from Mirrors/freeswitch
buffer regressions
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@11162 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
parent
ade0e51eae
commit
a5367cd386
|
@ -183,7 +183,7 @@ static void *SWITCH_THREAD_FUNC read_stream_thread(switch_thread_t *thread, void
|
|||
|
||||
fname = path_buf;
|
||||
fh.prebuf = source->prebuf;
|
||||
fh.pre_buffer_datalen = 65536;
|
||||
fh.pre_buffer_datalen = source->prebuf;
|
||||
|
||||
if (switch_core_file_open(&fh,
|
||||
(char *) fname,
|
||||
|
@ -206,16 +206,23 @@ static void *SWITCH_THREAD_FUNC read_stream_thread(switch_thread_t *thread, void
|
|||
while (RUNNING) {
|
||||
switch_core_timer_next(&timer);
|
||||
olen = source->samples;
|
||||
int is_open = switch_test_flag((&fh), SWITCH_FILE_OPEN);
|
||||
|
||||
if (switch_core_file_read(&fh, abuf, &olen) != SWITCH_STATUS_SUCCESS || !olen) {
|
||||
switch_core_file_close(&fh);
|
||||
if (is_open) {
|
||||
if (switch_core_file_read(&fh, abuf, &olen) != SWITCH_STATUS_SUCCESS || !olen) {
|
||||
switch_core_file_close(&fh);
|
||||
}
|
||||
|
||||
switch_buffer_write(audio_buffer, abuf, olen * 2);
|
||||
}
|
||||
|
||||
used = switch_buffer_inuse(audio_buffer);
|
||||
|
||||
if (!used && !is_open) {
|
||||
break;
|
||||
}
|
||||
|
||||
switch_buffer_write(audio_buffer, abuf, olen * 2);
|
||||
used = switch_buffer_inuse(audio_buffer);
|
||||
|
||||
if (used >= source->prebuf || (source->total && used > source->samples * 2)) {
|
||||
if (!is_open || used >= source->prebuf || (source->total && used > source->samples * 2)) {
|
||||
used = switch_buffer_read(audio_buffer, dist_buf, source->samples * 2);
|
||||
if (source->total) {
|
||||
|
||||
|
@ -285,6 +292,9 @@ static switch_status_t local_stream_file_open(switch_file_handle_t *handle, cons
|
|||
char *alt_path = NULL;
|
||||
switch_status_t status = SWITCH_STATUS_SUCCESS;
|
||||
|
||||
/* already buffering a step back, so always disable it */
|
||||
handle->pre_buffer_datalen = 0;
|
||||
|
||||
if (switch_test_flag(handle, SWITCH_FILE_FLAG_WRITE)) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "This format does not support writing!\n");
|
||||
return SWITCH_STATUS_FALSE;
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
;(setq cperl-hairy t)
|
||||
(global-unset-key "\C-h")
|
||||
(global-set-key "\C-h" 'delete-backward-char)
|
||||
(load "/usr/share/emacs/site-lisp/rng-auto.el")
|
||||
;(load "/usr/share/emacs/site-lisp/rng-auto.el")
|
||||
|
||||
(require 'cc-mode)
|
||||
(defun my-build-tab-stop-list (width)
|
||||
|
|
Loading…
Reference in New Issue