[Freeswitch-svn] [commit] r11155 - freeswitch/trunk/src

FreeSWITCH SVN brian at freeswitch.org
Mon Jan 12 19:56:41 PST 2009


Author: brian
Date: Mon Jan 12 21:56:40 2009
New Revision: 11155

Log:
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.




Modified:
   freeswitch/trunk/src/switch_core_file.c

Modified: freeswitch/trunk/src/switch_core_file.c
==============================================================================
--- freeswitch/trunk/src/switch_core_file.c	(original)
+++ freeswitch/trunk/src/switch_core_file.c	Mon Jan 12 21:56:40 2009
@@ -204,13 +204,13 @@
 			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);



More information about the Freeswitch-svn mailing list