From 76b65d643b5eab4ad89aaa8016e5862d8f8f9123 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Thu, 9 May 2024 10:01:22 +0300 Subject: [PATCH] level: Don't post a message on EOS without a valid audio info If EOS is received before caps, e.g. because of an error, then rate and number of channels would be 0 and some divisions by zero would happen. Part-of: --- subprojects/gst-plugins-good/gst/level/gstlevel.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/subprojects/gst-plugins-good/gst/level/gstlevel.c b/subprojects/gst-plugins-good/gst/level/gstlevel.c index 968fd4fe72..cc8e6203ab 100644 --- a/subprojects/gst-plugins-good/gst/level/gstlevel.c +++ b/subprojects/gst-plugins-good/gst/level/gstlevel.c @@ -747,6 +747,9 @@ gst_level_post_message (GstLevel * filter) gint channels, rate, frames = filter->num_frames; GstClockTime duration; + if (!GST_AUDIO_INFO_IS_VALID (&filter->info)) + return; + channels = GST_AUDIO_INFO_CHANNELS (&filter->info); rate = GST_AUDIO_INFO_RATE (&filter->info); duration = GST_FRAMES_TO_CLOCK_TIME (frames, rate);