From d07c1ad85a60395eb20501a59ff35de1d60f029b Mon Sep 17 00:00:00 2001 From: Andreas Rheinhardt Date: Tue, 11 Mar 2025 17:26:43 +0100 Subject: [PATCH 1/7] avcodec/pcm: Remove always-false check All codecs here have a valid sample size at this point. This check has (presumably) been added for DVD PCM, but even for them the check was always-true after 381e195b46d080aee1d9b05ef2b6b140e9463519 (and the DVD code was later moved out altogether). So just remove this check and the leftover DVD comment. Signed-off-by: Andreas Rheinhardt --- libavcodec/pcm.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/libavcodec/pcm.c b/libavcodec/pcm.c index a23293dca2..5d8dcb8ff0 100644 --- a/libavcodec/pcm.c +++ b/libavcodec/pcm.c @@ -334,7 +334,6 @@ static int pcm_decode_frame(AVCodecContext *avctx, AVFrame *frame, sample_size = av_get_bits_per_sample(avctx->codec_id) / 8; - /* av_get_bits_per_sample returns 0 for AV_CODEC_ID_PCM_DVD */ samples_per_block = 1; if (avctx->codec_id == AV_CODEC_ID_PCM_LXF) { /* we process 40-bit blocks per channel for LXF */ @@ -342,11 +341,6 @@ static int pcm_decode_frame(AVCodecContext *avctx, AVFrame *frame, sample_size = 5; } - if (sample_size == 0) { - av_log(avctx, AV_LOG_ERROR, "Invalid sample_size\n"); - return AVERROR(EINVAL); - } - if (channels == 0) { av_log(avctx, AV_LOG_ERROR, "Invalid number of channels\n"); return AVERROR(EINVAL); -- 2.45.2