[Spice-devel] [spice sound rework 2/3] Revise the spice client and server to use the new snd_codec functions in spice-common.

Christophe Fergeau cfergeau at redhat.com
Wed Oct 30 16:20:26 CET 2013


On Wed, Oct 16, 2013 at 11:46:32AM -0500, Jeremy White wrote:
> @@ -1568,22 +1537,20 @@ void snd_detach_record(SpiceRecordInstance *sin)
>      spice_record_state_free(sin->st);
>  }
>  
> -void snd_set_playback_compression(int on)
> +void snd_set_playback_compression(int comp)

I'm afraid we can't change this that easily as the 'int on' parameter
directly comes from
SPICE_GNUC_VISIBLE int spice_server_set_playback_compression(SpiceServer *s, int enable)
which is an exported method. We probably need to keep the TRUE/FALSE
semantics of this function.


>  {
>      SndWorker *now = workers;
>  
> -    playback_compression = on ? SPICE_AUDIO_DATA_MODE_CELT_0_5_1 : SPICE_AUDIO_DATA_MODE_RAW;
> +    playback_compression = comp;
> +
>      for (; now; now = now->next) {
>          if (now->base_channel->type == SPICE_CHANNEL_PLAYBACK && now->connection) {
> -            SndChannel* sndchannel = now->connection;
>              PlaybackChannel* playback = (PlaybackChannel*)now->connection;
> -            if (!red_channel_client_test_remote_cap(sndchannel->channel_client,
> -                                                    SPICE_PLAYBACK_CAP_CELT_0_5_1)) {
> -                spice_assert(playback->mode == SPICE_AUDIO_DATA_MODE_RAW);
> -                continue;
> -            }
> -            if (playback->mode != playback_compression) {
> -                playback->mode = playback_compression;
> +            int desired_mode = snd_desired_audio_mode(
> +                    red_channel_client_test_remote_cap(now->connection->channel_client, SPICE_PLAYBACK_CAP_CELT_0_5_1)
> +                    );
> +            if (playback->mode != desired_mode) {
> +                playback->mode = desired_mode;
>                  snd_set_command(now->connection, SND_PLAYBACK_MODE_MASK);
>              }
>          }
> @@ -1592,5 +1559,5 @@ void snd_set_playback_compression(int on)
>  
>  int snd_get_playback_compression(void)
>  {
> -    return (playback_compression == SPICE_AUDIO_DATA_MODE_RAW) ? FALSE : TRUE;
> +    return playback_compression;
>  }

This function does not seem to be used at all, probably better to just kill
it.

Rest of the patch looks good!

Christophe
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/spice-devel/attachments/20131030/8320f080/attachment.pgp>


More information about the Spice-devel mailing list