[FFmpeg-devel] [PATCH 3/3] avfilter/audio: Don't call av_get_channel_layout_nb_channels twice

Andreas Rheinhardt andreas.rheinhardt at outlook.com
Tue Aug 17 07:49:06 EEST 2021


Also makes the assert-string shorter.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at outlook.com>
---
 libavfilter/audio.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/libavfilter/audio.c b/libavfilter/audio.c
index 5289b94067..cebc9709dd 100644
--- a/libavfilter/audio.c
+++ b/libavfilter/audio.c
@@ -40,8 +40,9 @@ AVFrame *ff_default_get_audio_buffer(AVFilterLink *link, int nb_samples)
 {
     AVFrame *frame = NULL;
     int channels = link->channels;
+    int channel_layout_nb_channels = av_get_channel_layout_nb_channels(link->channel_layout);
 
-    av_assert0(channels == av_get_channel_layout_nb_channels(link->channel_layout) || !av_get_channel_layout_nb_channels(link->channel_layout));
+    av_assert0(channels == channel_layout_nb_channels || !channel_layout_nb_channels);
 
     if (!link->frame_pool) {
         link->frame_pool = ff_frame_pool_audio_init(av_buffer_allocz, channels,
-- 
2.30.2



More information about the ffmpeg-devel mailing list