[Spice-devel] [PATCH v4 04/17] sound: Rename SndWorker to SndChannel

Christophe Fergeau cfergeau at redhat.com
Thu Dec 1 16:14:38 UTC 2016


On Thu, Dec 01, 2016 at 11:24:26AM +0000, Frediano Ziglio wrote:
> @@ -1506,73 +1506,73 @@ static void remove_worker(SndWorker *worker)
>  
>  void snd_attach_playback(RedsState *reds, SpicePlaybackInstance *sin)
>  {
> -    SndWorker *playback_worker;
> -    RedChannel *channel;
> +    SndChannel *playback;
> +    RedChannel *red_channel;

Here s/channel/red_channel was not really necessary as the other
variable is named "playback" and not channel, ditto in snd_attach_record
below.

Acked-by: Christophe Fergeau <cfergeau at redhat.com>

Christophe

>      ClientCbs client_cbs = { NULL, };
>  
>      sin->st = spice_new0(SpicePlaybackState, 1);
> -    playback_worker = &sin->st->worker;
> -    playback_worker->frequency = SND_CODEC_CELT_PLAYBACK_FREQ; /* Default to the legacy rate */
> +    playback = &sin->st->channel;
> +    playback->frequency = SND_CODEC_CELT_PLAYBACK_FREQ; /* Default to the legacy rate */
>  
> -    // TODO: Make RedChannel base of worker? instead of assigning it to channel->data
> -    channel = dummy_channel_new(reds, SPICE_CHANNEL_PLAYBACK, 0);
> +    // TODO: Make RedChannel base of channel? instead of assigning it to channel->data
> +    red_channel = dummy_channel_new(reds, SPICE_CHANNEL_PLAYBACK, 0);
>  
> -    g_object_set_data(G_OBJECT(channel), "sound-worker", playback_worker);
> +    g_object_set_data(G_OBJECT(red_channel), "sound-channel", playback);
>      client_cbs.connect = snd_set_playback_peer;
>      client_cbs.disconnect = snd_disconnect_channel_client;
>      client_cbs.migrate = snd_playback_migrate_channel_client;
> -    red_channel_register_client_cbs(channel, &client_cbs, playback_worker);
> +    red_channel_register_client_cbs(red_channel, &client_cbs, playback);
>  
>      if (snd_codec_is_capable(SPICE_AUDIO_DATA_MODE_CELT_0_5_1, SND_CODEC_ANY_FREQUENCY))
> -        red_channel_set_cap(channel, SPICE_PLAYBACK_CAP_CELT_0_5_1);
> +        red_channel_set_cap(red_channel, SPICE_PLAYBACK_CAP_CELT_0_5_1);
>  
> -    red_channel_set_cap(channel, SPICE_PLAYBACK_CAP_VOLUME);
> +    red_channel_set_cap(red_channel, SPICE_PLAYBACK_CAP_VOLUME);
>  
> -    playback_worker->base_channel = channel;
> -    add_worker(playback_worker);
> -    reds_register_channel(reds, channel);
> +    playback->base_channel = red_channel;
> +    add_channel(playback);
> +    reds_register_channel(reds, red_channel);
>  }
>  
>  void snd_attach_record(RedsState *reds, SpiceRecordInstance *sin)
>  {
> -    SndWorker *record_worker;
> -    RedChannel *channel;
> +    SndChannel *record;
> +    RedChannel *red_channel;
>      ClientCbs client_cbs = { NULL, };
>  
>      sin->st = spice_new0(SpiceRecordState, 1);
> -    record_worker = &sin->st->worker;
> -    record_worker->frequency = SND_CODEC_CELT_PLAYBACK_FREQ; /* Default to the legacy rate */
> +    record = &sin->st->channel;
> +    record->frequency = SND_CODEC_CELT_PLAYBACK_FREQ; /* Default to the legacy rate */
>  
> -    // TODO: Make RedChannel base of worker? instead of assigning it to channel->data
> -    channel = dummy_channel_new(reds, SPICE_CHANNEL_RECORD, 0);
> +    // TODO: Make RedChannel base of channel? instead of assigning it to channel->data
> +    red_channel = dummy_channel_new(reds, SPICE_CHANNEL_RECORD, 0);
>  
> -    g_object_set_data(G_OBJECT(channel), "sound-worker", record_worker);
> +    g_object_set_data(G_OBJECT(red_channel), "sound-channel", record);
>      client_cbs.connect = snd_set_record_peer;
>      client_cbs.disconnect = snd_disconnect_channel_client;
>      client_cbs.migrate = snd_record_migrate_channel_client;
> -    red_channel_register_client_cbs(channel, &client_cbs, record_worker);
> +    red_channel_register_client_cbs(red_channel, &client_cbs, record);
>      if (snd_codec_is_capable(SPICE_AUDIO_DATA_MODE_CELT_0_5_1, SND_CODEC_ANY_FREQUENCY))
> -        red_channel_set_cap(channel, SPICE_RECORD_CAP_CELT_0_5_1);
> -    red_channel_set_cap(channel, SPICE_RECORD_CAP_VOLUME);
> +        red_channel_set_cap(red_channel, SPICE_RECORD_CAP_CELT_0_5_1);
> +    red_channel_set_cap(red_channel, SPICE_RECORD_CAP_VOLUME);
>  
> -    record_worker->base_channel = channel;
> -    add_worker(record_worker);
> -    reds_register_channel(reds, channel);
> +    record->base_channel = red_channel;
> +    add_channel(record);
> +    reds_register_channel(reds, red_channel);
>  }
>  
> -static void snd_detach_common(SndWorker *worker)
> +static void snd_detach_common(SndChannel *channel)
>  {
> -    if (!worker) {
> +    if (!channel) {
>          return;
>      }
> -    RedsState *reds = red_channel_get_server(worker->base_channel);
> +    RedsState *reds = red_channel_get_server(channel->base_channel);
>  
> -    remove_worker(worker);
> -    snd_disconnect_channel(worker->connection);
> -    reds_unregister_channel(reds, worker->base_channel);
> -    red_channel_destroy(worker->base_channel);
> -    free(worker->volume.volume);
> -    worker->volume.volume = NULL;
> +    remove_channel(channel);
> +    snd_disconnect_channel(channel->connection);
> +    reds_unregister_channel(reds, channel->base_channel);
> +    red_channel_destroy(channel->base_channel);
> +    free(channel->volume.volume);
> +    channel->volume.volume = NULL;
>  }
>  
>  static void spice_playback_state_free(SpicePlaybackState *st)
> @@ -1582,7 +1582,7 @@ static void spice_playback_state_free(SpicePlaybackState *st)
>  
>  void snd_detach_playback(SpicePlaybackInstance *sin)
>  {
> -    snd_detach_common(&sin->st->worker);
> +    snd_detach_common(&sin->st->channel);
>      spice_playback_state_free(sin->st);
>  }
>  
> @@ -1593,13 +1593,13 @@ static void spice_record_state_free(SpiceRecordState *st)
>  
>  void snd_detach_record(SpiceRecordInstance *sin)
>  {
> -    snd_detach_common(&sin->st->worker);
> +    snd_detach_common(&sin->st->channel);
>      spice_record_state_free(sin->st);
>  }
>  
>  void snd_set_playback_compression(int on)
>  {
> -    SndWorker *now = workers;
> +    SndChannel *now = snd_channels;
>  
>      for (; now; now = now->next) {
>          uint32_t type;
> -- 
> git-series 0.9.1
> _______________________________________________
> Spice-devel mailing list
> Spice-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/spice-devel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/spice-devel/attachments/20161201/7acc9fa8/attachment.sig>


More information about the Spice-devel mailing list