[Spice-commits] 7 commits - server/cache-item.tmpl.c server/cursor-channel.c server/dcc.c server/dcc.h server/dcc-private.h server/dcc-send.c server/display-channel.c server/display-channel.h server/image-cache.h server/Makefile.am server/red-record-qxl.c server/red-worker.c server/red-worker.h server/stream.c server/stream.h
Jonathon Jongsma
jjongsma at kemper.freedesktop.org
Tue Aug 9 15:23:07 UTC 2016
server/Makefile.am | 1
server/cache-item.tmpl.c | 2 -
server/cursor-channel.c | 22 ++++++------
server/dcc-private.h | 63 ++++++++++++++++++++++++++++++++++
server/dcc-send.c | 4 +-
server/dcc.c | 86 ++++++++++++++++++++++++++++++++++++++++-------
server/dcc.h | 64 ++++++++++++----------------------
server/display-channel.c | 33 ++++++++++--------
server/display-channel.h | 5 --
server/image-cache.h | 1
server/red-record-qxl.c | 1
server/red-worker.c | 40 ++++-----------------
server/red-worker.h | 18 ---------
server/stream.c | 56 +++++++++++++++---------------
server/stream.h | 2 -
15 files changed, 233 insertions(+), 165 deletions(-)
New commits:
commit 763dc98c09976bbc3fbb7785467b4992c17dc9ef
Author: Jonathon Jongsma <jjongsma at redhat.com>
Date: Wed May 18 11:53:52 2016 +0100
Miscellaneous header changes
Acked-by: Jonathon Jongsma <jjongsma at redhat.com>
diff --git a/server/display-channel.c b/server/display-channel.c
index 555bae2..4f52b79 100644
--- a/server/display-channel.c
+++ b/server/display-channel.c
@@ -18,6 +18,8 @@
#include <config.h>
#endif
+#include <common/sw_canvas.h>
+
#include "display-channel.h"
static void drawable_draw(DisplayChannel *display, Drawable *drawable);
diff --git a/server/display-channel.h b/server/display-channel.h
index f133c62..52a5783 100644
--- a/server/display-channel.h
+++ b/server/display-channel.h
@@ -20,9 +20,7 @@
#include <setjmp.h>
#include <common/rect.h>
-#include <common/sw_canvas.h>
-#include "red-worker.h"
#include "reds-stream.h"
#include "cache-item.h"
#include "pixmap-cache.h"
diff --git a/server/red-record-qxl.c b/server/red-record-qxl.c
index d92b5e7..8af2c9c 100644
--- a/server/red-record-qxl.c
+++ b/server/red-record-qxl.c
@@ -23,7 +23,6 @@
#include <inttypes.h>
#include <fcntl.h>
#include <glib.h>
-#include "red-worker.h"
#include "red-common.h"
#include "memslot.h"
#include "red-parse-qxl.h"
commit 76cecd66fb46833fbc897f86db98ed8cf7505cb8
Author: Frediano Ziglio <fziglio at redhat.com>
Date: Fri May 6 22:38:52 2016 +0100
remove CommonGraphicsChannelClient structure
Was just containing a RedChannelClient field
Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
Acked-by: Jonathon Jongsma <jjongsma at redhat.com>
diff --git a/server/cache-item.tmpl.c b/server/cache-item.tmpl.c
index 2e6f5ca..d1310a5 100644
--- a/server/cache-item.tmpl.c
+++ b/server/cache-item.tmpl.c
@@ -78,7 +78,7 @@ static void FUNC_NAME(remove)(CHANNELCLIENT *channel_client, RedCacheItem *item)
channel_client->VAR_NAME(available) += item->u.cache_data.size;
red_pipe_item_init(&item->u.pipe_data, RED_PIPE_ITEM_TYPE_INVAL_ONE);
- red_channel_client_pipe_add_tail_and_push(&channel_client->common.base, &item->u.pipe_data); // for now
+ red_channel_client_pipe_add_tail_and_push(&channel_client->base, &item->u.pipe_data); // for now
}
static int FUNC_NAME(add)(CHANNELCLIENT *channel_client, uint64_t id, size_t size)
diff --git a/server/cursor-channel.c b/server/cursor-channel.c
index ce1ea97..dac929a 100644
--- a/server/cursor-channel.c
+++ b/server/cursor-channel.c
@@ -68,7 +68,7 @@ struct CursorChannel {
};
struct CursorChannelClient {
- CommonGraphicsChannelClient common;
+ RedChannelClient base;
RedCacheItem *cursor_cache[CURSOR_CACHE_HASH_SIZE];
Ring cursor_cache_lru;
@@ -77,7 +77,7 @@ struct CursorChannelClient {
};
-#define RCC_TO_CCC(rcc) SPICE_CONTAINEROF((rcc), CursorChannelClient, common.base)
+#define RCC_TO_CCC(rcc) SPICE_CONTAINEROF((rcc), CursorChannelClient, base)
#define CLIENT_CURSOR_CACHE
#include "cache-item.tmpl.c"
diff --git a/server/dcc-private.h b/server/dcc-private.h
index dbe88aa..02b51dd 100644
--- a/server/dcc-private.h
+++ b/server/dcc-private.h
@@ -24,7 +24,7 @@
#include "stream.h"
struct DisplayChannelClient {
- CommonGraphicsChannelClient common;
+ RedChannelClient base;
int is_low_bandwidth;
uint32_t id;
SpiceImageCompression image_compression;
diff --git a/server/dcc.c b/server/dcc.c
index fe9551e..d387e8b 100644
--- a/server/dcc.c
+++ b/server/dcc.c
@@ -544,15 +544,15 @@ void dcc_push_monitors_config(DisplayChannelClient *dcc)
return;
}
- if (!red_channel_client_test_remote_cap(&dcc->common.base,
+ if (!red_channel_client_test_remote_cap(&dcc->base,
SPICE_DISPLAY_CAP_MONITORS_CONFIG)) {
return;
}
- mci = red_monitors_config_item_new(dcc->common.base.channel,
+ mci = red_monitors_config_item_new(dcc->base.channel,
monitors_config_ref(dc->monitors_config));
- red_channel_client_pipe_add(&dcc->common.base, &mci->pipe_item);
- red_channel_client_push(&dcc->common.base);
+ red_channel_client_pipe_add(&dcc->base, &mci->pipe_item);
+ red_channel_client_push(&dcc->base);
}
static RedSurfaceDestroyItem *red_surface_destroy_item_new(RedChannel *channel,
@@ -747,7 +747,7 @@ int dcc_compress_image(DisplayChannelClient *dcc,
goto lz_compress;
#ifdef USE_LZ4
case SPICE_IMAGE_COMPRESSION_LZ4:
- if (red_channel_client_test_remote_cap(&dcc->common.base,
+ if (red_channel_client_test_remote_cap(&dcc->base,
SPICE_DISPLAY_CAP_LZ4_COMPRESSION)) {
success = image_encoders_compress_lz4(&dcc->encoders, dest, src, o_comp_data);
break;
diff --git a/server/red-worker.h b/server/red-worker.h
index 60bdbec..368bfa1 100644
--- a/server/red-worker.h
+++ b/server/red-worker.h
@@ -24,10 +24,6 @@
typedef struct RedWorker RedWorker;
-typedef struct CommonGraphicsChannelClient {
- RedChannelClient base;
-} CommonGraphicsChannelClient;
-
int common_channel_config_socket(RedChannelClient *rcc);
#define COMMON_CLIENT_TIMEOUT (NSEC_PER_SEC * 30)
diff --git a/server/stream.c b/server/stream.c
index f3f6262..e070202 100644
--- a/server/stream.c
+++ b/server/stream.c
@@ -690,7 +690,7 @@ static void update_client_playback_delay(void *opaque, uint32_t delay_ms)
{
StreamAgent *agent = opaque;
DisplayChannelClient *dcc = agent->dcc;
- RedsState *reds = red_channel_get_server(((RedChannelClient*)dcc)->channel);
+ RedsState *reds = red_channel_get_server(RED_CHANNEL_CLIENT(dcc)->channel);
dcc_update_streams_max_latency(dcc, agent);
commit cbc86e7a1f48a73067d77080c294625e01db095b
Author: Frediano Ziglio <fziglio at redhat.com>
Date: Fri May 6 22:24:38 2016 +0100
move is_low_bandwidth to DisplayChannelClient
The field is only used by DisplayChannelClient, not by CursorChannelClient
Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
Acked-by: Jonathon Jongsma <jjongsma at redhat.com>
diff --git a/server/dcc-private.h b/server/dcc-private.h
index 6e11163..dbe88aa 100644
--- a/server/dcc-private.h
+++ b/server/dcc-private.h
@@ -25,6 +25,7 @@
struct DisplayChannelClient {
CommonGraphicsChannelClient common;
+ int is_low_bandwidth;
uint32_t id;
SpiceImageCompression image_compression;
spice_wan_compression_t jpeg_state;
diff --git a/server/dcc-send.c b/server/dcc-send.c
index 395129f..406907b 100644
--- a/server/dcc-send.c
+++ b/server/dcc-send.c
@@ -1845,7 +1845,7 @@ static void display_channel_marshall_migrate_data(RedChannelClient *rcc,
MIGRATE_DATA_DISPLAY_MAX_CACHE_CLIENTS == MAX_CACHE_CLIENTS);
display_data.message_serial = red_channel_client_get_message_serial(rcc);
- display_data.low_bandwidth_setting = dcc->common.is_low_bandwidth;
+ display_data.low_bandwidth_setting = dcc->is_low_bandwidth;
display_data.pixmap_cache_freezer = pixmap_cache_freeze(dcc->pixmap_cache);
display_data.pixmap_cache_id = dcc->pixmap_cache->id;
diff --git a/server/dcc.c b/server/dcc.c
index 24d3d4b..fe9551e 100644
--- a/server/dcc.c
+++ b/server/dcc.c
@@ -1107,7 +1107,7 @@ int dcc_handle_migrate_data(DisplayChannelClient *dcc, uint32_t size, void *mess
spice_critical("restoring global lz dictionary failed");
}
- dcc->common.is_low_bandwidth = migrate_data->low_bandwidth_setting;
+ dcc->is_low_bandwidth = migrate_data->low_bandwidth_setting;
if (migrate_data->low_bandwidth_setting) {
red_channel_client_ack_set_client_window(RED_CHANNEL_CLIENT(dcc), WIDE_CLIENT_ACK_WINDOW);
@@ -1176,3 +1176,18 @@ void dcc_set_max_stream_bit_rate(DisplayChannelClient *dcc, uint64_t rate)
{
dcc->streams_max_bit_rate = rate;
}
+
+int dcc_config_socket(RedChannelClient *rcc)
+{
+ RedClient *client = red_channel_client_get_client(rcc);
+ MainChannelClient *mcc = red_client_get_main(client);
+
+ RCC_TO_DCC(rcc)->is_low_bandwidth = main_channel_client_is_low_bandwidth(mcc);
+
+ return common_channel_config_socket(rcc);
+}
+
+gboolean dcc_is_low_bandwidth(DisplayChannelClient *dcc)
+{
+ return dcc->is_low_bandwidth;
+}
diff --git a/server/dcc.h b/server/dcc.h
index 1ea5949..672fb2f 100644
--- a/server/dcc.h
+++ b/server/dcc.h
@@ -170,5 +170,7 @@ uint32_t dcc_get_max_stream_latency(DisplayChannelClient *dcc);
void dcc_set_max_stream_latency(DisplayChannelClient *dcc, uint32_t latency);
uint64_t dcc_get_max_stream_bit_rate(DisplayChannelClient *dcc);
void dcc_set_max_stream_bit_rate(DisplayChannelClient *dcc, uint64_t rate);
+int dcc_config_socket(RedChannelClient *rcc);
+gboolean dcc_is_low_bandwidth(DisplayChannelClient *dcc);
#endif /* DCC_H_ */
diff --git a/server/display-channel.c b/server/display-channel.c
index 89bb0c6..555bae2 100644
--- a/server/display-channel.c
+++ b/server/display-channel.c
@@ -1897,7 +1897,8 @@ DisplayChannel* display_channel_new(SpiceServer *reds, RedWorker *worker,
.send_item = dcc_send_item,
.handle_migrate_flush_mark = handle_migrate_flush_mark,
.handle_migrate_data = handle_migrate_data,
- .handle_migrate_data_get_serial = handle_migrate_data_get_serial
+ .handle_migrate_data_get_serial = handle_migrate_data_get_serial,
+ .config_socket = dcc_config_socket
};
static SpiceImageSurfacesOps image_surfaces_ops = {
image_surfaces_get,
@@ -1992,13 +1993,13 @@ void display_channel_process_surface_cmd(DisplayChannel *display, RedSurfaceCmd
void display_channel_update_compression(DisplayChannel *display, DisplayChannelClient *dcc)
{
if (dcc_get_jpeg_state(dcc) == SPICE_WAN_COMPRESSION_AUTO) {
- display->enable_jpeg = ((CommonGraphicsChannelClient*)dcc)->is_low_bandwidth;
+ display->enable_jpeg = dcc_is_low_bandwidth(dcc);
} else {
display->enable_jpeg = (dcc_get_jpeg_state(dcc) == SPICE_WAN_COMPRESSION_ALWAYS);
}
if (dcc_get_zlib_glz_state(dcc) == SPICE_WAN_COMPRESSION_AUTO) {
- display->enable_zlib_glz_wrap = ((CommonGraphicsChannelClient*)dcc)->is_low_bandwidth;
+ display->enable_zlib_glz_wrap = dcc_is_low_bandwidth(dcc);
} else {
display->enable_zlib_glz_wrap = (dcc_get_zlib_glz_state(dcc) == SPICE_WAN_COMPRESSION_ALWAYS);
}
diff --git a/server/red-worker.c b/server/red-worker.c
index 9744131..34a8bff 100644
--- a/server/red-worker.c
+++ b/server/red-worker.c
@@ -400,14 +400,14 @@ static void flush_all_qxl_commands(RedWorker *worker)
flush_cursor_commands(worker);
}
-static int common_channel_config_socket(RedChannelClient *rcc)
+int common_channel_config_socket(RedChannelClient *rcc)
{
RedClient *client = red_channel_client_get_client(rcc);
MainChannelClient *mcc = red_client_get_main(client);
RedsStream *stream = red_channel_client_get_stream(rcc);
- CommonGraphicsChannelClient *ccc = COMMON_GRAPHICS_CHANNEL_CLIENT(rcc);
int flags;
int delay_val;
+ gboolean is_low_bandwidth;
if ((flags = fcntl(stream->socket, F_GETFL)) == -1) {
spice_warning("accept failed, %s", strerror(errno));
@@ -420,8 +420,8 @@ static int common_channel_config_socket(RedChannelClient *rcc)
}
// TODO - this should be dynamic, not one time at channel creation
- ccc->is_low_bandwidth = main_channel_client_is_low_bandwidth(mcc);
- delay_val = ccc->is_low_bandwidth ? 0 : 1;
+ is_low_bandwidth = main_channel_client_is_low_bandwidth(mcc);
+ delay_val = is_low_bandwidth ? 0 : 1;
/* FIXME: Using Nagle's Algorithm can lead to apparent delays, depending
* on the delayed ack timeout on the other side.
* Instead of using Nagle's, we need to implement message buffering on
@@ -436,7 +436,7 @@ static int common_channel_config_socket(RedChannelClient *rcc)
}
// TODO: move wide/narrow ack setting to red_channel.
red_channel_client_ack_set_client_window(rcc,
- ccc->is_low_bandwidth ?
+ is_low_bandwidth ?
WIDE_CLIENT_ACK_WINDOW : NARROW_CLIENT_ACK_WINDOW);
return TRUE;
}
@@ -452,11 +452,11 @@ CommonGraphicsChannel *red_worker_new_channel(RedWorker *worker, int size,
spice_return_val_if_fail(worker, NULL);
spice_return_val_if_fail(channel_cbs, NULL);
- spice_return_val_if_fail(!channel_cbs->config_socket, NULL);
spice_return_val_if_fail(!channel_cbs->alloc_recv_buf, NULL);
spice_return_val_if_fail(!channel_cbs->release_recv_buf, NULL);
- channel_cbs->config_socket = common_channel_config_socket;
+ if (!channel_cbs->config_socket)
+ channel_cbs->config_socket = common_channel_config_socket;
channel_cbs->alloc_recv_buf = common_alloc_recv_buf;
channel_cbs->release_recv_buf = common_release_recv_buf;
diff --git a/server/red-worker.h b/server/red-worker.h
index 31a6f3e..60bdbec 100644
--- a/server/red-worker.h
+++ b/server/red-worker.h
@@ -26,11 +26,10 @@ typedef struct RedWorker RedWorker;
typedef struct CommonGraphicsChannelClient {
RedChannelClient base;
-
- int is_low_bandwidth;
} CommonGraphicsChannelClient;
-#define COMMON_GRAPHICS_CHANNEL_CLIENT(Client) ((CommonGraphicsChannelClient*)(Client))
+int common_channel_config_socket(RedChannelClient *rcc);
+
#define COMMON_CLIENT_TIMEOUT (NSEC_PER_SEC * 30)
#define CHANNEL_RECEIVE_BUF_SIZE 1024
diff --git a/server/stream.c b/server/stream.c
index ab31d4e..f3f6262 100644
--- a/server/stream.c
+++ b/server/stream.c
@@ -355,7 +355,7 @@ static void before_reattach_stream(DisplayChannel *display,
agent = dcc_get_stream_agent(dcc, index);
if (!dcc_use_video_encoder_rate_control(dcc) &&
- !((CommonGraphicsChannelClient*)dcc)->is_low_bandwidth) {
+ !dcc_is_low_bandwidth(dcc)) {
continue;
}
@@ -646,7 +646,7 @@ static uint64_t get_initial_bit_rate(DisplayChannelClient *dcc, Stream *stream)
* If the network info is not initialized due to another reason,
* the low_bandwidth flag is FALSE.
*/
- bit_rate = ((CommonGraphicsChannelClient*)dcc)->is_low_bandwidth ?
+ bit_rate = dcc_is_low_bandwidth(dcc) ?
RED_STREAM_DEFAULT_LOW_START_BIT_RATE :
RED_STREAM_DEFAULT_HIGH_START_BIT_RATE;
}
commit 5d61659bba09ae388ffe79d759655fb84bffa044
Author: Frediano Ziglio <fziglio at redhat.com>
Date: Fri May 6 22:08:59 2016 +0100
remove common_graphics_channel_new_client function
The function was just calling another function with same parameters
Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
Acked-by: Jonathon Jongsma <jjongsma at redhat.com>
diff --git a/server/cursor-channel.c b/server/cursor-channel.c
index 2621c5f..ce1ea97 100644
--- a/server/cursor-channel.c
+++ b/server/cursor-channel.c
@@ -387,14 +387,14 @@ static CursorChannelClient* cursor_channel_client_new(CursorChannel *cursor,
spice_return_val_if_fail(!num_caps || caps, NULL);
CursorChannelClient *ccc =
- (CursorChannelClient*)common_graphics_channel_new_client(&cursor->common,
- sizeof(CursorChannelClient),
- client, stream,
- FALSE,
- common_caps,
- num_common_caps,
- caps,
- num_caps);
+ (CursorChannelClient*)red_channel_client_create(sizeof(CursorChannelClient),
+ &cursor->common.base,
+ client, stream,
+ FALSE,
+ num_common_caps,
+ common_caps,
+ num_caps,
+ caps);
spice_return_val_if_fail(ccc != NULL, NULL);
cursor->common.during_target_migrate = mig_target;
diff --git a/server/dcc.c b/server/dcc.c
index 81ae4ed..24d3d4b 100644
--- a/server/dcc.c
+++ b/server/dcc.c
@@ -364,11 +364,12 @@ DisplayChannelClient *dcc_new(DisplayChannel *display,
{
DisplayChannelClient *dcc;
- dcc = (DisplayChannelClient*)common_graphics_channel_new_client(
- COMMON_GRAPHICS_CHANNEL(display), sizeof(DisplayChannelClient),
+ dcc = (DisplayChannelClient*)red_channel_client_create(
+ sizeof(DisplayChannelClient),
+ &COMMON_GRAPHICS_CHANNEL(display)->base,
client, stream, TRUE,
- common_caps, num_common_caps,
- caps, num_caps);
+ num_common_caps, common_caps,
+ num_caps, caps);
display->common.during_target_migrate = mig_target;
dcc->id = display->common.qxl->id;
spice_return_val_if_fail(dcc, NULL);
diff --git a/server/red-worker.c b/server/red-worker.c
index 8f9c8dd..9744131 100644
--- a/server/red-worker.c
+++ b/server/red-worker.c
@@ -441,26 +441,6 @@ static int common_channel_config_socket(RedChannelClient *rcc)
return TRUE;
}
-CommonGraphicsChannelClient *common_graphics_channel_new_client(CommonGraphicsChannel *common,
- int size,
- RedClient *client,
- RedsStream *stream,
- int monitor_latency,
- uint32_t *common_caps,
- int num_common_caps,
- uint32_t *caps,
- int num_caps)
-{
- RedChannelClient *rcc =
- red_channel_client_create(size, &common->base, client, stream, monitor_latency,
- num_common_caps, common_caps, num_caps, caps);
- if (!rcc) {
- return NULL;
- }
- return (CommonGraphicsChannelClient*)rcc;
-}
-
-
CommonGraphicsChannel *red_worker_new_channel(RedWorker *worker, int size,
const char *name,
uint32_t channel_type, int migration_flags,
diff --git a/server/red-worker.h b/server/red-worker.h
index 318a004..31a6f3e 100644
--- a/server/red-worker.h
+++ b/server/red-worker.h
@@ -100,14 +100,4 @@ CommonGraphicsChannel *red_worker_new_channel(RedWorker *worker, int size,
ChannelCbs *channel_cbs,
channel_handle_parsed_proc handle_parsed);
-CommonGraphicsChannelClient *common_graphics_channel_new_client(CommonGraphicsChannel *common,
- int size,
- RedClient *client,
- RedsStream *stream,
- int monitor_latency,
- uint32_t *common_caps,
- int num_common_caps,
- uint32_t *caps,
- int num_caps);
-
#endif
commit eef8d0d8a3475fc31a087125ccbecea674518d5f
Author: Frediano Ziglio <fziglio at redhat.com>
Date: Fri May 6 22:01:24 2016 +0100
move during_target_migrate out of common_graphics_channel_new_client
This reduces the number of arguments that need to be passed to the
function, and also avoids changing a different object within a function
that is supposed to just create a new object
Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
Acked-by: Jonathon Jongsma <jjongsma at redhat.com>
diff --git a/server/cursor-channel.c b/server/cursor-channel.c
index 7649904..2621c5f 100644
--- a/server/cursor-channel.c
+++ b/server/cursor-channel.c
@@ -390,13 +390,13 @@ static CursorChannelClient* cursor_channel_client_new(CursorChannel *cursor,
(CursorChannelClient*)common_graphics_channel_new_client(&cursor->common,
sizeof(CursorChannelClient),
client, stream,
- mig_target,
FALSE,
common_caps,
num_common_caps,
caps,
num_caps);
spice_return_val_if_fail(ccc != NULL, NULL);
+ cursor->common.during_target_migrate = mig_target;
ring_init(&ccc->cursor_cache_lru);
ccc->cursor_cache_available = CLIENT_CURSOR_CACHE_SIZE;
diff --git a/server/dcc.c b/server/dcc.c
index c1c30c6..81ae4ed 100644
--- a/server/dcc.c
+++ b/server/dcc.c
@@ -366,9 +366,10 @@ DisplayChannelClient *dcc_new(DisplayChannel *display,
dcc = (DisplayChannelClient*)common_graphics_channel_new_client(
COMMON_GRAPHICS_CHANNEL(display), sizeof(DisplayChannelClient),
- client, stream, mig_target, TRUE,
+ client, stream, TRUE,
common_caps, num_common_caps,
caps, num_caps);
+ display->common.during_target_migrate = mig_target;
dcc->id = display->common.qxl->id;
spice_return_val_if_fail(dcc, NULL);
spice_info("New display (client %p) dcc %p stream %p", client, dcc, stream);
diff --git a/server/red-worker.c b/server/red-worker.c
index f15f67a..8f9c8dd 100644
--- a/server/red-worker.c
+++ b/server/red-worker.c
@@ -445,7 +445,6 @@ CommonGraphicsChannelClient *common_graphics_channel_new_client(CommonGraphicsCh
int size,
RedClient *client,
RedsStream *stream,
- int mig_target,
int monitor_latency,
uint32_t *common_caps,
int num_common_caps,
@@ -458,7 +457,6 @@ CommonGraphicsChannelClient *common_graphics_channel_new_client(CommonGraphicsCh
if (!rcc) {
return NULL;
}
- common->during_target_migrate = mig_target;
return (CommonGraphicsChannelClient*)rcc;
}
diff --git a/server/red-worker.h b/server/red-worker.h
index 63be8b5..318a004 100644
--- a/server/red-worker.h
+++ b/server/red-worker.h
@@ -104,7 +104,6 @@ CommonGraphicsChannelClient *common_graphics_channel_new_client(CommonGraphicsCh
int size,
RedClient *client,
RedsStream *stream,
- int mig_target,
int monitor_latency,
uint32_t *common_caps,
int num_common_caps,
commit c699e4db3d00252bbdcdacd87bdd70d4391eee46
Author: Frediano Ziglio <fziglio at redhat.com>
Date: Fri May 6 21:54:58 2016 +0100
move channel window setting to config_socket
Make common_graphics_channel_new_client smaller
Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
Acked-by: Jonathon Jongsma <jjongsma at redhat.com>
diff --git a/server/red-worker.c b/server/red-worker.c
index 9238632..f15f67a 100644
--- a/server/red-worker.c
+++ b/server/red-worker.c
@@ -434,6 +434,10 @@ static int common_channel_config_socket(RedChannelClient *rcc)
spice_warning("setsockopt failed, %s", strerror(errno));
}
}
+ // TODO: move wide/narrow ack setting to red_channel.
+ red_channel_client_ack_set_client_window(rcc,
+ ccc->is_low_bandwidth ?
+ WIDE_CLIENT_ACK_WINDOW : NARROW_CLIENT_ACK_WINDOW);
return TRUE;
}
@@ -454,14 +458,8 @@ CommonGraphicsChannelClient *common_graphics_channel_new_client(CommonGraphicsCh
if (!rcc) {
return NULL;
}
- CommonGraphicsChannelClient *common_cc = (CommonGraphicsChannelClient*)rcc;
common->during_target_migrate = mig_target;
-
- // TODO: move wide/narrow ack setting to red_channel.
- red_channel_client_ack_set_client_window(rcc,
- common_cc->is_low_bandwidth ?
- WIDE_CLIENT_ACK_WINDOW : NARROW_CLIENT_ACK_WINDOW);
- return common_cc;
+ return (CommonGraphicsChannelClient*)rcc;
}
commit a84a433e0840d0eb65d4eb5c51f6cdde94a2c210
Author: Jonathon Jongsma <jjongsma at redhat.com>
Date: Fri Aug 5 14:02:29 2016 -0500
Limit direct access to DisplayChannelClient
Add a few more methods and accessors so that other files don't need to
manipulate the struct members directly. Move the struct definition to a
private header which only the dcc-* files will include.
Signed-off-by: Jonathon Jongsma <jjongsma at redhat.com>
Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
Acked-by: Frediano Ziglio <fziglio at redhat.com>
diff --git a/server/Makefile.am b/server/Makefile.am
index 921b082..24e6e21 100644
--- a/server/Makefile.am
+++ b/server/Makefile.am
@@ -148,6 +148,7 @@ libserver_la_SOURCES = \
dcc-send.c \
dcc.h \
display-limits.h \
+ dcc-private.h \
image-encoders.c \
image-encoders.h \
$(NULL)
diff --git a/server/dcc-private.h b/server/dcc-private.h
new file mode 100644
index 0000000..6e11163
--- /dev/null
+++ b/server/dcc-private.h
@@ -0,0 +1,62 @@
+/* -*- Mode: C; c-basic-offset: 4; indent-tabs-mode: nil -*- */
+/*
+ Copyright (C) 2009-2015 Red Hat, Inc.
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, see <http://www.gnu.org/licenses/>.
+*/
+#ifndef DCC_PRIVATE_H_
+#define DCC_PRIVATE_H_
+
+#include "cache-item.h"
+#include "dcc.h"
+#include "image-encoders.h"
+#include "stream.h"
+
+struct DisplayChannelClient {
+ CommonGraphicsChannelClient common;
+ uint32_t id;
+ SpiceImageCompression image_compression;
+ spice_wan_compression_t jpeg_state;
+ spice_wan_compression_t zlib_glz_state;
+
+ ImageEncoders encoders;
+
+ int expect_init;
+
+ PixmapCache *pixmap_cache;
+ uint32_t pixmap_cache_generation;
+ int pending_pixmaps_sync;
+
+ RedCacheItem *palette_cache[PALETTE_CACHE_HASH_SIZE];
+ Ring palette_cache_lru;
+ long palette_cache_available;
+ uint32_t palette_cache_items;
+
+ struct {
+ FreeList free_list;
+ uint64_t pixmap_cache_items[MAX_DRAWABLE_PIXMAP_CACHE_ITEMS];
+ int num_pixmap_cache_items;
+ } send_data;
+
+ uint8_t surface_client_created[NUM_SURFACES];
+ QRegion surface_client_lossy_region[NUM_SURFACES];
+
+ StreamAgent stream_agents[NUM_STREAMS];
+ int use_video_encoder_rate_control;
+ uint32_t streams_max_latency;
+ uint64_t streams_max_bit_rate;
+ bool gl_draw_ongoing;
+};
+
+#endif /* DCC_PRIVATE_H_ */
diff --git a/server/dcc-send.c b/server/dcc-send.c
index 56bbf23..395129f 100644
--- a/server/dcc-send.c
+++ b/server/dcc-send.c
@@ -19,7 +19,7 @@
#include <config.h>
#endif
-#include "dcc.h"
+#include "dcc-private.h"
#include "display-channel.h"
#include <common/marshaller.h>
diff --git a/server/dcc.c b/server/dcc.c
index 45c3ca8..c1c30c6 100644
--- a/server/dcc.c
+++ b/server/dcc.c
@@ -19,7 +19,7 @@
#include <config.h>
#endif
-#include "dcc.h"
+#include "dcc-private.h"
#include "display-channel.h"
#define DISPLAY_CLIENT_SHORT_TIMEOUT 15000000000ULL //nano
@@ -1129,3 +1129,48 @@ int dcc_handle_migrate_data(DisplayChannelClient *dcc, uint32_t size, void *mess
red_channel_client_ack_zero_messages_window(RED_CHANNEL_CLIENT(dcc));
return TRUE;
}
+
+StreamAgent* dcc_get_stream_agent(DisplayChannelClient *dcc, int stream_id)
+{
+ return &dcc->stream_agents[stream_id];
+}
+
+ImageEncoders* dcc_get_encoders(DisplayChannelClient *dcc)
+{
+ return &dcc->encoders;
+}
+
+spice_wan_compression_t dcc_get_jpeg_state(DisplayChannelClient *dcc)
+{
+ return dcc->jpeg_state;
+}
+
+spice_wan_compression_t dcc_get_zlib_glz_state(DisplayChannelClient *dcc)
+{
+ return dcc->zlib_glz_state;
+}
+
+gboolean dcc_use_video_encoder_rate_control(DisplayChannelClient *dcc)
+{
+ return dcc->use_video_encoder_rate_control;
+}
+
+uint32_t dcc_get_max_stream_latency(DisplayChannelClient *dcc)
+{
+ return dcc->streams_max_latency;
+}
+
+void dcc_set_max_stream_latency(DisplayChannelClient *dcc, uint32_t latency)
+{
+ dcc->streams_max_latency = latency;
+}
+
+uint64_t dcc_get_max_stream_bit_rate(DisplayChannelClient *dcc)
+{
+ return dcc->streams_max_bit_rate;
+}
+
+void dcc_set_max_stream_bit_rate(DisplayChannelClient *dcc, uint64_t rate)
+{
+ dcc->streams_max_bit_rate = rate;
+}
diff --git a/server/dcc.h b/server/dcc.h
index 5f7b16f..1ea5949 100644
--- a/server/dcc.h
+++ b/server/dcc.h
@@ -18,11 +18,10 @@
#ifndef DCC_H_
# define DCC_H_
-#include "red-worker.h"
-#include "pixmap-cache.h"
-#include "cache-item.h"
#include "image-encoders.h"
-#include "stream.h"
+#include "image-cache.h"
+#include "pixmap-cache.h"
+#include "red-worker.h"
#include "display-limits.h"
#define PALETTE_CACHE_HASH_SHIFT 8
@@ -42,6 +41,10 @@
#define MAX_PIPE_SIZE 50
+typedef struct DisplayChannel DisplayChannel;
+typedef struct Stream Stream;
+typedef struct StreamAgent StreamAgent;
+
typedef struct WaitForChannels {
SpiceMsgWaitForChannels header;
SpiceWaitForChannel buf[MAX_CACHE_CLIENTS];
@@ -54,45 +57,10 @@ typedef struct FreeList {
WaitForChannels wait;
} FreeList;
-struct DisplayChannelClient {
- CommonGraphicsChannelClient common;
- uint32_t id;
- SpiceImageCompression image_compression;
- spice_wan_compression_t jpeg_state;
- spice_wan_compression_t zlib_glz_state;
-
- ImageEncoders encoders;
-
- int expect_init;
+typedef struct DisplayChannelClient DisplayChannelClient;
- PixmapCache *pixmap_cache;
- uint32_t pixmap_cache_generation;
- int pending_pixmaps_sync;
-
- RedCacheItem *palette_cache[PALETTE_CACHE_HASH_SIZE];
- Ring palette_cache_lru;
- long palette_cache_available;
- uint32_t palette_cache_items;
-
- struct {
- FreeList free_list;
- uint64_t pixmap_cache_items[MAX_DRAWABLE_PIXMAP_CACHE_ITEMS];
- int num_pixmap_cache_items;
- } send_data;
-
- uint8_t surface_client_created[NUM_SURFACES];
- QRegion surface_client_lossy_region[NUM_SURFACES];
-
- StreamAgent stream_agents[NUM_STREAMS];
- int use_video_encoder_rate_control;
- uint32_t streams_max_latency;
- uint64_t streams_max_bit_rate;
- bool gl_draw_ongoing;
-};
-
-#define DCC_TO_DC(dcc) \
- SPICE_CONTAINEROF((dcc)->common.base.channel, DisplayChannel, common.base)
-#define RCC_TO_DCC(rcc) SPICE_CONTAINEROF((rcc), DisplayChannelClient, common.base)
+#define DCC_TO_DC(dcc) ((DisplayChannel*)((RedChannelClient*)dcc)->channel)
+#define RCC_TO_DCC(rcc) ((DisplayChannelClient*)rcc)
typedef struct RedSurfaceCreateItem {
RedPipeItem pipe_item;
@@ -193,4 +161,14 @@ int dcc_compress_image (DisplayCha
int can_lossy,
compress_send_data_t* o_comp_data);
+StreamAgent * dcc_get_stream_agent (DisplayChannelClient *dcc, int stream_id);
+ImageEncoders *dcc_get_encoders(DisplayChannelClient *dcc);
+spice_wan_compression_t dcc_get_jpeg_state (DisplayChannelClient *dcc);
+spice_wan_compression_t dcc_get_zlib_glz_state (DisplayChannelClient *dcc);
+gboolean dcc_use_video_encoder_rate_control (DisplayChannelClient *dcc);
+uint32_t dcc_get_max_stream_latency(DisplayChannelClient *dcc);
+void dcc_set_max_stream_latency(DisplayChannelClient *dcc, uint32_t latency);
+uint64_t dcc_get_max_stream_bit_rate(DisplayChannelClient *dcc);
+void dcc_set_max_stream_bit_rate(DisplayChannelClient *dcc, uint64_t rate);
+
#endif /* DCC_H_ */
diff --git a/server/display-channel.c b/server/display-channel.c
index 073d45e..89bb0c6 100644
--- a/server/display-channel.c
+++ b/server/display-channel.c
@@ -230,7 +230,7 @@ static void streams_update_visible_region(DisplayChannel *display, Drawable *dra
}
FOREACH_CLIENT(display, link, next, dcc) {
- agent = &dcc->stream_agents[get_stream_id(display, stream)];
+ agent = dcc_get_stream_agent(dcc, get_stream_id(display, stream));
if (region_intersects(&agent->vis_region, &drawable->tree_item.base.rgn)) {
region_exclude(&agent->vis_region, &drawable->tree_item.base.rgn);
@@ -1151,7 +1151,7 @@ void display_channel_free_glz_drawables_to_free(DisplayChannel *display)
spice_return_if_fail(display);
FOREACH_CLIENT(display, link, next, dcc) {
- image_encoders_free_glz_drawables_to_free(&dcc->encoders);
+ image_encoders_free_glz_drawables_to_free(dcc_get_encoders(dcc));
}
}
@@ -1163,7 +1163,7 @@ void display_channel_free_glz_drawables(DisplayChannel *display)
spice_return_if_fail(display);
FOREACH_CLIENT(display, link, next, dcc) {
- image_encoders_free_glz_drawables(&dcc->encoders);
+ image_encoders_free_glz_drawables(dcc_get_encoders(dcc));
}
}
@@ -1206,10 +1206,12 @@ void display_channel_free_some(DisplayChannel *display)
spice_debug("#draw=%d, #glz_draw=%d", display->drawable_count,
display->encoder_shared_data.glz_drawable_count);
FOREACH_CLIENT(display, link, next, dcc) {
+ ImageEncoders *encoders = dcc_get_encoders(dcc);
+
// encoding using the dictionary is prevented since the following operations might
// change the dictionary
- if (image_encoders_glz_encode_lock(&dcc->encoders)) {
- n = image_encoders_free_some_independent_glz_drawables(&dcc->encoders);
+ if (image_encoders_glz_encode_lock(encoders)) {
+ n = image_encoders_free_some_independent_glz_drawables(encoders);
}
}
@@ -1218,7 +1220,9 @@ void display_channel_free_some(DisplayChannel *display)
}
FOREACH_CLIENT(display, link, next, dcc) {
- image_encoders_glz_encode_unlock(&dcc->encoders);
+ ImageEncoders *encoders = dcc_get_encoders(dcc);
+
+ image_encoders_glz_encode_unlock(encoders);
}
}
@@ -1987,16 +1991,16 @@ void display_channel_process_surface_cmd(DisplayChannel *display, RedSurfaceCmd
void display_channel_update_compression(DisplayChannel *display, DisplayChannelClient *dcc)
{
- if (dcc->jpeg_state == SPICE_WAN_COMPRESSION_AUTO) {
- display->enable_jpeg = dcc->common.is_low_bandwidth;
+ if (dcc_get_jpeg_state(dcc) == SPICE_WAN_COMPRESSION_AUTO) {
+ display->enable_jpeg = ((CommonGraphicsChannelClient*)dcc)->is_low_bandwidth;
} else {
- display->enable_jpeg = (dcc->jpeg_state == SPICE_WAN_COMPRESSION_ALWAYS);
+ display->enable_jpeg = (dcc_get_jpeg_state(dcc) == SPICE_WAN_COMPRESSION_ALWAYS);
}
- if (dcc->zlib_glz_state == SPICE_WAN_COMPRESSION_AUTO) {
- display->enable_zlib_glz_wrap = dcc->common.is_low_bandwidth;
+ if (dcc_get_zlib_glz_state(dcc) == SPICE_WAN_COMPRESSION_AUTO) {
+ display->enable_zlib_glz_wrap = ((CommonGraphicsChannelClient*)dcc)->is_low_bandwidth;
} else {
- display->enable_zlib_glz_wrap = (dcc->zlib_glz_state == SPICE_WAN_COMPRESSION_ALWAYS);
+ display->enable_zlib_glz_wrap = (dcc_get_zlib_glz_state(dcc) == SPICE_WAN_COMPRESSION_ALWAYS);
}
spice_info("jpeg %s", display->enable_jpeg ? "enabled" : "disabled");
spice_info("zlib-over-glz %s", display->enable_zlib_glz_wrap ? "enabled" : "disabled");
diff --git a/server/display-channel.h b/server/display-channel.h
index f090d99..f133c62 100644
--- a/server/display-channel.h
+++ b/server/display-channel.h
@@ -44,8 +44,7 @@
#include "tree.h"
#include "stream.h"
#include "dcc.h"
-#include "display-limits.h"
-
+#include "image-encoders.h"
typedef struct DependItem {
Drawable *drawable;
diff --git a/server/image-cache.h b/server/image-cache.h
index b90a3b3..d86c8b7 100644
--- a/server/image-cache.h
+++ b/server/image-cache.h
@@ -25,7 +25,6 @@
/* FIXME: move back to display-channel.h (once structs are private) */
typedef struct Drawable Drawable;
-typedef struct DisplayChannelClient DisplayChannelClient;
typedef struct ImageCacheItem {
RingItem lru_link;
diff --git a/server/stream.c b/server/stream.c
index 96aca55..ab31d4e 100644
--- a/server/stream.c
+++ b/server/stream.c
@@ -66,7 +66,7 @@ static void stream_agent_stats_print(StreamAgent *agent)
static void stream_create_destroy_item_release(RedPipeItem *base)
{
StreamCreateDestroyItem *item = SPICE_UPCAST(StreamCreateDestroyItem, base);
- DisplayChannel *display = (DisplayChannel*)item->agent->dcc->common.base.channel;
+ DisplayChannel *display = DCC_TO_DC(item->agent->dcc);
stream_agent_unref(display, item->agent);
free(item);
}
@@ -105,17 +105,17 @@ void stream_stop(DisplayChannel *display, Stream *stream)
FOREACH_CLIENT(display, link, next, dcc) {
StreamAgent *stream_agent;
- stream_agent = &dcc->stream_agents[get_stream_id(display, stream)];
+ stream_agent = dcc_get_stream_agent(dcc, get_stream_id(display, stream));
region_clear(&stream_agent->vis_region);
region_clear(&stream_agent->clip);
- if (stream_agent->video_encoder && dcc->use_video_encoder_rate_control) {
+ if (stream_agent->video_encoder && dcc_use_video_encoder_rate_control(dcc)) {
uint64_t stream_bit_rate = stream_agent->video_encoder->get_bit_rate(stream_agent->video_encoder);
- if (stream_bit_rate > dcc->streams_max_bit_rate) {
+ if (stream_bit_rate > dcc_get_max_stream_bit_rate(dcc)) {
spice_debug("old max-bit-rate=%.2f new=%.2f",
- dcc->streams_max_bit_rate / 8.0 / 1024.0 / 1024.0,
+ dcc_get_max_stream_bit_rate(dcc) / 8.0 / 1024.0 / 1024.0,
stream_bit_rate / 8.0 / 1024.0 / 1024.0);
- dcc->streams_max_bit_rate = stream_bit_rate;
+ dcc_set_max_stream_bit_rate(dcc, stream_bit_rate);
}
}
red_channel_client_pipe_add(RED_CHANNEL_CLIENT(dcc), stream_destroy_item_new(stream_agent));
@@ -302,7 +302,7 @@ static void attach_stream(DisplayChannel *display, Drawable *drawable, Stream *s
StreamAgent *agent;
QRegion clip_in_draw_dest;
- agent = &dcc->stream_agents[get_stream_id(display, stream)];
+ agent = dcc_get_stream_agent(dcc, get_stream_id(display, stream));
region_or(&agent->vis_region, &drawable->tree_item.base.rgn);
region_init(&clip_in_draw_dest);
@@ -352,10 +352,10 @@ static void before_reattach_stream(DisplayChannel *display,
index = get_stream_id(display, stream);
DRAWABLE_FOREACH_DPI_SAFE(stream->current, ring_item, next, dpi) {
dcc = dpi->dcc;
- agent = &dcc->stream_agents[index];
+ agent = dcc_get_stream_agent(dcc, index);
- if (!dcc->use_video_encoder_rate_control &&
- !dcc->common.is_low_bandwidth) {
+ if (!dcc_use_video_encoder_rate_control(dcc) &&
+ !((CommonGraphicsChannelClient*)dcc)->is_low_bandwidth) {
continue;
}
@@ -363,7 +363,7 @@ static void before_reattach_stream(DisplayChannel *display,
#ifdef STREAM_STATS
agent->stats.num_drops_pipe++;
#endif
- if (dcc->use_video_encoder_rate_control) {
+ if (dcc_use_video_encoder_rate_control(dcc)) {
agent->video_encoder->notify_server_frame_drop(agent->video_encoder);
} else {
++agent->drops;
@@ -375,9 +375,9 @@ static void before_reattach_stream(DisplayChannel *display,
FOREACH_CLIENT(display, link, link_next, dcc) {
double drop_factor;
- agent = &dcc->stream_agents[index];
+ agent = dcc_get_stream_agent(dcc, index);
- if (dcc->use_video_encoder_rate_control) {
+ if (dcc_use_video_encoder_rate_control(dcc)) {
continue;
}
if (agent->frames / agent->fps < FPS_TEST_INTERVAL) {
@@ -592,16 +592,16 @@ static void dcc_update_streams_max_latency(DisplayChannelClient *dcc, StreamAgen
uint32_t new_max_latency = 0;
int i;
- if (dcc->streams_max_latency != remove_agent->client_required_latency) {
+ if (dcc_get_max_stream_latency(dcc) != remove_agent->client_required_latency) {
return;
}
- dcc->streams_max_latency = 0;
+ dcc_set_max_stream_latency(dcc, 0);
if (DCC_TO_DC(dcc)->stream_count == 1) {
return;
}
for (i = 0; i < NUM_STREAMS; i++) {
- StreamAgent *other_agent = &dcc->stream_agents[i];
+ StreamAgent *other_agent = dcc_get_stream_agent(dcc, i);
if (other_agent == remove_agent || !other_agent->video_encoder) {
continue;
}
@@ -609,7 +609,7 @@ static void dcc_update_streams_max_latency(DisplayChannelClient *dcc, StreamAgen
new_max_latency = other_agent->client_required_latency;
}
}
- dcc->streams_max_latency = new_max_latency;
+ dcc_set_max_stream_latency(dcc, new_max_latency);
}
static uint64_t get_initial_bit_rate(DisplayChannelClient *dcc, Stream *stream)
@@ -638,7 +638,7 @@ static uint64_t get_initial_bit_rate(DisplayChannelClient *dcc, Stream *stream)
net_test_bit_rate = main_channel_client_is_network_info_initialized(mcc) ?
main_channel_client_get_bitrate_per_sec(mcc) :
0;
- bit_rate = MAX(dcc->streams_max_bit_rate, net_test_bit_rate);
+ bit_rate = MAX(dcc_get_max_stream_bit_rate(dcc), net_test_bit_rate);
if (bit_rate == 0) {
/*
* In case we are after a spice session migration,
@@ -646,7 +646,7 @@ static uint64_t get_initial_bit_rate(DisplayChannelClient *dcc, Stream *stream)
* If the network info is not initialized due to another reason,
* the low_bandwidth flag is FALSE.
*/
- bit_rate = dcc->common.is_low_bandwidth ?
+ bit_rate = ((CommonGraphicsChannelClient*)dcc)->is_low_bandwidth ?
RED_STREAM_DEFAULT_LOW_START_BIT_RATE :
RED_STREAM_DEFAULT_HIGH_START_BIT_RATE;
}
@@ -690,18 +690,18 @@ static void update_client_playback_delay(void *opaque, uint32_t delay_ms)
{
StreamAgent *agent = opaque;
DisplayChannelClient *dcc = agent->dcc;
- RedsState *reds = red_channel_get_server(dcc->common.base.channel);
+ RedsState *reds = red_channel_get_server(((RedChannelClient*)dcc)->channel);
dcc_update_streams_max_latency(dcc, agent);
agent->client_required_latency = delay_ms;
- if (delay_ms > agent->dcc->streams_max_latency) {
- agent->dcc->streams_max_latency = delay_ms;
+ if (delay_ms > dcc_get_max_stream_latency(agent->dcc)) {
+ dcc_set_max_stream_latency(agent->dcc, delay_ms);
}
- spice_debug("resetting client latency: %u", agent->dcc->streams_max_latency);
+ spice_debug("resetting client latency: %u", dcc_get_max_stream_latency(agent->dcc));
main_dispatcher_set_mm_time_latency(reds_get_main_dispatcher(reds),
RED_CHANNEL_CLIENT(agent->dcc)->client,
- agent->dcc->streams_max_latency);
+ dcc_get_max_stream_latency(agent->dcc));
}
static void bitmap_ref(gpointer data)
@@ -756,7 +756,7 @@ static VideoEncoder* dcc_create_video_encoder(DisplayChannelClient *dcc,
void dcc_create_stream(DisplayChannelClient *dcc, Stream *stream)
{
- StreamAgent *agent = &dcc->stream_agents[get_stream_id(DCC_TO_DC(dcc), stream)];
+ StreamAgent *agent = dcc_get_stream_agent(dcc, get_stream_id(DCC_TO_DC(dcc), stream));
spice_return_if_fail(region_is_empty(&agent->vis_region));
@@ -771,7 +771,7 @@ void dcc_create_stream(DisplayChannelClient *dcc, Stream *stream)
agent->fps = MAX_FPS;
agent->dcc = dcc;
- if (dcc->use_video_encoder_rate_control) {
+ if (dcc_use_video_encoder_rate_control(dcc)) {
VideoEncoderRateControlCbs video_cbs;
uint64_t initial_bit_rate;
@@ -837,7 +837,7 @@ static void dcc_detach_stream_gracefully(DisplayChannelClient *dcc,
{
DisplayChannel *display = DCC_TO_DC(dcc);
int stream_id = get_stream_id(display, stream);
- StreamAgent *agent = &dcc->stream_agents[stream_id];
+ StreamAgent *agent = dcc_get_stream_agent(dcc, stream_id);
/* stopping the client from playing older frames at once*/
region_clear(&agent->clip);
@@ -933,7 +933,7 @@ void stream_detach_behind(DisplayChannel *display, QRegion *region, Drawable *dr
item = ring_next(ring, item);
FOREACH_CLIENT(display, link, next, dcc) {
- StreamAgent *agent = &dcc->stream_agents[get_stream_id(display, stream)];
+ StreamAgent *agent = dcc_get_stream_agent(dcc, get_stream_id(display, stream));
if (region_intersects(&agent->vis_region, region)) {
dcc_detach_stream_gracefully(dcc, stream, drawable);
diff --git a/server/stream.h b/server/stream.h
index c40c188..053b23d 100644
--- a/server/stream.h
+++ b/server/stream.h
@@ -24,7 +24,7 @@
#include "utils.h"
#include "video-encoder.h"
#include "red-channel.h"
-#include "image-cache.h"
+#include "dcc.h"
#define RED_STREAM_DETECTION_MAX_DELTA (NSEC_PER_SEC / 5)
#define RED_STREAM_CONTINUOUS_MAX_DELTA NSEC_PER_SEC
More information about the Spice-commits
mailing list