[Freeswitch-svn] [commit] r11162 - in freeswitch/trunk: src/mod/formats/mod_local_stream support-d
FreeSWITCH SVN
brian at freeswitch.org
Tue Jan 13 13:43:55 PST 2009
Author: brian
Date: Tue Jan 13 15:43:55 2009
New Revision: 11162
Log:
buffer regressions
Modified:
freeswitch/trunk/src/mod/formats/mod_local_stream/mod_local_stream.c
freeswitch/trunk/support-d/.emacs
Modified: freeswitch/trunk/src/mod/formats/mod_local_stream/mod_local_stream.c
==============================================================================
--- freeswitch/trunk/src/mod/formats/mod_local_stream/mod_local_stream.c (original)
+++ freeswitch/trunk/src/mod/formats/mod_local_stream/mod_local_stream.c Tue Jan 13 15:43:55 2009
@@ -183,7 +183,7 @@
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 @@
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);
- break;
+ 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);
}
- 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 (!used && !is_open) {
+ break;
+ }
+
+ 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 @@
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;
Modified: freeswitch/trunk/support-d/.emacs
==============================================================================
--- freeswitch/trunk/support-d/.emacs (original)
+++ freeswitch/trunk/support-d/.emacs Tue Jan 13 15:43:55 2009
@@ -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)
More information about the Freeswitch-svn
mailing list