From 96c43005388c20b974c5e1c4d1aaa5085fb14975 Mon Sep 17 00:00:00 2001
From: Stepan Salenikovich <stepan.salenikovich@savoirfairelinux.com>
Date: Mon, 20 Apr 2015 15:16:13 -0400
Subject: [PATCH] gnome: fix video on slower machines

By lowering the priority of the g_timeout which draws new frames.

(cherry picked from commit 8934e84d7d29ce1c1c9c43adccc74b494bc91154)

Refs #71359
Change-Id: I6510a1946be995fdc5b57bfd228efa92f46f84bc
---
 src/video/video_widget.cpp | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/src/video/video_widget.cpp b/src/video/video_widget.cpp
index 7fd71250..0416d654 100644
--- a/src/video/video_widget.cpp
+++ b/src/video/video_widget.cpp
@@ -216,8 +216,16 @@ video_widget_init(VideoWidget *self)
     clutter_actor_set_opacity(priv->local->actor,
                               VIDEO_LOCAL_OPACITY_DEFAULT);
 
-    /* init frame queues and the timeout sources to check them */
-    priv->frame_timeout_source = g_timeout_add(FRAME_RATE_PERIOD, (GSourceFunc)check_frame_queue, self);
+    /* Init the timeout source which will check the for new frames.
+     * The priority must be lower than GTK drawing events
+     * (G_PRIORITY_HIGH_IDLE + 20) so that this timeout source doesn't choke
+     * the main loop on slower machines.
+     */
+    priv->frame_timeout_source = g_timeout_add_full(G_PRIORITY_DEFAULT_IDLE,
+                                                    FRAME_RATE_PERIOD,
+                                                    (GSourceFunc)check_frame_queue,
+                                                    self,
+                                                    NULL);
 
     /* handle button event */
     g_signal_connect(GTK_WIDGET(self), "button-press-event", G_CALLBACK(on_button_press_in_screen_event), NULL);
-- 
GitLab