[Spice-devel] [PATCH spice-server 1/6] video-stream: Initialise VideoStreamClipItem directly
Frediano Ziglio
fziglio at redhat.com
Fri Dec 8 15:55:19 UTC 2017
Instead of just allocating in video_stream_clip_item_new and
than have to setup properly in dcc_video_stream_agent_clip
do all in video_stream_clip_item_new which is more consistent
with other part of the code.
Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
---
server/dcc.c | 8 --------
server/video-stream.c | 8 ++++++++
2 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/server/dcc.c b/server/dcc.c
index fb5009e9..d457989b 100644
--- a/server/dcc.c
+++ b/server/dcc.c
@@ -630,14 +630,6 @@ static void dcc_stop(DisplayChannelClient *dcc)
void dcc_video_stream_agent_clip(DisplayChannelClient* dcc, VideoStreamAgent *agent)
{
VideoStreamClipItem *item = video_stream_clip_item_new(agent);
- int n_rects;
-
- item->clip_type = SPICE_CLIP_TYPE_RECTS;
-
- n_rects = pixman_region32_n_rects(&agent->clip);
- item->rects = g_malloc(sizeof(SpiceClipRects) + n_rects * sizeof(SpiceRect));
- item->rects->num_rects = n_rects;
- region_ret_rects(&agent->clip, item->rects->rects, n_rects);
red_channel_client_pipe_add(RED_CHANNEL_CLIENT(dcc), &item->base);
}
diff --git a/server/video-stream.c b/server/video-stream.c
index b45c318b..4830705f 100644
--- a/server/video-stream.c
+++ b/server/video-stream.c
@@ -184,6 +184,14 @@ VideoStreamClipItem *video_stream_clip_item_new(VideoStreamAgent *agent)
item->stream_agent = agent;
agent->stream->refs++;
+
+ item->clip_type = SPICE_CLIP_TYPE_RECTS;
+
+ int n_rects = pixman_region32_n_rects(&agent->clip);
+ item->rects = g_malloc(sizeof(SpiceClipRects) + n_rects * sizeof(SpiceRect));
+ item->rects->num_rects = n_rects;
+ region_ret_rects(&agent->clip, item->rects->rects, n_rects);
+
return item;
}
--
2.14.3
More information about the Spice-devel
mailing list