[asterisk-commits] dvossel: trunk r314415 - /trunk/codecs/codec_resample.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Apr 20 11:37:17 CDT 2011


Author: dvossel
Date: Wed Apr 20 11:37:15 2011
New Revision: 314415

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=314415
Log:
Fixes error with frame datalen being calculated from samples when this is not allwaya accurate.

Modified:
    trunk/codecs/codec_resample.c

Modified: trunk/codecs/codec_resample.c
URL: http://svnview.digium.com/svn/asterisk/trunk/codecs/codec_resample.c?view=diff&rev=314415&r1=314414&r2=314415
==============================================================================
--- trunk/codecs/codec_resample.c (original)
+++ trunk/codecs/codec_resample.c Wed Apr 20 11:37:15 2011
@@ -71,7 +71,12 @@
 {
 	SpeexResamplerState *resamp_pvt = pvt->pvt;
 	unsigned int out_samples = (OUTBUF_SIZE / sizeof(int16_t)) - pvt->samples;
-	unsigned int in_samples = f->samples;
+	unsigned int in_samples;
+
+	if (!f->datalen) {
+		return -1;
+	}
+	in_samples = f->datalen / 2;
 
 	speex_resampler_process_int(resamp_pvt,
 		0,




More information about the asterisk-commits mailing list