# HG changeset patch # User jbr # Date 1251420294 0 # Node ID 4186efb8693372b502249ef49c071cd6d6bc3616 # Parent 68f824761c1bd7e4df8c6d56b97c31fa40a26594 Modify the Ogg/Speex demuxer and the libspeex decoder so that they always treat a packet of Speex frames as a single frame. diff -r 68f824761c1b -r 4186efb86933 libspeexdec.c --- a/libspeexdec.c Thu Aug 27 17:46:13 2009 +0000 +++ b/libspeexdec.c Fri Aug 28 00:44:54 2009 +0000 @@ -53,6 +53,8 @@ avctx->sample_rate = s->header->rate; avctx->channels = s->header->nb_channels; avctx->frame_size = s->header->frame_size; + if (s->header->frames_per_packet) + avctx->frame_size *= s->header->frames_per_packet; mode = speex_lib_get_mode(s->header->mode); if (!mode) { @@ -98,7 +100,7 @@ int16_t *output = data, *end; int i, num_samples; - num_samples = avctx->frame_size * avctx->channels; + num_samples = s->header->frame_size * avctx->channels; end = output + *data_size/2; speex_bits_read_from(&s->bits, buf, buf_size); @@ -113,12 +115,13 @@ break; if (avctx->channels == 2) - speex_decode_stereo_int(output, avctx->frame_size, &s->stereo); + speex_decode_stereo_int(output, s->header->frame_size, &s->stereo); output += num_samples; } - *data_size = i * avctx->channels * avctx->frame_size * 2; + avctx->frame_size = s->header->frame_size * i; + *data_size = avctx->channels * avctx->frame_size * sizeof(*output); return buf_size; }