Fixes error with frame datalen being calculated from samples when this is not allwaya...
authorDavid Vossel <dvossel@digium.com>
Wed, 20 Apr 2011 16:37:15 +0000 (16:37 +0000)
committerDavid Vossel <dvossel@digium.com>
Wed, 20 Apr 2011 16:37:15 +0000 (16:37 +0000)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@314415 65c4cc65-6c06-0410-ace0-fbb531ad65f3

codecs/codec_resample.c

index ab5f57e..66ef584 100644 (file)
@@ -71,7 +71,12 @@ static int resamp_framein(struct ast_trans_pvt *pvt, struct ast_frame *f)
 {
        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,