[Spice-devel] [PATCH spice-gtk 2/3] channel-display-gst: Reduce contention on queues_mutex

Frediano Ziglio fziglio at redhat.com
Mon Apr 16 10:43:25 UTC 2018


We don't need to lock the entire queues to create a frame.

Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
---
 src/channel-display-gst.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/channel-display-gst.c b/src/channel-display-gst.c
index 201842e..f5fa642 100644
--- a/src/channel-display-gst.c
+++ b/src/channel-display-gst.c
@@ -564,8 +564,9 @@ static gboolean spice_gst_decoder_queue_frame(VideoDecoder *video_decoder,
     GST_BUFFER_DTS(buffer) = GST_CLOCK_TIME_NONE;
     GST_BUFFER_PTS(buffer) = gst_clock_get_time(decoder->clock) - gst_element_get_base_time(decoder->pipeline) + ((uint64_t)MAX(0, latency)) * 1000 * 1000;
 
+    SpiceGstFrame *gst_frame = create_gst_frame(buffer, frame);
     g_mutex_lock(&decoder->queues_mutex);
-    g_queue_push_tail(decoder->decoding_queue, create_gst_frame(buffer, frame));
+    g_queue_push_tail(decoder->decoding_queue, gst_frame);
     g_mutex_unlock(&decoder->queues_mutex);
 
     if (gst_app_src_push_buffer(decoder->appsrc, buffer) != GST_FLOW_OK) {
-- 
2.14.3



More information about the Spice-devel mailing list