[FFmpeg-devel] [PATCH]lavf/rawenc: Do not allow encoding 0 audio channels

James Almer jamrial at gmail.com
Mon Jul 1 01:11:49 EEST 2019


On 6/30/2019 7:01 PM, Carl Eugen Hoyos wrote:
> Hi!
> 
> Attached patch fixes ticket #7979 for me, please comment.
> 
> Thank you, Carl Eugen
> 
> 
> 0001-lavf-rawenc-Do-not-allow-encoding-0-audio-channels.patch
> 
> From 976b294c10be32667852729c3652dbec466ac091 Mon Sep 17 00:00:00 2001
> From: Carl Eugen Hoyos <ceffmpeg at gmail.com>
> Date: Mon, 1 Jul 2019 00:00:38 +0200
> Subject: [PATCH] lavf/rawenc: Do not allow encoding 0 audio channels.
> 
> Fixes ticket #7979.
> ---
>  libavformat/rawenc.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/libavformat/rawenc.c b/libavformat/rawenc.c
> index 993d232b70..0d00e5a0c5 100644
> --- a/libavformat/rawenc.c
> +++ b/libavformat/rawenc.c
> @@ -39,6 +39,10 @@ static int force_one_stream(AVFormatContext *s)
>                 s->oformat->name);
>          return AVERROR(EINVAL);
>      }
> +    if (s->streams[0]->codecpar->channels == 0) {
> +        av_log(s, AV_LOG_ERROR, "Encoding 0 channels is impossible\n");

This looks like something that should be checked in init_muxer() from
mux.c instead, same way it's checking sample_rate <= 0 for audio, and
dimensions for video. That way it will apply to all muxers.

> +        return AVERROR(EINVAL);
> +    }
>      return 0;
>  }
>  
> -- 2.22.0
> 
> 
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request at ffmpeg.org with subject "unsubscribe".
> 



More information about the ffmpeg-devel mailing list