[Freeswitch-svn] [commit] r7163 - freeswitch/trunk/src
Freeswitch SVN
anthm at freeswitch.org
Wed Jan 9 22:12:32 EST 2008
Author: anthm
Date: Wed Jan 9 22:12:32 2008
New Revision: 7163
Modified:
freeswitch/trunk/src/switch_core_file.c
Log:
fix mem err
Modified: freeswitch/trunk/src/switch_core_file.c
==============================================================================
--- freeswitch/trunk/src/switch_core_file.c (original)
+++ freeswitch/trunk/src/switch_core_file.c Wed Jan 9 22:12:32 2008
@@ -130,7 +130,7 @@
switch_assert(fh->file_interface != NULL);
if (fh->buffer && switch_buffer_inuse(fh->buffer)) {
- *len = switch_buffer_read(fh->buffer, data, orig_len);
+ *len = switch_buffer_read(fh->buffer, data, orig_len * 2) / 2;
return SWITCH_STATUS_SUCCESS;
}
@@ -154,21 +154,21 @@
fh->resampler->from_len = switch_short_to_float(data, fh->resampler->from, (int) *len);
fh->resampler->to_len =
switch_resample_process(fh->resampler, fh->resampler->from, fh->resampler->from_len, fh->resampler->to, fh->resampler->to_size, 0);
-
+
if (fh->resampler->to_len > orig_len) {
if (!fh->buffer) {
switch_buffer_create_dynamic(&fh->buffer, fh->resampler->to_len * 2, fh->resampler->to_len * 4, fh->resampler->to_len * 8);
switch_assert(fh->buffer);
}
if (!fh->dbuf) {
- fh->dbuflen = fh->resampler->to_len * 2;
+ fh->dbuflen = fh->resampler->to_len * 8;
fh->dbuf = switch_core_alloc(fh->memory_pool, fh->dbuflen);
}
switch_assert(fh->resampler->to_len <= fh->dbuflen);
switch_float_to_short(fh->resampler->to, (int16_t *) fh->dbuf, fh->resampler->to_len);
switch_buffer_write(fh->buffer, fh->dbuf, fh->resampler->to_len * 2);
- *len = switch_buffer_read(fh->buffer, data, orig_len);
+ *len = switch_buffer_read(fh->buffer, data, orig_len * 2) / 2;
} else {
switch_float_to_short(fh->resampler->to, data, fh->resampler->to_len);
*len = fh->resampler->to_len;
More information about the Freeswitch-svn
mailing list