summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy White <jwhite@codeweavers.com>2013-11-30 09:16:07 -0600
committerChristophe Fergeau <cfergeau@redhat.com>2014-01-02 13:34:35 +0100
commit2db6067269a2b8991ba55f61c3a9cdafb5cb763b (patch)
tree683af1018d95d209662f3283ee3b6aaa55634b17
parent5b8e5df030cd0650e9a2761e01e4e4035597d689 (diff)
Don't emit start signals if codec creation fails.
Signed-off-by: Jeremy White <jwhite@codeweavers.com>
-rw-r--r--gtk/channel-playback.c4
-rw-r--r--gtk/channel-record.c4
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);