mirror of
https://gitlab.uni-freiburg.de/opensourcevdi/spice
synced 2025-12-27 07:29:32 +00:00
build a structure to hold all DCC stream fields
try to understand streams
This commit is contained in:
parent
7ef8efe104
commit
7766fbfb35
@ -24,6 +24,16 @@
|
||||
#include "stream.h"
|
||||
#include "red-channel-client.h"
|
||||
|
||||
typedef struct DCCStreams {
|
||||
uint32_t outbuf_size;
|
||||
uint8_t *outbuf; // caution stream buffer is also used as compress bufs!!!
|
||||
|
||||
StreamAgent agents[NUM_STREAMS];
|
||||
int use_video_encoder_rate_control;
|
||||
uint32_t max_latency;
|
||||
uint64_t max_bit_rate;
|
||||
} DCCStreams;
|
||||
|
||||
typedef struct DisplayChannelClientPrivate DisplayChannelClientPrivate;
|
||||
struct DisplayChannelClientPrivate
|
||||
{
|
||||
@ -54,10 +64,8 @@ struct DisplayChannelClientPrivate
|
||||
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;
|
||||
DCCStreams streams;
|
||||
|
||||
bool gl_draw_ongoing;
|
||||
};
|
||||
|
||||
|
||||
@ -1688,10 +1688,10 @@ static int red_marshall_stream_data(RedChannelClient *rcc,
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
StreamAgent *agent = &dcc->priv->stream_agents[display_channel_get_stream_id(display, stream)];
|
||||
StreamAgent *agent = &dcc->priv->streams.agents[display_channel_get_stream_id(display, stream)];
|
||||
uint64_t time_now = spice_get_monotonic_time_ns();
|
||||
|
||||
if (!dcc->priv->use_video_encoder_rate_control) {
|
||||
if (!dcc->priv->streams.use_video_encoder_rate_control) {
|
||||
if (time_now - agent->last_send_time < (1000 * 1000 * 1000) / agent->fps) {
|
||||
agent->frames--;
|
||||
#ifdef STREAM_STATS
|
||||
@ -1715,7 +1715,7 @@ static int red_marshall_stream_data(RedChannelClient *rcc,
|
||||
&outbuf);
|
||||
switch (ret) {
|
||||
case VIDEO_ENCODER_FRAME_DROP:
|
||||
spice_assert(dcc->priv->use_video_encoder_rate_control);
|
||||
spice_assert(dcc->priv->streams.use_video_encoder_rate_control);
|
||||
#ifdef STREAM_STATS
|
||||
agent->stats.num_drops_fps++;
|
||||
#endif
|
||||
@ -2295,7 +2295,7 @@ static void marshall_stream_activate_report(RedChannelClient *rcc,
|
||||
uint32_t stream_id)
|
||||
{
|
||||
DisplayChannelClient *dcc = DISPLAY_CHANNEL_CLIENT(rcc);
|
||||
StreamAgent *agent = &dcc->priv->stream_agents[stream_id];
|
||||
StreamAgent *agent = &dcc->priv->streams.agents[stream_id];
|
||||
SpiceMsgDisplayStreamActivateReport msg;
|
||||
|
||||
red_channel_client_init_send_data(rcc, SPICE_MSG_DISPLAY_STREAM_ACTIVATE_REPORT, NULL);
|
||||
|
||||
20
server/dcc.c
20
server/dcc.c
@ -473,12 +473,12 @@ static void dcc_init_stream_agents(DisplayChannelClient *dcc)
|
||||
DisplayChannel *display = DCC_TO_DC(dcc);
|
||||
|
||||
for (i = 0; i < NUM_STREAMS; i++) {
|
||||
StreamAgent *agent = &dcc->priv->stream_agents[i];
|
||||
StreamAgent *agent = &dcc->priv->streams.agents[i];
|
||||
agent->stream = &display->priv->streams_buf[i];
|
||||
region_init(&agent->vis_region);
|
||||
region_init(&agent->clip);
|
||||
}
|
||||
dcc->priv->use_video_encoder_rate_control =
|
||||
dcc->priv->streams.use_video_encoder_rate_control =
|
||||
red_channel_client_test_remote_cap(RED_CHANNEL_CLIENT(dcc), SPICE_DISPLAY_CAP_STREAM_REPORT);
|
||||
}
|
||||
|
||||
@ -605,7 +605,7 @@ static void dcc_destroy_stream_agents(DisplayChannelClient *dcc)
|
||||
int i;
|
||||
|
||||
for (i = 0; i < NUM_STREAMS; i++) {
|
||||
StreamAgent *agent = &dcc->priv->stream_agents[i];
|
||||
StreamAgent *agent = &dcc->priv->streams.agents[i];
|
||||
region_destroy(&agent->vis_region);
|
||||
region_destroy(&agent->clip);
|
||||
if (agent->video_encoder) {
|
||||
@ -1053,7 +1053,7 @@ static int dcc_handle_stream_report(DisplayChannelClient *dcc,
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
agent = &dcc->priv->stream_agents[report->stream_id];
|
||||
agent = &dcc->priv->streams.agents[report->stream_id];
|
||||
if (!agent->video_encoder) {
|
||||
spice_info("stream_report: no encoder for stream id %u. "
|
||||
"The stream has probably been destroyed",
|
||||
@ -1265,7 +1265,7 @@ int dcc_handle_migrate_data(DisplayChannelClient *dcc, uint32_t size, void *mess
|
||||
|
||||
StreamAgent* dcc_get_stream_agent(DisplayChannelClient *dcc, int stream_id)
|
||||
{
|
||||
return &dcc->priv->stream_agents[stream_id];
|
||||
return &dcc->priv->streams.agents[stream_id];
|
||||
}
|
||||
|
||||
ImageEncoders* dcc_get_encoders(DisplayChannelClient *dcc)
|
||||
@ -1285,27 +1285,27 @@ spice_wan_compression_t dcc_get_zlib_glz_state(DisplayChannelClient *dcc)
|
||||
|
||||
gboolean dcc_use_video_encoder_rate_control(DisplayChannelClient *dcc)
|
||||
{
|
||||
return dcc->priv->use_video_encoder_rate_control;
|
||||
return dcc->priv->streams.use_video_encoder_rate_control;
|
||||
}
|
||||
|
||||
uint32_t dcc_get_max_stream_latency(DisplayChannelClient *dcc)
|
||||
{
|
||||
return dcc->priv->streams_max_latency;
|
||||
return dcc->priv->streams.max_latency;
|
||||
}
|
||||
|
||||
void dcc_set_max_stream_latency(DisplayChannelClient *dcc, uint32_t latency)
|
||||
{
|
||||
dcc->priv->streams_max_latency = latency;
|
||||
dcc->priv->streams.max_latency = latency;
|
||||
}
|
||||
|
||||
uint64_t dcc_get_max_stream_bit_rate(DisplayChannelClient *dcc)
|
||||
{
|
||||
return dcc->priv->streams_max_bit_rate;
|
||||
return dcc->priv->streams.max_bit_rate;
|
||||
}
|
||||
|
||||
void dcc_set_max_stream_bit_rate(DisplayChannelClient *dcc, uint64_t rate)
|
||||
{
|
||||
dcc->priv->streams_max_bit_rate = rate;
|
||||
dcc->priv->streams.max_bit_rate = rate;
|
||||
}
|
||||
|
||||
int dcc_config_socket(RedChannelClient *rcc)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user