diff mbox series

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

Message ID AM7PR03MB666061A27038C06CCD50A8668FFE9@AM7PR03MB6660.eurprd03.prod.outlook.com
State Accepted
Commit f60c3ca1361921ff7929a4dc14ed874f22f37f98
Headers show
Series [FFmpeg-devel,1/3] avfilter/avfilter: Remove redundant assignment | expand

Checks

Context Check Description
andriy/x86_make success Make finished
andriy/x86_make_fate success Make fate finished
andriy/PPC64_make success Make finished
andriy/PPC64_make_fate success Make fate finished

Commit Message

Andreas Rheinhardt Aug. 17, 2021, 4:49 a.m. UTC
Also makes the assert-string shorter.

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

Patch

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,