Re: [PATCH v2 1/6] sound: Remove on_new_playback_channel_client()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I believe that this is the only patch of the series that has not been
formally ACKed yet. Any takers? In the first version of the patch
Frediano found a bug where I was returning too early from
playback_channel_client_constructed(). So that is the only real change
in the second version.

Jonathon


On Mon, 2017-04-24 at 12:09 -0500, Jonathon Jongsma wrote:
> This function is only called from the constructor, so move all of
> that
> code into the constructor.
> 
> Signed-off-by: Jonathon Jongsma <jjongsma@xxxxxxxxxx>
> ---
>  server/sound.c | 48 ++++++++++++++++++++----------------------------
>  1 file changed, 20 insertions(+), 28 deletions(-)
> 
> diff --git a/server/sound.c b/server/sound.c
> index 72dfefb..0e48255 100644
> --- a/server/sound.c
> +++ b/server/sound.c
> @@ -1007,29 +1007,6 @@ static int snd_desired_audio_mode(bool
> playback_compression, int frequency,
>      return SPICE_AUDIO_DATA_MODE_RAW;
>  }
>  
> -static void on_new_playback_channel_client(SndChannel *channel,
> SndChannelClient *client)
> -{
> -    RedsState *reds = red_channel_get_server(RED_CHANNEL(channel));
> -    RedClient *red_client =
> red_channel_client_get_client(RED_CHANNEL_CLIENT(client));
> -
> -    spice_assert(client);
> -
> -    channel->connection = client;
> -    if (red_client_during_migrate_at_target(red_client)) {
> -        return;
> -    }
> -    snd_set_command(client, SND_PLAYBACK_MODE_MASK);
> -    if (client->active) {
> -        snd_set_command(client, SND_CTRL_MASK);
> -    }
> -    if (channel->volume.volume_nchannels) {
> -        snd_set_command(client, SND_VOLUME_MUTE_MASK);
> -    }
> -    if (client->active) {
> -        reds_disable_mm_time(reds);
> -    }
> -}
> -
>  static void
>  playback_channel_client_finalize(GObject *object)
>  {
> @@ -1058,14 +1035,17 @@ static void
>  playback_channel_client_constructed(GObject *object)
>  {
>      PlaybackChannelClient *playback_client =
> PLAYBACK_CHANNEL_CLIENT(object);
> -    RedChannel *red_channel =
> red_channel_client_get_channel(RED_CHANNEL_CLIENT(playback_client));
> +    RedChannelClient *rcc = RED_CHANNEL_CLIENT(playback_client);
> +    RedChannel *red_channel = red_channel_client_get_channel(rcc);
>      SndChannel *channel = SND_CHANNEL(red_channel);
> +    RedClient *red_client = red_channel_client_get_client(rcc);
> +    RedsState *reds = red_channel_get_server(red_channel);
> +    SndChannelClient *scc = SND_CHANNEL_CLIENT(playback_client);
>  
>      G_OBJECT_CLASS(playback_channel_client_parent_class)-
> >constructed(object);
>  
> -    SND_CHANNEL_CLIENT(playback_client)->on_message_done =
> snd_playback_on_message_done;
> +    scc->on_message_done = snd_playback_on_message_done;
>  
> -    RedChannelClient *rcc = RED_CHANNEL_CLIENT(playback_client);
>      bool client_can_celt = red_channel_client_test_remote_cap(rcc,
>                                            SPICE_PLAYBACK_CAP_CELT_0_
> 5_1);
>      bool client_can_opus = red_channel_client_test_remote_cap(rcc,
> @@ -1086,12 +1066,24 @@ 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));
>  
> -    on_new_playback_channel_client(channel,
> SND_CHANNEL_CLIENT(playback_client));
> +    channel->connection = scc;
> +    if (!red_client_during_migrate_at_target(red_client)) {
> +        snd_set_command(scc, SND_PLAYBACK_MODE_MASK);
> +        if (scc->active) {
> +            snd_set_command(scc, SND_CTRL_MASK);
> +        }
> +        if (channel->volume.volume_nchannels) {
> +            snd_set_command(scc, SND_VOLUME_MUTE_MASK);
> +        }
> +        if (scc->active) {
> +            reds_disable_mm_time(reds);
> +        }
> +    }
>  
>      if (channel->active) {
>          snd_playback_start(channel);
>      }
> -    snd_send(SND_CHANNEL_CLIENT(playback_client));
> +    snd_send(scc);
>  }
>  
>  static void snd_set_peer(RedChannel *red_channel, RedClient *client,
> RedsStream *stream,
_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/spice-devel




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]