[Spice-devel] [spice v16 04/23] streaming: Remove the width/height encode_frame() parameters

Pavel Grunt pgrunt at redhat.com
Wed Jun 8 15:30:29 UTC 2016


Hi,

why not squash it to the previous patch ?

Pavel

On Tue, 2016-06-07 at 15:58 +0200, Francois Gouget wrote:
> 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 at codeweavers.com>
> ---
>  server/dcc-send.c      | 14 ++++++--------
>  server/mjpeg-encoder.c |  1 -
>  server/video-encoder.h |  2 +-
>  3 files changed, 7 insertions(+), 10 deletions(-)
> 
> diff --git a/server/dcc-send.c b/server/dcc-send.c
> index 798a9b3..5ec20e9 100644
> --- a/server/dcc-send.c
> +++ b/server/dcc-send.c
> @@ -1660,7 +1660,7 @@ static int red_marshall_stream_data(RedChannelClient
> *rcc,
>      SpiceCopy *copy;
>      uint32_t frame_mm_time;
>      uint32_t n;
> -    int is_sized, width, height;
> +    int is_sized;
>      int ret;
>  
>      spice_assert(drawable->red_drawable->type == QXL_DRAW_COPY);
> @@ -1670,9 +1670,8 @@ static int red_marshall_stream_data(RedChannelClient
> *rcc,
>          return FALSE;
>      }
>  
> -    width = copy->src_area.right - copy->src_area.left;
> -    height = copy->src_area.bottom - copy->src_area.top;
> -    is_sized = (width != stream->width) || (height != stream->height) ||
> +    is_sized = (copy->src_area.right - copy->src_area.left != stream->width)
> ||
> +               (copy->src_area.bottom - copy->src_area.top != stream->height) 
> ||
>                 !rect_is_equal(&drawable->red_drawable->bbox, &stream-
> >dest_area);
>  
>      if (is_sized &&
> @@ -1702,8 +1701,7 @@ static int red_marshall_stream_data(RedChannelClient
> *rcc,
>      ret = agent->video_encoder->encode_frame(agent->video_encoder,
>                                               frame_mm_time,
>                                               &copy->src_bitmap->u.bitmap,
> -                                             width, height, &copy->src_area,
> -                                             stream->top_down,
> +                                             &copy->src_area, stream-
> >top_down,
>                                               &dcc->send_data.stream_outbuf,
>                                               &outbuf_size, &n);
>      switch (ret) {
> @@ -1741,8 +1739,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 = copy->src_area.right - copy->src_area.left;
> +        stream_data.height = copy->src_area.bottom - copy->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);


More information about the Spice-devel mailing list