Separate the channel code from the channel client code and move the latter into a new function. Signed-off-by: Jonathon Jongsma <jjongsma@xxxxxxxxxx> --- server/dcc.c | 23 +++++++++++++++++++++++ server/dcc.h | 1 + server/stream.c | 20 +------------------- 3 files changed, 25 insertions(+), 19 deletions(-) diff --git a/server/dcc.c b/server/dcc.c index 13166645c..226665ee2 100644 --- a/server/dcc.c +++ b/server/dcc.c @@ -1786,3 +1786,26 @@ void dcc_stream_stop(DisplayChannelClient *dcc, int stream_id) red_channel_client_pipe_add(RED_CHANNEL_CLIENT(dcc), stream_destroy_item_new(stream_agent)); stream_agent_stats_print(stream_agent); } + +void dcc_attach_stream(DisplayChannelClient *dcc, Drawable *drawable, int stream_id) +{ + StreamAgent *agent; + QRegion clip_in_draw_dest; + + agent = dcc_get_stream_agent(dcc, stream_id); + region_or(&agent->vis_region, &drawable->tree_item.base.rgn); + + region_init(&clip_in_draw_dest); + region_add(&clip_in_draw_dest, &drawable->red_drawable->bbox); + region_and(&clip_in_draw_dest, &agent->clip); + + if (!region_is_equal(&clip_in_draw_dest, &drawable->tree_item.base.rgn)) { + region_remove(&agent->clip, &drawable->red_drawable->bbox); + region_or(&agent->clip, &drawable->tree_item.base.rgn); + dcc_stream_agent_clip(dcc, agent); + } + region_destroy(&clip_in_draw_dest); +#ifdef STREAM_STATS + agent->stats.num_input_frames++; +#endif +} diff --git a/server/dcc.h b/server/dcc.h index 5fb61a605..8e1da936e 100644 --- a/server/dcc.h +++ b/server/dcc.h @@ -204,6 +204,7 @@ gboolean dcc_is_low_bandwidth(DisplayChannelClient *dcc); GArray *dcc_get_preferred_video_codecs_for_encoding(DisplayChannelClient *dcc); void dcc_update_streams_max_latency(DisplayChannelClient *dcc, StreamAgent *remove_agent); void dcc_stream_stop(DisplayChannelClient *dcc, int stream_id); +void dcc_attach_stream(DisplayChannelClient *dcc, Drawable *drawable, int stream_id); typedef struct RedStreamClipItem { RedPipeItem base; diff --git a/server/stream.c b/server/stream.c index c3cdd6707..0e5da6468 100644 --- a/server/stream.c +++ b/server/stream.c @@ -199,25 +199,7 @@ static void attach_stream(DisplayChannel *display, Drawable *drawable, Stream *s } FOREACH_DCC(display, dcc) { - StreamAgent *agent; - QRegion clip_in_draw_dest; - - agent = dcc_get_stream_agent(dcc, display_channel_get_stream_id(display, stream)); - region_or(&agent->vis_region, &drawable->tree_item.base.rgn); - - region_init(&clip_in_draw_dest); - region_add(&clip_in_draw_dest, &drawable->red_drawable->bbox); - region_and(&clip_in_draw_dest, &agent->clip); - - if (!region_is_equal(&clip_in_draw_dest, &drawable->tree_item.base.rgn)) { - region_remove(&agent->clip, &drawable->red_drawable->bbox); - region_or(&agent->clip, &drawable->tree_item.base.rgn); - dcc_stream_agent_clip(dcc, agent); - } - region_destroy(&clip_in_draw_dest); -#ifdef STREAM_STATS - agent->stats.num_input_frames++; -#endif + dcc_attach_stream(dcc, drawable, display_channel_get_stream_id(display, stream)); } } -- 2.13.6 _______________________________________________ Spice-devel mailing list Spice-devel@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/spice-devel