[Spice-devel] [spice-server v2 08/10] sound: Prefer snd_set_command() over snd_*_send_*()

Frediano Ziglio fziglio at redhat.com
Tue Jan 24 13:54:26 UTC 2017


> 
> snd_set_command()/snd_send() are higher level methods which take care of
> scheduling calls to the corresponding snd_*_send_*() methods when
> appropriate. This commit switches a few direct snd_*_send_*() calls to
> snd_set_command()/snd_send().
> 
> Based on a patch from Frediano Ziglio <fziglio at redhat.com>
> 
> Signed-off-by: Christophe Fergeau <cfergeau at redhat.com>
> ---
>  server/sound.c | 16 ++++++++--------
>  1 file changed, 8 insertions(+), 8 deletions(-)
> 
> diff --git a/server/sound.c b/server/sound.c
> index 6d56a15..d0cfbf1 100644
> --- a/server/sound.c
> +++ b/server/sound.c
> @@ -929,7 +929,6 @@ SPICE_GNUC_VISIBLE void
> spice_server_playback_set_volume(SpicePlaybackInstance *
>  {
>      SpiceVolumeState *st = &sin->st->channel.volume;
>      SndChannelClient *client = sin->st->channel.connection;
> -    PlaybackChannelClient *playback_client = SPICE_CONTAINEROF(client,
> PlaybackChannelClient, base);
>  
>      st->volume_nchannels = nchannels;
>      free(st->volume);
> @@ -938,21 +937,22 @@ SPICE_GNUC_VISIBLE void
> spice_server_playback_set_volume(SpicePlaybackInstance *
>      if (!client || nchannels == 0)
>          return;
>  
> -    snd_playback_send_volume(playback_client);
> +    snd_set_command(client, SND_VOLUME_MASK);
> +    snd_send(client);
>  }
>  
>  SPICE_GNUC_VISIBLE void spice_server_playback_set_mute(SpicePlaybackInstance
>  *sin, uint8_t mute)
>  {
>      SpiceVolumeState *st = &sin->st->channel.volume;
>      SndChannelClient *client = sin->st->channel.connection;
> -    PlaybackChannelClient *playback_client = SPICE_CONTAINEROF(client,
> PlaybackChannelClient, base);
>  
>      st->mute = mute;
>  
>      if (!client)
>          return;
>  
> -    snd_playback_send_mute(playback_client);
> +    snd_set_command(client, SND_MUTE_MASK);
> +    snd_send(client);
>  }
>  
>  static void snd_playback_start(SndChannel *channel)
> @@ -1211,7 +1211,6 @@ SPICE_GNUC_VISIBLE void
> spice_server_record_set_volume(SpiceRecordInstance *sin,
>  {
>      SpiceVolumeState *st = &sin->st->channel.volume;
>      SndChannelClient *client = sin->st->channel.connection;
> -    RecordChannelClient *record_client = SPICE_CONTAINEROF(client,
> RecordChannelClient, base);
>  
>      st->volume_nchannels = nchannels;
>      free(st->volume);
> @@ -1220,21 +1219,22 @@ SPICE_GNUC_VISIBLE void
> spice_server_record_set_volume(SpiceRecordInstance *sin,
>      if (!client || nchannels == 0)
>          return;
>  
> -    snd_record_send_volume(record_client);
> +    snd_set_command(client, SND_VOLUME_MASK);
> +    snd_send(client);
>  }
>  
>  SPICE_GNUC_VISIBLE void spice_server_record_set_mute(SpiceRecordInstance
>  *sin, uint8_t mute)
>  {
>      SpiceVolumeState *st = &sin->st->channel.volume;
>      SndChannelClient *client = sin->st->channel.connection;
> -    RecordChannelClient *record_client = SPICE_CONTAINEROF(client,
> RecordChannelClient, base);
>  
>      st->mute = mute;
>  
>      if (!client)
>          return;
>  
> -    snd_record_send_mute(record_client);
> +    snd_set_command(client, SND_MUTE_MASK);
> +    snd_send(client);
>  }
>  
>  static void snd_record_start(SndChannel *channel)

Acked-by: Frediano Ziglio <fziglio at redhat.com>

Frediano


More information about the Spice-devel mailing list