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

Carl Eugen Hoyos cehoyos at ag.or.at
Fri Jul 12 20:31:06 CEST 2013


On Friday 12 July 2013 06:53:31 pm Paul B Mahol wrote:

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

> >> EINVAL is wrong error code.
> >
> > Is attached patch better?
>
> There is way to set which layouts - thus also number of channels -
> encoder supports.

Unrelated changes removed.

Please comment, Carl Eugen
-------------- next part --------------
diff --git a/libavcodec/g726.c b/libavcodec/g726.c
index 7884f36..152eecb 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){
+        avpriv_request_sample(avctx, "G.726 != mono");
+        return AVERROR_PATCHWELCOME;
+    }
     avctx->channels       = 1;
     avctx->channel_layout = AV_CH_LAYOUT_MONO;
 


More information about the ffmpeg-devel mailing list