[Spice-commits] 2 commits - server/sound.c

Jonathon Jongsma jjongsma at kemper.freedesktop.org
Wed Mar 16 21:42:24 UTC 2016


 server/sound.c |   22 +++++++++++++---------
 1 file changed, 13 insertions(+), 9 deletions(-)

New commits:
commit 768ec149dbc35c8fd61f8277021de0537f35e522
Author: Francois Gouget <fgouget at codeweavers.com>
Date:   Mon Mar 14 17:50:21 2016 +0100

    server: Add some comments to the sound structures.
    
    Signed-off-by: Francois Gouget <fgouget at codeweavers.com>
    Acked-by: Jonathon Jongsma <jjongsma at redhat.com>

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;
 
commit 5bb27f240b6df51c1969e9e7e535fcda120d80ad
Author: Francois Gouget <fgouget at codeweavers.com>
Date:   Mon Mar 14 17:46:37 2016 +0100

    server: Give the SndChannel's ref and unref methods their expected name
    
    Signed-off-by: Francois Gouget <fgouget at codeweavers.com>
    Acked-by: Jonathon Jongsma <jjongsma at redhat.com>

diff --git a/server/sound.c b/server/sound.c
index 1aa3a74..03d88eb 100644
--- a/server/sound.c
+++ b/server/sound.c
@@ -183,13 +183,13 @@ static uint32_t playback_compression = TRUE;
 
 static void snd_receive(void* data);
 
-static SndChannel *snd_channel_get(SndChannel *channel)
+static SndChannel *snd_channel_ref(SndChannel *channel)
 {
     channel->refs++;
     return channel;
 }
 
-static SndChannel *snd_channel_put(SndChannel *channel)
+static SndChannel *snd_channel_unref(SndChannel *channel)
 {
     if (!--channel->refs) {
         spice_printerr("SndChannel=%p freed", channel);
@@ -226,7 +226,7 @@ static void snd_disconnect_channel(SndChannel *channel)
     reds_stream_free(channel->stream);
     channel->stream = NULL;
     spice_marshaller_destroy(channel->send_data.marshaller);
-    snd_channel_put(channel);
+    snd_channel_unref(channel);
     worker->connection = NULL;
 }
 
@@ -1100,7 +1100,7 @@ SPICE_GNUC_VISIBLE void spice_server_playback_get_buffer(SpicePlaybackInstance *
         return;
     }
     spice_assert(playback_channel->base.active);
-    snd_channel_get(channel);
+    snd_channel_ref(channel);
 
     *frame = playback_channel->free_frames->samples;
     playback_channel->free_frames = playback_channel->free_frames->next;
@@ -1115,7 +1115,7 @@ SPICE_GNUC_VISIBLE void spice_server_playback_put_samples(SpicePlaybackInstance
     frame = SPICE_CONTAINEROF(samples, AudioFrame, samples[0]);
     playback_channel = frame->channel;
     spice_assert(playback_channel);
-    if (!snd_channel_put(&playback_channel->base) ||
+    if (!snd_channel_unref(&playback_channel->base) ||
         sin->st->worker.connection != &playback_channel->base) {
         /* lost last reference, channel has been destroyed previously */
         spice_info("audio samples belong to a disconnected channel");


More information about the Spice-commits mailing list