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
This commit is contained in:
Jonas Ådahl 2020-05-12 08:52:01 +02:00 committed by Georges Basile Stavracas Neto
parent 73a436362a
commit 96dd794fd1

View File

@ -445,7 +445,8 @@ meta_screen_cast_stream_src_maybe_record_frame (MetaScreenCastStreamSrc *src)
uint64_t now_us; uint64_t now_us;
now_us = g_get_monotonic_time (); 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 < (now_us - priv->last_frame_timestamp_us <
((1000000 * priv->video_format.max_framerate.denom) / ((1000000 * priv->video_format.max_framerate.denom) /
priv->video_format.max_framerate.num))) priv->video_format.max_framerate.num)))