Message ID | GV1P250MB0737ACD0EEE5C6FEC153473D8F4A9@GV1P250MB0737.EURP250.PROD.OUTLOOK.COM |
---|---|
State | Accepted |
Commit | 65dbc83eec2656786b901ed15569d7044c6c6dee |
Headers | show |
Series | [FFmpeg-devel,01/17] avcodec/avcodec: Uninitialize AVChannelLayout before overwriting it | expand |
Context | Check | Description |
---|---|---|
yinshiyou/make_loongarch64 | success | Make finished |
yinshiyou/make_fate_loongarch64 | success | Make fate finished |
andriy/make_x86 | success | Make finished |
andriy/make_fate_x86 | success | Make fate finished |
On 9/18/22, Andreas Rheinhardt <andreas.rheinhardt@outlook.com> wrote: > ff_encode_preinit() has already checked that the channel layout > is equivalent to one of the layouts in AVCodec.ch_layouts. > > Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com> > --- > libavcodec/mlpenc.c | 11 +++++------ > 1 file changed, 5 insertions(+), 6 deletions(-) > lgtm > diff --git a/libavcodec/mlpenc.c b/libavcodec/mlpenc.c > index d2e28888f7..878c5aedc1 100644 > --- a/libavcodec/mlpenc.c > +++ b/libavcodec/mlpenc.c > @@ -27,6 +27,7 @@ > #include "encode.h" > #include "put_bits.h" > #include "audio_frame_queue.h" > +#include "libavutil/avassert.h" > #include "libavutil/channel_layout.h" > #include "libavutil/crc.h" > #include "libavutil/avstring.h" > @@ -602,12 +603,11 @@ static av_cold int mlp_encode_init(AVCodecContext > *avctx) > }; > int i; > > - for (i = 0; i < FF_ARRAY_ELEMS(layout_arrangement); i++) > + for (i = 0;; i++) { > + av_assert1(i < FF_ARRAY_ELEMS(layout_arrangement) || > + !"Impossible channel layout"); > if (channels_present == layout_arrangement[i]) > break; > - if (i == FF_ARRAY_ELEMS(layout_arrangement)) { > - av_log(avctx, AV_LOG_ERROR, "Unsupported channel > arrangement\n"); > - return AVERROR(EINVAL); > } > ctx->channel_arrangement = i; > ctx->flags = FLAGS_DVDA; > @@ -640,8 +640,7 @@ static av_cold int mlp_encode_init(AVCodecContext > *avctx) > ctx->channel_arrangement = 15; > ctx->thd_substream_info = 0x104; > } else { > - av_log(avctx, AV_LOG_ERROR, "Unsupported channel > arrangement\n"); > - return AVERROR(EINVAL); > + av_assert1(!"AVCodec.ch_layouts needs to be updated"); > } > ctx->flags = 0; > ctx->channel_occupancy = 0; > -- > 2.34.1 > > _______________________________________________ > 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". >
diff --git a/libavcodec/mlpenc.c b/libavcodec/mlpenc.c index d2e28888f7..878c5aedc1 100644 --- a/libavcodec/mlpenc.c +++ b/libavcodec/mlpenc.c @@ -27,6 +27,7 @@ #include "encode.h" #include "put_bits.h" #include "audio_frame_queue.h" +#include "libavutil/avassert.h" #include "libavutil/channel_layout.h" #include "libavutil/crc.h" #include "libavutil/avstring.h" @@ -602,12 +603,11 @@ static av_cold int mlp_encode_init(AVCodecContext *avctx) }; int i; - for (i = 0; i < FF_ARRAY_ELEMS(layout_arrangement); i++) + for (i = 0;; i++) { + av_assert1(i < FF_ARRAY_ELEMS(layout_arrangement) || + !"Impossible channel layout"); if (channels_present == layout_arrangement[i]) break; - if (i == FF_ARRAY_ELEMS(layout_arrangement)) { - av_log(avctx, AV_LOG_ERROR, "Unsupported channel arrangement\n"); - return AVERROR(EINVAL); } ctx->channel_arrangement = i; ctx->flags = FLAGS_DVDA; @@ -640,8 +640,7 @@ static av_cold int mlp_encode_init(AVCodecContext *avctx) ctx->channel_arrangement = 15; ctx->thd_substream_info = 0x104; } else { - av_log(avctx, AV_LOG_ERROR, "Unsupported channel arrangement\n"); - return AVERROR(EINVAL); + av_assert1(!"AVCodec.ch_layouts needs to be updated"); } ctx->flags = 0; ctx->channel_occupancy = 0;
ff_encode_preinit() has already checked that the channel layout is equivalent to one of the layouts in AVCodec.ch_layouts. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com> --- libavcodec/mlpenc.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-)