From: Anthony Minessale Date: Mon, 7 Nov 2016 18:16:01 +0000 (-0600) Subject: FS-9705 #resolve [Files using prebuffer do not play properly when seeking back to... X-Git-Tag: v1.8.0~1123 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9e103b2b1c021798aec6736ae487bd03428af9c0;p=thirdparty%2Ffreeswitch.git FS-9705 #resolve [Files using prebuffer do not play properly when seeking back to the beginning once the file is done playing] --- diff --git a/src/switch_core_file.c b/src/switch_core_file.c index 49ff70b7d1..db8590f2a3 100644 --- a/src/switch_core_file.c +++ b/src/switch_core_file.c @@ -392,7 +392,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_file_read(switch_file_handle_t *fh, return SWITCH_STATUS_FALSE; } - if (fh->buffer && switch_buffer_inuse(fh->buffer) >= *len * 2 * fh->channels) { + if (*len && fh->buffer && switch_buffer_inuse(fh->buffer) >= *len * 2 * fh->channels) { *len = switch_buffer_read(fh->buffer, data, orig_len * 2 * fh->channels) / 2 / fh->channels; return *len == 0 ? SWITCH_STATUS_FALSE : SWITCH_STATUS_SUCCESS; } @@ -407,7 +407,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_file_read(switch_file_handle_t *fh, more: - if (fh->pre_buffer) { + if (fh->pre_buffer && switch_buffer_inuse(fh->pre_buffer)) { switch_size_t rlen; int asis = switch_test_flag(fh, SWITCH_FILE_NATIVE);