[Spice-devel] [spice-gtk sound rework 4/4 (take 5)] Don't emit start signals if codec creation fails.

Jeremy White jwhite at codeweavers.com
Fri Nov 8 08:18:38 PST 2013


Signed-off-by: Jeremy White <jwhite at codeweavers.com>
---
 gtk/channel-playback.c |    4 +++-
 gtk/channel-record.c   |    4 +++-
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/gtk/channel-playback.c b/gtk/channel-playback.c
index bcb4728..f02d08a 100644
--- a/gtk/channel-playback.c
+++ b/gtk/channel-playback.c
@@ -426,8 +426,10 @@ static void playback_handle_start(SpiceChannel *channel, SpiceMsgIn *in)
                           start->format, start->channels, start->frequency);
         break;
     case SPICE_AUDIO_DATA_MODE_CELT_0_5_1: {
-        if (snd_codec_create(&c->codec, c->mode, start->frequency, FALSE, TRUE) != SND_CODEC_OK)
+        if (snd_codec_create(&c->codec, c->mode, start->frequency, FALSE, TRUE) != SND_CODEC_OK) {
             g_warning("create decoder failed");
+            return;
+        }
 
         emit_main_context(channel, SPICE_PLAYBACK_START,
                           start->format, start->channels, start->frequency);
diff --git a/gtk/channel-record.c b/gtk/channel-record.c
index 67d4a26..a238c85 100644
--- a/gtk/channel-record.c
+++ b/gtk/channel-record.c
@@ -437,8 +437,10 @@ static void record_handle_start(SpiceChannel *channel, SpiceMsgIn *in)
     {
         c->frame_bytes = SND_CODEC_CELT_FRAME_SIZE * 16 * start->channels / 8;
 
-        if (snd_codec_create(&c->codec, c->mode, start->frequency, TRUE, FALSE) != SND_CODEC_OK)
+        if (snd_codec_create(&c->codec, c->mode, start->frequency, TRUE, FALSE) != SND_CODEC_OK){
             g_warning("Failed to create encoder");
+            return;
+        }
     }
 
     g_free(c->last_frame);
-- 
1.7.10.4




More information about the Spice-devel mailing list