[Spice-devel] [PATCH 2/7] gstreamer: Reduce #ifdef

Frediano Ziglio fziglio at redhat.com
Thu Aug 11 08:50:51 UTC 2016


Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
---
 server/gstreamer-encoder.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/server/gstreamer-encoder.c b/server/gstreamer-encoder.c
index c8d7d88..cdd9696 100644
--- a/server/gstreamer-encoder.c
+++ b/server/gstreamer-encoder.c
@@ -1240,6 +1240,14 @@ static void clear_zero_copy_queue(SpiceGstEncoder *encoder, gboolean unref_queue
 {
     /* Nothing to do */
 }
+
+static inline int zero_copy(SpiceGstEncoder *encoder,
+                            const SpiceBitmap *bitmap, gpointer bitmap_opaque,
+                            GstBuffer *buffer, uint32_t *chunk_index,
+                            uint32_t *chunk_offset, uint32_t *len)
+{
+    return TRUE;
+}
 #endif
 
 /* A helper for push_raw_frame() */
@@ -1353,19 +1361,17 @@ static int push_raw_frame(SpiceGstEncoder *encoder,
     } else {
         /* We can copy the bitmap chunk by chunk */
         uint32_t chunk_index = 0;
-#ifdef DO_ZERO_COPY
         if (!zero_copy(encoder, bitmap, bitmap_opaque, buffer, &chunk_index,
                        &chunk_offset, &len)) {
             gst_buffer_unref(buffer);
             return VIDEO_ENCODER_FRAME_UNSUPPORTED;
         }
+
         /* len now contains the remaining number of bytes to copy.
          * However we must avoid any write to the GstBuffer object as it
          * would cause a copy of the read-only memory objects we just added.
          * Fortunately we can append extra writable memory objects instead.
          */
-#endif
-
         if (len) {
             uint8_t *dst = allocate_and_map_memory(len, &map, buffer);
             if (!dst) {
-- 
2.7.4



More information about the Spice-devel mailing list