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

Jeremy White jwhite at codeweavers.com
Sat Nov 30 07:16:07 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 37e5c40..acb6e4e 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, SND_CODEC_DECODE) != SND_CODEC_OK)
+        if (snd_codec_create(&c->codec, c->mode, start->frequency, SND_CODEC_DECODE) != 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 5561358..c99eae3 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, SND_CODEC_ENCODE) != SND_CODEC_OK)
+        if (snd_codec_create(&c->codec, c->mode, start->frequency, SND_CODEC_ENCODE) != 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