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

Carl Eugen Hoyos cehoyos at ag.or.at
Fri Jul 12 21:59:26 CEST 2013


On Friday 12 July 2013 09:08:52 pm Paul B Mahol wrote:
> On 7/12/13, Carl Eugen Hoyos <cehoyos at ag.or.at> wrote:
> > 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
>
> G726 != mono <- this is true, that are different words with different
> meanings in most universes.

New patch attached.

Carl Eugen
-------------- next part --------------
diff --git a/libavcodec/g726.c b/libavcodec/g726.c
index 7884f36..d035b3e 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, "Decoding more than one channel");
+        return AVERROR_PATCHWELCOME;
+    }
     avctx->channels       = 1;
     avctx->channel_layout = AV_CH_LAYOUT_MONO;
 


More information about the ffmpeg-devel mailing list