ffmpeg | branch: master | Andreas Rheinhardt <andreas.rheinha...@outlook.com> | 
Thu Apr 10 19:46:04 2025 +0200| [13a0d0ade16824bb1e1d55fdf1792ae51e7b1b2d] | 
committer: Andreas Rheinhardt

avcodec/mpegaudioenc_template: Remove always-false branch

The sample rates here have already been checked generically
via CODEC_SAMPLERATES().

Signed-off-by: Andreas Rheinhardt <andreas.rheinha...@outlook.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=13a0d0ade16824bb1e1d55fdf1792ae51e7b1b2d
---

 libavcodec/mpegaudioenc_template.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/libavcodec/mpegaudioenc_template.c 
b/libavcodec/mpegaudioenc_template.c
index 396e8a4899..12f5c7b9cd 100644
--- a/libavcodec/mpegaudioenc_template.c
+++ b/libavcodec/mpegaudioenc_template.c
@@ -24,6 +24,7 @@
  * The simplest mpeg audio layer 2 encoder.
  */
 
+#include "libavutil/avassert.h"
 #include "libavutil/channel_layout.h"
 
 #include "avcodec.h"
@@ -89,7 +90,8 @@ static av_cold int MPA_encode_init(AVCodecContext *avctx)
 
     /* encoding freq */
     s->lsf = 0;
-    for(i=0;i<3;i++) {
+    for (i = 0;; i++) {
+        av_assert1(i < 3);
         if (ff_mpa_freq_tab[i] == freq)
             break;
         if ((ff_mpa_freq_tab[i] / 2) == freq) {
@@ -97,10 +99,6 @@ static av_cold int MPA_encode_init(AVCodecContext *avctx)
             break;
         }
     }
-    if (i == 3){
-        av_log(avctx, AV_LOG_ERROR, "Sampling rate %d is not allowed in 
mp2\n", freq);
-        return AVERROR(EINVAL);
-    }
     s->freq_index = i;
 
     /* encoding bitrate & frequency */

_______________________________________________
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".

Reply via email to