From ba1f4221e90b80da57dcfa24548f97e5a75b57c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20=C3=85dahl?= Date: Tue, 12 May 2020 08:52:01 +0200 Subject: [PATCH] screen-cast-stream-src: Don't throttle if max framerate is 1/0 The max framerate 1/0 means variable without any particular max, so don't throttle if that was set. Not doing this would end up with a floating point exception. https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1251 (cherry picked from commit 96dd794fd18ac2650d6186de5c62da7051f0ce92) --- src/backends/meta-screen-cast-stream-src.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/backends/meta-screen-cast-stream-src.c b/src/backends/meta-screen-cast-stream-src.c index 4f3d821ef..ad0d9ed79 100644 --- a/src/backends/meta-screen-cast-stream-src.c +++ b/src/backends/meta-screen-cast-stream-src.c @@ -445,7 +445,8 @@ meta_screen_cast_stream_src_maybe_record_frame (MetaScreenCastStreamSrc *src) uint64_t now_us; now_us = g_get_monotonic_time (); - if (priv->last_frame_timestamp_us != 0 && + if (priv->video_format.max_framerate.num > 0 && + priv->last_frame_timestamp_us != 0 && (now_us - priv->last_frame_timestamp_us < ((1000000 * priv->video_format.max_framerate.denom) / priv->video_format.max_framerate.num)))