If you were to be in a 32k or 48k conference and play an 8k or 16k file into either one you would over run this buffer.

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@11155 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Brian West 2009-01-13 03:56:40 +00:00
parent f5ece7dc15
commit ad60ae2a1a
1 changed files with 2 additions and 2 deletions

View File

@ -204,13 +204,13 @@ SWITCH_DECLARE(switch_status_t) switch_core_file_read(switch_file_handle_t *fh,
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 < want || fh->resampler->to_len > orig_len) {
int factor = fh->resampler->to_len * fh->samplerate / 1000;
if (!fh->buffer) {
int factor = fh->resampler->to_len * fh->samplerate / 1000;
switch_buffer_create_dynamic(&fh->buffer, factor, factor, 0);
switch_assert(fh->buffer);
}
if (!fh->dbuf) {
fh->dbuflen = want * 2;
fh->dbuflen = want * factor;
fh->dbuf = switch_core_alloc(fh->memory_pool, fh->dbuflen);
}
switch_assert(fh->resampler->to_len <= fh->dbuflen);