forked from Mirrors/freeswitch
fix mem err
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@7163 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
parent
174aed86ee
commit
f589bee1e6
@ -130,7 +130,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_file_read(switch_file_handle_t *fh,
|
|||||||
switch_assert(fh->file_interface != NULL);
|
switch_assert(fh->file_interface != NULL);
|
||||||
|
|
||||||
if (fh->buffer && switch_buffer_inuse(fh->buffer)) {
|
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;
|
return SWITCH_STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -161,14 +161,14 @@ SWITCH_DECLARE(switch_status_t) switch_core_file_read(switch_file_handle_t *fh,
|
|||||||
switch_assert(fh->buffer);
|
switch_assert(fh->buffer);
|
||||||
}
|
}
|
||||||
if (!fh->dbuf) {
|
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);
|
fh->dbuf = switch_core_alloc(fh->memory_pool, fh->dbuflen);
|
||||||
}
|
}
|
||||||
switch_assert(fh->resampler->to_len <= 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_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);
|
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 {
|
} else {
|
||||||
switch_float_to_short(fh->resampler->to, data, fh->resampler->to_len);
|
switch_float_to_short(fh->resampler->to, data, fh->resampler->to_len);
|
||||||
*len = fh->resampler->to_len;
|
*len = fh->resampler->to_len;
|
||||||
|
Loading…
Reference in New Issue
Block a user