[FFmpeg-cvslog] libspeexdec: properly handle DTX for multiple frames-per-packet
Justin Ruggles
git at videolan.org
Thu Oct 4 13:18:03 CEST 2012
ffmpeg | branch: master | Justin Ruggles <justin.ruggles at gmail.com> | Sun Sep 30 23:11:43 2012 -0400| [45e5d0c3ac0d144cf4dc7fb3d852ee05814bbd2b] | committer: Justin Ruggles
libspeexdec: properly handle DTX for multiple frames-per-packet
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=45e5d0c3ac0d144cf4dc7fb3d852ee05814bbd2b
---
libavcodec/libspeexdec.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/libavcodec/libspeexdec.c b/libavcodec/libspeexdec.c
index 1916fea..760bfe2 100644
--- a/libavcodec/libspeexdec.c
+++ b/libavcodec/libspeexdec.c
@@ -119,10 +119,12 @@ static int libspeex_decode_frame(AVCodecContext *avctx, void *data,
}
output = (int16_t *)s->frame.data[0];
- /* if there is not enough data left for the smallest possible frame,
- reset the libspeex buffer using the current packet, otherwise ignore
- the current packet and keep decoding frames from the libspeex buffer. */
- if (speex_bits_remaining(&s->bits) < 43) {
+ /* if there is not enough data left for the smallest possible frame or the
+ next 5 bits are a terminator code, reset the libspeex buffer using the
+ current packet, otherwise ignore the current packet and keep decoding
+ frames from the libspeex buffer. */
+ if (speex_bits_remaining(&s->bits) < 5 ||
+ speex_bits_peek_unsigned(&s->bits, 5) == 0x1F) {
/* check for flush packet */
if (!buf || !buf_size) {
*got_frame_ptr = 0;
More information about the ffmpeg-cvslog
mailing list