Do not compute stream_id more that necessary

Reuse already computed value and avoid to compute in every
iterations.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Victor Toso <victortoso@redhat.com>
This commit is contained in:
Frediano Ziglio 2017-12-07 12:24:43 +00:00
parent fb85723433
commit e030f87cf0
2 changed files with 3 additions and 3 deletions

View File

@ -1743,7 +1743,7 @@ static bool red_marshall_stream_data(RedChannelClient *rcc,
red_channel_client_init_send_data(rcc, SPICE_MSG_DISPLAY_STREAM_DATA);
stream_data.base.id = display_channel_get_video_stream_id(display, stream);
stream_data.base.id = stream_id;
stream_data.base.multi_media_time = frame_mm_time;
stream_data.data_size = outbuf->size;
@ -1753,7 +1753,7 @@ static bool red_marshall_stream_data(RedChannelClient *rcc,
red_channel_client_init_send_data(rcc, SPICE_MSG_DISPLAY_STREAM_DATA_SIZED);
stream_data.base.id = display_channel_get_video_stream_id(display, stream);
stream_data.base.id = stream_id;
stream_data.base.multi_media_time = frame_mm_time;
stream_data.data_size = outbuf->size;
stream_data.width = copy->src_area.right - copy->src_area.left;

View File

@ -298,10 +298,10 @@ static void attach_stream(DisplayChannel *display, Drawable *drawable, VideoStre
stream->num_input_frames++;
}
int stream_id = display_channel_get_video_stream_id(display, stream);
FOREACH_DCC(display, dcc) {
VideoStreamAgent *agent;
QRegion clip_in_draw_dest;
int stream_id = display_channel_get_video_stream_id(display, stream);
agent = dcc_get_video_stream_agent(dcc, stream_id);
region_or(&agent->vis_region, &drawable->tree_item.base.rgn);