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

Francois Gouget fgouget at codeweavers.com
Mon Mar 14 16:50:21 UTC 2016


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;
 
-- 
2.7.0


More information about the Spice-devel mailing list