diff options
author | Frediano Ziglio <fziglio@redhat.com> | 2017-12-07 11:30:09 +0000 |
---|---|---|
committer | Frediano Ziglio <freddy77@gmail.com> | 2023-11-22 07:39:17 +0000 |
commit | 31265e16a130559890b22f04c609b01394795b87 (patch) | |
tree | 58b14fdf108077eb7d5e8564089174de817845f6 | |
parent | c1062cd81d1d3abadfcb525ad3da0e5aca472348 (diff) |
WIP bad attempt to split marshalling code
idea was to move some access from dcc-send to video-stream
(width, height, dest_area and top_down of VideoStream)
-rw-r--r-- | server/dcc-send.cpp | 41 |
1 files changed, 29 insertions, 12 deletions
diff --git a/server/dcc-send.cpp b/server/dcc-send.cpp index 2c40a231..f0d8e01a 100644 --- a/server/dcc-send.cpp +++ b/server/dcc-send.cpp @@ -1637,16 +1637,16 @@ static void red_release_video_encoder_buffer(uint8_t *data, void *opaque) buffer->free(buffer); } +static bool marshall_stream_data(VideoStreamAgent *agent, int stream_id, + DisplayChannelClient *rcc, + RedDrawable *red_drawable); + static bool red_marshall_stream_data(DisplayChannelClient *dcc, SpiceMarshaller *base_marshaller, Drawable *drawable) { - DisplayChannel *display = DCC_TO_DC(dcc); - VideoStream *stream = drawable->stream; + VideoStream *const stream = drawable->stream; SpiceCopy *copy; - uint32_t frame_mm_time; - int is_sized; - VideoEncodeResults ret; spice_assert(drawable->red_drawable->type == QXL_DRAW_COPY); @@ -1655,28 +1655,45 @@ static bool red_marshall_stream_data(DisplayChannelClient *dcc, return FALSE; } + int stream_id = display_channel_get_video_stream_id(DCC_TO_DC(dcc), stream); + VideoStreamAgent *agent = &dcc->priv->stream_agents[stream_id]; + + return marshall_stream_data(agent, stream_id, dcc, drawable->red_drawable.get()); +} + +static bool marshall_stream_data(VideoStreamAgent *agent, int stream_id, + DisplayChannelClient *dcc, + RedDrawable *red_drawable) +{ + VideoEncodeResults ret; + int is_sized; + uint32_t frame_mm_time; + SpiceCopy *copy; + VideoStream *const stream = agent->stream; + SpiceMarshaller *base_marshaller = dcc->get_marshaller(); + + copy = &red_drawable->u.copy; + 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); + !rect_is_equal(&red_drawable->bbox, &stream->dest_area); if (is_sized && !dcc->test_remote_cap(SPICE_DISPLAY_CAP_SIZED_STREAM)) { return FALSE; } - int stream_id = display_channel_get_video_stream_id(display, stream); - VideoStreamAgent *agent = &dcc->priv->stream_agents[stream_id]; VideoBuffer *outbuf; /* workaround for vga streams */ - frame_mm_time = drawable->red_drawable->mm_time ? - drawable->red_drawable->mm_time : + frame_mm_time = red_drawable->mm_time ? + red_drawable->mm_time : reds_get_mm_time(); ret = !agent->video_encoder ? VIDEO_ENCODER_FRAME_UNSUPPORTED : agent->video_encoder->encode_frame(agent->video_encoder, frame_mm_time, ©->src_bitmap->u.bitmap, ©->src_area, stream->top_down, - drawable->red_drawable.get(), + red_drawable, &outbuf); switch (ret) { case VIDEO_ENCODER_FRAME_DROP: @@ -1713,7 +1730,7 @@ static bool red_marshall_stream_data(DisplayChannelClient *dcc, stream_data.data_size = outbuf->size; 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; + stream_data.dest = red_drawable->bbox; spice_debug("stream %d: sized frame: dest ==> ", stream_data.base.id); rect_debug(&stream_data.dest); |