[Spice-devel] [PATCH 4/4] SndChannel: rename 'connection' to 'client'
Frediano Ziglio
fziglio at redhat.com
Fri Apr 21 09:32:35 UTC 2017
>
> Since this field holds the SndChannelClient, rename this variable
> 'client' to make the code a bit easier to understand.
>
> Signed-off-by: Jonathon Jongsma <jjongsma at redhat.com>
Acked
> ---
> server/sound.c | 56 ++++++++++++++++++++++++++++----------------------------
> 1 file changed, 28 insertions(+), 28 deletions(-)
>
> diff --git a/server/sound.c b/server/sound.c
> index 7490a19..1e5d56d 100644
> --- a/server/sound.c
> +++ b/server/sound.c
> @@ -166,7 +166,7 @@ GType snd_channel_get_type(void) G_GNUC_CONST;
> struct SndChannel {
> RedChannel parent;
>
> - SndChannelClient *connection; /* Only one client is supported */
> + SndChannelClient *client; /* Only one client is supported */
> SndChannel *next; /* For the global SndChannel list */
>
> gboolean active;
> @@ -786,8 +786,8 @@ static bool
> snd_channel_client_config_socket(RedChannelClient *rcc)
> static void snd_channel_on_disconnect(RedChannelClient *rcc)
> {
> SndChannel *channel = SND_CHANNEL(red_channel_client_get_channel(rcc));
> - if (channel->connection && rcc ==
> RED_CHANNEL_CLIENT(channel->connection)) {
> - channel->connection = NULL;
> + if (channel->client && rcc == RED_CHANNEL_CLIENT(channel->client)) {
> + channel->client = NULL;
> }
> }
>
> @@ -824,7 +824,7 @@ static void snd_channel_set_volume(SndChannel *channel,
> uint8_t nchannels, uint16_t *volume)
> {
> SpiceVolumeState *st = &channel->volume;
> - SndChannelClient *client = channel->connection;
> + SndChannelClient *client = channel->client;
>
> st->volume_nchannels = nchannels;
> free(st->volume);
> @@ -847,7 +847,7 @@ SPICE_GNUC_VISIBLE void
> spice_server_playback_set_volume(SpicePlaybackInstance *
> static void snd_channel_set_mute(SndChannel *channel, uint8_t mute)
> {
> SpiceVolumeState *st = &channel->volume;
> - SndChannelClient *client = channel->connection;
> + SndChannelClient *client = channel->client;
>
> st->mute = mute;
>
> @@ -865,7 +865,7 @@ SPICE_GNUC_VISIBLE void
> spice_server_playback_set_mute(SpicePlaybackInstance *si
>
> static void snd_playback_start(SndChannel *channel)
> {
> - SndChannelClient *client = channel->connection;
> + SndChannelClient *client = channel->client;
>
> channel->active = TRUE;
> if (!client)
> @@ -888,7 +888,7 @@ SPICE_GNUC_VISIBLE void
> spice_server_playback_start(SpicePlaybackInstance *sin)
>
> SPICE_GNUC_VISIBLE void spice_server_playback_stop(SpicePlaybackInstance
> *sin)
> {
> - SndChannelClient *client = sin->st->channel.connection;
> + SndChannelClient *client = sin->st->channel.client;
>
> sin->st->channel.active = FALSE;
> if (!client)
> @@ -916,7 +916,7 @@ SPICE_GNUC_VISIBLE void
> spice_server_playback_stop(SpicePlaybackInstance *sin)
> SPICE_GNUC_VISIBLE void
> spice_server_playback_get_buffer(SpicePlaybackInstance *sin,
> uint32_t **frame,
> uint32_t
> *num_samples)
> {
> - SndChannelClient *client = sin->st->channel.connection;
> + SndChannelClient *client = sin->st->channel.client;
>
> *frame = NULL;
> *num_samples = 0;
> @@ -952,7 +952,7 @@ SPICE_GNUC_VISIBLE void
> spice_server_playback_put_samples(SpicePlaybackInstance
> }
> }
> playback_client = frame->client;
> - if (!playback_client || sin->st->channel.connection !=
> SND_CHANNEL_CLIENT(playback_client)) {
> + if (!playback_client || sin->st->channel.client !=
> SND_CHANNEL_CLIENT(playback_client)) {
> /* lost last reference, client has been destroyed previously */
> spice_debug("audio samples belong to a disconnected client");
> return;
> @@ -975,16 +975,16 @@ void snd_set_playback_latency(RedClient *client,
> uint32_t latency)
> for (; now; now = now->next) {
> uint32_t type;
> g_object_get(RED_CHANNEL(now), "channel-type", &type, NULL);
> - if (type == SPICE_CHANNEL_PLAYBACK && now->connection &&
> -
> red_channel_client_get_client(RED_CHANNEL_CLIENT(now->connection))
> == client) {
> + if (type == SPICE_CHANNEL_PLAYBACK && now->client &&
> + red_channel_client_get_client(RED_CHANNEL_CLIENT(now->client))
> == client) {
>
> - if
> (red_channel_client_test_remote_cap(RED_CHANNEL_CLIENT(now->connection),
> + if
> (red_channel_client_test_remote_cap(RED_CHANNEL_CLIENT(now->client),
> SPICE_PLAYBACK_CAP_LATENCY)) {
> - PlaybackChannelClient* playback =
> (PlaybackChannelClient*)now->connection;
> + PlaybackChannelClient* playback =
> (PlaybackChannelClient*)now->client;
>
> playback->latency = latency;
> - snd_set_command(now->connection, SND_PLAYBACK_LATENCY_MASK);
> - snd_send(now->connection);
> + snd_set_command(now->client, SND_PLAYBACK_LATENCY_MASK);
> + snd_send(now->client);
> } else {
> spice_debug("client doesn't not support
> SPICE_PLAYBACK_CAP_LATENCY");
> }
> @@ -1065,7 +1065,7 @@ playback_channel_client_constructed(GObject *object)
> spice_debug("playback client %p using mode %s", playback_client,
> spice_audio_data_mode_to_string(playback_client->mode));
>
> - channel->connection = scc;
> + channel->client = scc;
> if (red_client_during_migrate_at_target(red_client)) {
> return;
> }
> @@ -1086,9 +1086,9 @@ static void snd_set_peer(RedChannel *red_channel,
> RedClient *client, RedsStream
> SndChannel *channel = SND_CHANNEL(red_channel);
> SndChannelClient *snd_client;
>
> - if (channel->connection) {
> -
> red_channel_client_disconnect(RED_CHANNEL_CLIENT(channel->connection));
> - channel->connection = NULL;
> + if (channel->client) {
> + red_channel_client_disconnect(RED_CHANNEL_CLIENT(channel->client));
> + channel->client = NULL;
> }
>
> snd_client = g_initable_new(type,
> @@ -1129,7 +1129,7 @@ SPICE_GNUC_VISIBLE void
> spice_server_record_set_mute(SpiceRecordInstance *sin, u
>
> static void snd_record_start(SndChannel *channel)
> {
> - SndChannelClient *client = channel->connection;
> + SndChannelClient *client = channel->client;
>
> channel->active = TRUE;
> if (!client) {
> @@ -1155,7 +1155,7 @@ SPICE_GNUC_VISIBLE void
> spice_server_record_start(SpiceRecordInstance *sin)
>
> SPICE_GNUC_VISIBLE void spice_server_record_stop(SpiceRecordInstance *sin)
> {
> - SndChannelClient *client = sin->st->channel.connection;
> + SndChannelClient *client = sin->st->channel.client;
>
> sin->st->channel.active = FALSE;
> if (!client)
> @@ -1173,7 +1173,7 @@ SPICE_GNUC_VISIBLE void
> spice_server_record_stop(SpiceRecordInstance *sin)
> SPICE_GNUC_VISIBLE uint32_t
> spice_server_record_get_samples(SpiceRecordInstance *sin,
> uint32_t
> *samples,
> uint32_t
> bufsize)
> {
> - SndChannelClient *client = sin->st->channel.connection;
> + SndChannelClient *client = sin->st->channel.client;
> uint32_t read_pos;
> uint32_t now;
> uint32_t len;
> @@ -1223,7 +1223,7 @@ static void snd_set_rate(SndChannel *channel, uint32_t
> frequency, uint32_t cap_o
>
> SPICE_GNUC_VISIBLE uint32_t
> spice_server_get_best_playback_rate(SpicePlaybackInstance *sin)
> {
> - return snd_get_best_rate(sin ? sin->st->channel.connection : NULL,
> SPICE_PLAYBACK_CAP_OPUS);
> + return snd_get_best_rate(sin ? sin->st->channel.client : NULL,
> SPICE_PLAYBACK_CAP_OPUS);
> }
>
> SPICE_GNUC_VISIBLE void spice_server_set_playback_rate(SpicePlaybackInstance
> *sin, uint32_t frequency)
> @@ -1233,7 +1233,7 @@ SPICE_GNUC_VISIBLE void
> spice_server_set_playback_rate(SpicePlaybackInstance *si
>
> SPICE_GNUC_VISIBLE uint32_t
> spice_server_get_best_record_rate(SpiceRecordInstance *sin)
> {
> - return snd_get_best_rate(sin ? sin->st->channel.connection : NULL,
> SPICE_RECORD_CAP_OPUS);
> + return snd_get_best_rate(sin ? sin->st->channel.client : NULL,
> SPICE_RECORD_CAP_OPUS);
> }
>
> SPICE_GNUC_VISIBLE void spice_server_set_record_rate(SpiceRecordInstance
> *sin, uint32_t frequency)
> @@ -1261,7 +1261,7 @@ record_channel_client_constructed(GObject *object)
>
> G_OBJECT_CLASS(record_channel_client_parent_class)->constructed(object);
>
> - channel->connection = scc;
> + channel->client = scc;
> if (channel->volume.volume_nchannels) {
> snd_set_command(scc, SND_VOLUME_MUTE_MASK);
> }
> @@ -1458,8 +1458,8 @@ void snd_set_playback_compression(bool on)
> for (; now; now = now->next) {
> uint32_t type;
> g_object_get(RED_CHANNEL(now), "channel-type", &type, NULL);
> - if (type == SPICE_CHANNEL_PLAYBACK && now->connection) {
> - PlaybackChannelClient* playback =
> (PlaybackChannelClient*)now->connection;
> + if (type == SPICE_CHANNEL_PLAYBACK && now->client) {
> + PlaybackChannelClient* playback =
> (PlaybackChannelClient*)now->client;
> RedChannelClient *rcc = RED_CHANNEL_CLIENT(playback);
> bool client_can_celt = red_channel_client_test_remote_cap(rcc,
> SPICE_PLAYBACK_CAP_CELT_0_5_1);
> @@ -1469,7 +1469,7 @@ void snd_set_playback_compression(bool on)
> client_can_opus,
> client_can_celt);
> if (playback->mode != desired_mode) {
> playback->mode = desired_mode;
> - snd_set_command(now->connection, SND_PLAYBACK_MODE_MASK);
> + snd_set_command(now->client, SND_PLAYBACK_MODE_MASK);
> spice_debug("playback client %p using mode %s", playback,
> spice_audio_data_mode_to_string(playback->mode));
> }
Frediano
More information about the Spice-devel
mailing list