mirror of
https://gitlab.uni-freiburg.de/opensourcevdi/spice
synced 2025-12-30 01:42:27 +00:00
audio: Remove global 'playback_compression' variable
This variable belongs to SpiceServerConfig rather than being a static global variable hidden in sound.c Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
This commit is contained in:
parent
8551280d43
commit
fb1ccd0f0d
@ -177,6 +177,7 @@ struct RedServerConfig {
|
||||
gboolean ticketing_enabled;
|
||||
uint32_t streaming_video;
|
||||
SpiceImageCompression image_compression;
|
||||
uint32_t playback_compression;
|
||||
spice_wan_compression_t jpeg_state;
|
||||
spice_wan_compression_t zlib_glz_state;
|
||||
|
||||
@ -677,6 +678,11 @@ static void reds_mig_disconnect(RedsState *reds)
|
||||
}
|
||||
}
|
||||
|
||||
int reds_config_get_playback_compression(RedsState *reds)
|
||||
{
|
||||
return reds->config->playback_compression;
|
||||
}
|
||||
|
||||
int reds_get_mouse_mode(RedsState *reds)
|
||||
{
|
||||
return reds->mouse_mode;
|
||||
@ -3527,6 +3533,7 @@ SPICE_GNUC_VISIBLE SpiceServer *spice_server_new(void)
|
||||
reds->config->ticketing_enabled = TRUE; /* ticketing enabled by default */
|
||||
reds->config->streaming_video = SPICE_STREAM_VIDEO_FILTER;
|
||||
reds->config->image_compression = SPICE_IMAGE_COMPRESSION_AUTO_GLZ;
|
||||
reds->config->playback_compression = TRUE;
|
||||
reds->config->jpeg_state = SPICE_WAN_COMPRESSION_AUTO;
|
||||
reds->config->zlib_glz_state = SPICE_WAN_COMPRESSION_AUTO;
|
||||
reds->config->agent_mouse = TRUE;
|
||||
@ -3886,6 +3893,7 @@ uint32_t reds_get_streaming_video(const RedsState *reds)
|
||||
|
||||
SPICE_GNUC_VISIBLE int spice_server_set_playback_compression(SpiceServer *reds, int enable)
|
||||
{
|
||||
reds->config->playback_compression = !!enable;
|
||||
snd_set_playback_compression(enable);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -60,6 +60,8 @@ void reds_unregister_channel(RedsState *reds, RedChannel *channel);
|
||||
int reds_get_mouse_mode(RedsState *reds); // used by inputs_channel
|
||||
gboolean reds_config_get_agent_mouse(const RedsState *reds); // used by inputs_channel
|
||||
int reds_has_vdagent(RedsState *reds); // used by inputs channel
|
||||
int reds_config_get_playback_compression(RedsState *reds); // used by playback channel
|
||||
|
||||
void reds_handle_agent_mouse_event(RedsState *reds, const VDAgentMouseState *mouse_state); // used by inputs_channel
|
||||
|
||||
GArray* reds_get_renderers(RedsState *reds);
|
||||
|
||||
@ -183,7 +183,6 @@ typedef struct RecordChannel {
|
||||
|
||||
/* A list of all Spice{Playback,Record}State objects */
|
||||
static SndWorker *workers;
|
||||
static uint32_t playback_compression = TRUE;
|
||||
|
||||
static void snd_receive(SndChannel *channel);
|
||||
|
||||
@ -1157,7 +1156,8 @@ void snd_set_playback_latency(RedClient *client, uint32_t latency)
|
||||
}
|
||||
}
|
||||
|
||||
static int snd_desired_audio_mode(int frequency, int client_can_celt, int client_can_opus)
|
||||
static int snd_desired_audio_mode(int playback_compression, int frequency,
|
||||
int client_can_celt, int client_can_opus)
|
||||
{
|
||||
if (! playback_compression)
|
||||
return SPICE_AUDIO_DATA_MODE_RAW;
|
||||
@ -1236,7 +1236,9 @@ static void snd_set_playback_peer(RedChannel *channel, RedClient *client, RedsSt
|
||||
SPICE_PLAYBACK_CAP_CELT_0_5_1);
|
||||
int client_can_opus = red_channel_client_test_remote_cap(playback_channel->base.channel_client,
|
||||
SPICE_PLAYBACK_CAP_OPUS);
|
||||
int desired_mode = snd_desired_audio_mode(st->frequency, client_can_celt, client_can_opus);
|
||||
int playback_compression = reds_config_get_playback_compression(channel->reds);
|
||||
int desired_mode = snd_desired_audio_mode(playback_compression, st->frequency,
|
||||
client_can_celt, client_can_opus);
|
||||
playback_channel->mode = SPICE_AUDIO_DATA_MODE_RAW;
|
||||
if (desired_mode != SPICE_AUDIO_DATA_MODE_RAW) {
|
||||
if (snd_codec_create(&playback_channel->codec, desired_mode, st->frequency, SND_CODEC_ENCODE) == SND_CODEC_OK) {
|
||||
@ -1617,8 +1619,6 @@ void snd_set_playback_compression(int on)
|
||||
{
|
||||
SndWorker *now = workers;
|
||||
|
||||
playback_compression = !!on;
|
||||
|
||||
for (; now; now = now->next) {
|
||||
if (now->base_channel->type == SPICE_CHANNEL_PLAYBACK && now->connection) {
|
||||
PlaybackChannel* playback = (PlaybackChannel*)now->connection;
|
||||
@ -1627,7 +1627,8 @@ void snd_set_playback_compression(int on)
|
||||
SPICE_PLAYBACK_CAP_CELT_0_5_1);
|
||||
int client_can_opus = red_channel_client_test_remote_cap(playback->base.channel_client,
|
||||
SPICE_PLAYBACK_CAP_OPUS);
|
||||
int desired_mode = snd_desired_audio_mode(st->frequency, client_can_opus, client_can_celt);
|
||||
int desired_mode = snd_desired_audio_mode(on, st->frequency,
|
||||
client_can_opus, client_can_celt);
|
||||
if (playback->mode != desired_mode) {
|
||||
playback->mode = desired_mode;
|
||||
snd_set_command(now->connection, SND_PLAYBACK_MODE_MASK);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user