diff options
author | Marc-André Lureau <marcandre.lureau@gmail.com> | 2015-11-10 13:21:28 +0000 |
---|---|---|
committer | Frediano Ziglio <fziglio@redhat.com> | 2015-11-10 17:38:39 +0000 |
commit | 4987df8e67f48cde13d39f4e81909f672ae33e29 (patch) | |
tree | ffda6150b4c35240361b1d8d4688f1adee27543e /server/display-channel.c | |
parent | 5a216d2eb101729615f799a88bc49fc95850262a (diff) | |
download | spice-4987df8e67f48cde13d39f4e81909f672ae33e29.tar.gz spice-4987df8e67f48cde13d39f4e81909f672ae33e29.tar.xz spice-4987df8e67f48cde13d39f4e81909f672ae33e29.zip |
worker: move stream to display channel
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
Diffstat (limited to 'server/display-channel.c')
-rw-r--r-- | server/display-channel.c | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/server/display-channel.c b/server/display-channel.c index 6aefe090..8775496b 100644 --- a/server/display-channel.c +++ b/server/display-channel.c @@ -225,3 +225,47 @@ void dcc_push_monitors_config(DisplayChannelClient *dcc) red_monitors_config_item_add(dcc); red_channel_client_push(&dcc->common.base); } + +int display_channel_get_streams_timeout(DisplayChannel *display) +{ + int timeout = INT_MAX; + Ring *ring = &display->streams; + RingItem *item = ring; + + red_time_t now = red_get_monotonic_time(); + while ((item = ring_next(ring, item))) { + Stream *stream; + + stream = SPICE_CONTAINEROF(item, Stream, link); + red_time_t delta = (stream->last_time + RED_STREAM_TIMEOUT) - now; + + if (delta < 1000 * 1000) { + return 0; + } + timeout = MIN(timeout, (unsigned int)(delta / (1000 * 1000))); + } + return timeout; +} + +void display_channel_set_stream_video(DisplayChannel *display, int stream_video) +{ + spice_return_if_fail(display); + spice_return_if_fail(stream_video != SPICE_STREAM_VIDEO_INVALID); + + switch (stream_video) { + case SPICE_STREAM_VIDEO_ALL: + spice_info("sv all"); + break; + case SPICE_STREAM_VIDEO_FILTER: + spice_info("sv filter"); + break; + case SPICE_STREAM_VIDEO_OFF: + spice_info("sv off"); + break; + default: + spice_warn_if_reached(); + return; + } + + display->stream_video = stream_video; +} |