]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/truespeech.c
mpegvideo_parser: fix buffer access beyond end
[ffmpeg] / libavcodec / truespeech.c
index 6a1e439adf802bee2cff8f13ccc8a4c3e8a448d0..e8a88cfb744ee1d93d4d4b7fd6c3352153b35e44 100644 (file)
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
+#include "libavutil/channel_layout.h"
 #include "libavutil/intreadwrite.h"
 #include "avcodec.h"
 #include "dsputil.h"
 #include "get_bits.h"
+#include "internal.h"
 
 #include "truespeech_data.h"
 /**
@@ -66,7 +68,8 @@ static av_cold int truespeech_decode_init(AVCodecContext * avctx)
         return AVERROR(EINVAL);
     }
 
-    avctx->sample_fmt = AV_SAMPLE_FMT_S16;
+    avctx->channel_layout = AV_CH_LAYOUT_MONO;
+    avctx->sample_fmt     = AV_SAMPLE_FMT_S16;
 
     ff_dsputil_init(&c->dsp, avctx);
 
@@ -325,7 +328,7 @@ static int truespeech_decode_frame(AVCodecContext *avctx, void *data,
 
     /* get output buffer */
     c->frame.nb_samples = iterations * 240;
-    if ((ret = avctx->get_buffer(avctx, &c->frame)) < 0) {
+    if ((ret = ff_get_buffer(avctx, &c->frame)) < 0) {
         av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
         return ret;
     }