[Spice-commits] src/channel-display-gst.c

Christophe Fergau teuf at kemper.freedesktop.org
Thu Jan 19 14:29:22 UTC 2017

 src/channel-display-gst.c |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

New commits:
commit 0517c9d6c4da58d5e8b76cef7fada58141859443
Author: Francois Gouget <fgouget at codeweavers.com>
Date:   Fri Dec 23 16:07:49 2016 +0100

    streaming: Fix a race condition in the GStreamer frame display queue
    When a frame is late we schedule its display right away with
    g_timeout_add(0, ...).  This scheduling is done in one of the GStreamer
    thread, and the display_frame() callback will be called from the main
    thread. This can result in display_frame() being called before
    g_timeout_add() returns. This would cause the timer_id being reset
    before schedule_frame() had set it so that it would then never be reset.
    So from that point schedule_frame() would always think a frame was being
    displayed and thus would not schedule any more frames resulting in a
    video freeze.
    display_frame() now takes the queues mutex before resetting timer_id
    eliminating the race.
    Signed-off-by: Francois Gouget <fgouget at codeweavers.com>
    Acked-by: Christophe Fergeau <cfergeau at redhat.com>

diff --git a/src/channel-display-gst.c b/src/channel-display-gst.c
index 9786342..5f4d321 100644
--- a/src/channel-display-gst.c
+++ b/src/channel-display-gst.c
@@ -127,9 +127,8 @@ static gboolean display_frame(gpointer video_decoder)
     GstBuffer *buffer;
     GstMapInfo mapinfo;
-    decoder->timer_id = 0;
+    decoder->timer_id = 0;
     frame = g_queue_pop_head(decoder->display_queue);
     /* If the queue is empty we don't even need to reschedule */

More information about the Spice-commits mailing list