Commit 5fb8bfe275 for ffmpeg
commit 5fb8bfe275fb47c88e54b041476677d64bfe3ab7
Author: romainhedouin <romain.hedouin@epitech.eu>
Date: Thu Oct 15 13:02:31 2026 +0200
avcodec/opus/enc: get the sample size once in spawn_empty_frame
It was looked up again for every channel. No change in output.
Found during a code review sweep of ffmpeg using an LLM.
diff --git a/libavcodec/opus/enc.c b/libavcodec/opus/enc.c
index c451a5b552..a82929069c 100644
--- a/libavcodec/opus/enc.c
+++ b/libavcodec/opus/enc.c
@@ -547,8 +547,8 @@ static AVFrame *spawn_empty_frame(OpusEncContext *s)
av_frame_free(&f);
return NULL;
}
+ size_t bps = av_get_bytes_per_sample(f->format);
for (int i = 0; i < s->channels; i++) {
- size_t bps = av_get_bytes_per_sample(f->format);
memset(f->extended_data[i], 0, bps*f->nb_samples);
}
return f;