[Spice-devel] [PATCH spice-gtk 1/3] fixup! Gstreamer: Use GstVideoOverlay if possible

Frediano Ziglio fziglio at redhat.com
Sun Apr 15 19:12:16 UTC 2018


As we don't need frame anymore instead of attaching to the buffer free
it.
---
 src/channel-display-gst.c | 19 +++----------------
 1 file changed, 3 insertions(+), 16 deletions(-)

diff --git a/src/channel-display-gst.c b/src/channel-display-gst.c
index a29af3f..7783393 100644
--- a/src/channel-display-gst.c
+++ b/src/channel-display-gst.c
@@ -91,12 +91,6 @@ static SpiceGstFrame *create_gst_frame(GstBuffer *buffer, SpiceFrame *frame)
     return gstframe;
 }
 
-static void free_spice_frame(SpiceFrame *frame)
-{
-    frame->unref_data(frame->data_opaque);
-    frame->free(frame);
-}
-
 static void free_gst_frame(SpiceGstFrame *gstframe)
 {
     gstframe->frame->free(gstframe->frame);
@@ -562,8 +556,6 @@ static gboolean spice_gst_decoder_queue_frame(VideoDecoder *video_decoder,
                                               SpiceFrame *frame, int latency)
 {
     SpiceGstDecoder *decoder = (SpiceGstDecoder*)video_decoder;
-    gpointer data_opaque;
-    GDestroyNotify data_unref;
 
     if (frame->size == 0) {
         SPICE_DEBUG("got an empty frame buffer!");
@@ -605,16 +597,9 @@ static gboolean spice_gst_decoder_queue_frame(VideoDecoder *video_decoder,
 
     /* ref() the frame data for the buffer */
     frame->ref_data(frame->data_opaque);
-    if (decoder->gstvideooverlay) {
-        data_opaque = frame;
-        data_unref  = (void*)free_spice_frame;
-    } else {
-        data_opaque = frame->data_opaque;
-        data_unref  = frame->unref_data;
-    }
     GstBuffer *buffer = gst_buffer_new_wrapped_full(GST_MEMORY_FLAG_PHYSICALLY_CONTIGUOUS,
                                                     frame->data, frame->size, 0, frame->size,
-                                                    data_opaque, data_unref);
+                                                    frame->data_opaque, frame->unref_data);
 
     GST_BUFFER_DURATION(buffer) = GST_CLOCK_TIME_NONE;
     GST_BUFFER_DTS(buffer) = GST_CLOCK_TIME_NONE;
@@ -624,6 +609,8 @@ static gboolean spice_gst_decoder_queue_frame(VideoDecoder *video_decoder,
         g_mutex_lock(&decoder->queues_mutex);
         g_queue_push_tail(decoder->decoding_queue, create_gst_frame(buffer, frame));
         g_mutex_unlock(&decoder->queues_mutex);
+    } else {
+        frame->free(frame);
     }
 
     if (gst_app_src_push_buffer(decoder->appsrc, buffer) != GST_FLOW_OK) {
-- 
2.14.3



More information about the Spice-devel mailing list