[FFmpeg-devel] [PATCH]Do not try to decode g726 stereo streams

Carl Eugen Hoyos cehoyos at ag.or.at
Fri Jul 12 18:24:50 CEST 2013


Hi!

Our g726 decoder only supports mono, if the demuxer set stereo, decoding will 
not succeed.

Please comment, Carl Eugen
-------------- next part --------------
diff --git a/libavcodec/g726.c b/libavcodec/g726.c
index 7884f36..cf8b3e7 100644
--- a/libavcodec/g726.c
+++ b/libavcodec/g726.c
@@ -401,6 +401,10 @@ static av_cold int g726_decode_init(AVCodecContext *avctx)
 {
     G726Context* c = avctx->priv_data;
 
+    if(avctx->channels > 1){
+        av_log(avctx, AV_LOG_ERROR, "Only mono is supported\n");
+        return AVERROR(EINVAL);
+    }
     avctx->channels       = 1;
     avctx->channel_layout = AV_CH_LAYOUT_MONO;
 


More information about the ffmpeg-devel mailing list