Message ID | CAB0OVGoaBK77oR-ZvVarQKhHxRi3i8QWNCAi96S=2pn+G18+YQ@mail.gmail.com |
---|---|
State | Superseded |
Headers | show |
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@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@ffmpeg.org > https://ffmpeg.org/mailman/listinfo/ffmpeg-devel > > To unsubscribe, visit link above, or email > ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe". >
Am Mo., 1. Juli 2019 um 00:12 Uhr schrieb James Almer <jamrial@gmail.com>: > > 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@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. Unfortunately, the crash cannot be fixed in init_muxer() - at least not where the sample_rate check is. I am not saying my suggestion is the only solution, but it is what I successfully tested. Carl Eugen
From 976b294c10be32667852729c3652dbec466ac091 Mon Sep 17 00:00:00 2001 From: Carl Eugen Hoyos <ceffmpeg@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"); + return AVERROR(EINVAL); + } return 0; } -- 2.22.0