[spice v15 02/21] streaming: Remove the width/height encode_frame() parameters

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



encode_frame() needs the QXL_DRAW_COPY operation's SpiceCopy.src_area
field anyway, so the width and height parameters were redundant.

Signed-off-by: Francois Gouget <fgouget@xxxxxxxxxxxxxxx>
---
 server/dcc-send.c      | 26 ++++++++------------------
 server/mjpeg-encoder.c |  1 -
 server/video-encoder.h |  2 +-
 3 files changed, 9 insertions(+), 20 deletions(-)

diff --git a/server/dcc-send.c b/server/dcc-send.c
index 5171f9a..9ece37e 100644
--- a/server/dcc-send.c
+++ b/server/dcc-send.c
@@ -1660,7 +1660,6 @@ static int red_marshall_stream_data(RedChannelClient *rcc,
     SpiceImage *image;
     uint32_t frame_mm_time;
     uint32_t n;
-    int width, height;
     int ret;
 
     if (!stream) {
@@ -1675,21 +1674,13 @@ static int red_marshall_stream_data(RedChannelClient *rcc,
         return FALSE;
     }
 
-    if (drawable->sized_stream) {
-        if (red_channel_client_test_remote_cap(rcc, SPICE_DISPLAY_CAP_SIZED_STREAM)) {
-            SpiceRect *src_rect = &drawable->red_drawable->u.copy.src_area;
-
-            width = src_rect->right - src_rect->left;
-            height = src_rect->bottom - src_rect->top;
-        } else {
-            return FALSE;
-        }
-    } else {
-        width = stream->width;
-        height = stream->height;
+    if (drawable->sized_stream &&
+        !red_channel_client_test_remote_cap(rcc, SPICE_DISPLAY_CAP_SIZED_STREAM)) {
+        return FALSE;
     }
 
     StreamAgent *agent = &dcc->stream_agents[get_stream_id(display, stream)];
+    const SpiceRect *src_area = &drawable->red_drawable->u.copy.src_area;
     uint64_t time_now = spice_get_monotonic_time_ns();
     size_t outbuf_size;
 
@@ -1710,9 +1701,8 @@ static int red_marshall_stream_data(RedChannelClient *rcc,
     outbuf_size = dcc->send_data.stream_outbuf_size;
     ret = agent->video_encoder->encode_frame(agent->video_encoder,
                                              frame_mm_time,
-                                             &image->u.bitmap, width, height,
-                                             &drawable->red_drawable->u.copy.src_area,
-                                             stream->top_down,
+                                             &image->u.bitmap,
+                                             src_area, stream->top_down,
                                              &dcc->send_data.stream_outbuf,
                                              &outbuf_size, &n);
     switch (ret) {
@@ -1750,8 +1740,8 @@ static int red_marshall_stream_data(RedChannelClient *rcc,
         stream_data.base.id = get_stream_id(display, stream);
         stream_data.base.multi_media_time = frame_mm_time;
         stream_data.data_size = n;
-        stream_data.width = width;
-        stream_data.height = height;
+        stream_data.width = src_area->right - src_area->left;
+        stream_data.height = src_area->bottom - src_area->top;
         stream_data.dest = drawable->red_drawable->bbox;
 
         spice_debug("stream %d: sized frame: dest ==> ", stream_data.base.id);
diff --git a/server/mjpeg-encoder.c b/server/mjpeg-encoder.c
index 7dcea50..57708cd 100644
--- a/server/mjpeg-encoder.c
+++ b/server/mjpeg-encoder.c
@@ -927,7 +927,6 @@ static int encode_frame(MJpegEncoder *encoder, const SpiceRect *src,
 static int mjpeg_encoder_encode_frame(VideoEncoder *video_encoder,
                                       uint32_t frame_mm_time,
                                       const SpiceBitmap *bitmap,
-                                      int width, int height,
                                       const SpiceRect *src, int top_down,
                                       uint8_t **outbuf, size_t *outbuf_size,
                                       uint32_t *data_size)
diff --git a/server/video-encoder.h b/server/video-encoder.h
index 8aa7783..7e06a13 100644
--- a/server/video-encoder.h
+++ b/server/video-encoder.h
@@ -60,7 +60,7 @@ struct VideoEncoder {
      *                              only happen if rate control is active.
      */
     int (*encode_frame)(VideoEncoder *encoder, uint32_t frame_mm_time,
-                        const SpiceBitmap *bitmap, int width, int height,
+                        const SpiceBitmap *bitmap,
                         const SpiceRect *src, int top_down,
                         uint8_t **outbuf, size_t *outbuf_size,
                         uint32_t *data_size);
-- 
2.8.1

_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/spice-devel




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]