[Spice-devel] server: Add some comments to the sound structures.

Jonathon Jongsma jjongsma at redhat.com
Wed Mar 16 20:40:56 UTC 2016


Acked-by: Jonathon Jongsma <jjongsma at redhat.com>

thanks for the documentation. 


On Mon, 2016-03-14 at 17:50 +0100, Francois Gouget wrote:
> Signed-off-by: Francois Gouget <fgouget at codeweavers.com>
> ---
> 
> More are probably needed but at least those would have helped me when I 
> started looking at this code. (As would renaming SndWorker to SndState 
> and making it clearer it's a base class.)
> 
>  server/sound.c | 12 ++++++++----
>  1 file changed, 8 insertions(+), 4 deletions(-)
> 
> diff --git a/server/sound.c b/server/sound.c
> index 03d88eb..1cc4cfa 100644
> --- a/server/sound.c
> +++ b/server/sound.c
> @@ -79,6 +79,7 @@ typedef void (*snd_channel_cleanup_channel_proc)(SndChannel
> *channel);
>  
>  typedef struct SndWorker SndWorker;
>  
> +/* Connects an audio channel to a Spice client */
>  struct SndChannel {
>      RedsStream *stream;
>      SndWorker *worker;
> @@ -131,18 +132,20 @@ struct PlaybackChannel {
>      SndChannel base;
>      AudioFrame frames[3];
>      AudioFrame *free_frames;
> -    AudioFrame *in_progress;
> -    AudioFrame *pending_frame;
> +    AudioFrame *in_progress;   /* Frame being sent to the client */
> +    AudioFrame *pending_frame; /* Next frame to send to the client */
>      uint32_t mode;
>      uint32_t latency;
>      SndCodec codec;
>      uint8_t  encode_buf[SND_CODEC_MAX_COMPRESSED_BYTES];
>  };
>  
> +/* Base class for SpicePlaybackState and SpiceRecordState */
>  struct SndWorker {
>      RedChannel *base_channel;
> -    SndChannel *connection;
> -    SndWorker *next;
> +    SndChannel *connection; /* Only one client is supported */
> +    SndWorker *next; /* For the global SndWorker list */
> +
>      int active;
>  };
>  
> @@ -178,6 +181,7 @@ typedef struct RecordChannel {
>      uint8_t  decode_buf[SND_CODEC_MAX_FRAME_BYTES];
>  } RecordChannel;
>  
> +/* A list of all Spice{Playback,Record}State objects */
>  static SndWorker *workers;
>  static uint32_t playback_compression = TRUE;
>  


More information about the Spice-devel mailing list