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: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6829>
This commit is contained in:
Sebastian Dröge 2024-05-09 10:01:22 +03:00 committed by GStreamer Marge Bot
parent b7d4ccd7f2
commit 76b65d643b

View file

@ -747,6 +747,9 @@ gst_level_post_message (GstLevel * filter)
gint channels, rate, frames = filter->num_frames; gint channels, rate, frames = filter->num_frames;
GstClockTime duration; GstClockTime duration;
if (!GST_AUDIO_INFO_IS_VALID (&filter->info))
return;
channels = GST_AUDIO_INFO_CHANNELS (&filter->info); channels = GST_AUDIO_INFO_CHANNELS (&filter->info);
rate = GST_AUDIO_INFO_RATE (&filter->info); rate = GST_AUDIO_INFO_RATE (&filter->info);
duration = GST_FRAMES_TO_CLOCK_TIME (frames, rate); duration = GST_FRAMES_TO_CLOCK_TIME (frames, rate);