From cf23b804e022e6d9c0e1894fed887a735963a127 Mon Sep 17 00:00:00 2001
From: Takashi Iwai <tiwai@suse.de>
Date: Wed, 16 Jul 2008 15:15:42 +0200
Subject: [PATCH] pulse - Returns errors instead of assert()
Some sanity checks in pcm_pulse.c with assert() causes the program to
abort unexpectedly when the pulseaudio daemon is dead. This is
suboptimal. Examples:
https://bugzilla.novell.com/show_bug.cgi?id=409532
Now fixed to return an error instead.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
pulse/pcm_pulse.c | 20 ++++++++++++++++----
1 files changed, 16 insertions(+), 4 deletions(-)
diff --git a/pulse/pcm_pulse.c b/pulse/pcm_pulse.c
index e4a6232..efff509 100644
--- a/pulse/pcm_pulse.c
+++ b/pulse/pcm_pulse.c
@@ -83,7 +83,10 @@ static int pulse_start(snd_pcm_ioplug_t *io)
goto finish;
o = pa_stream_cork(pcm->stream, 0, pulse_stream_success_cb, pcm->p);
- assert(o);
+ if (!o) {
+ err = -EIO;
+ goto finish;
+ }
err = pulse_wait_operation(pcm->p, o);
@@ -122,7 +125,10 @@ static int pulse_stop(snd_pcm_ioplug_t *io)
goto finish;
o = pa_stream_flush(pcm->stream, pulse_stream_success_cb, pcm->p);
- assert(o);
+ if (!o) {
+ err = -EIO;
+ goto finish;
+ }
err = pulse_wait_operation(pcm->p, o);
@@ -134,7 +140,10 @@ static int pulse_stop(snd_pcm_ioplug_t *io)
}
o = pa_stream_cork(pcm->stream, 1, pulse_stream_success_cb, pcm->p);
- assert(o);
+ if (!o) {
+ err = -EIO;
+ goto finish;
+ }
err = pulse_wait_operation(pcm->p, o);
@@ -169,7 +178,10 @@ int pulse_drain(snd_pcm_ioplug_t *io)
goto finish;
o = pa_stream_drain(pcm->stream, pulse_stream_success_cb, pcm->p);
- assert(o);
+ if (!o) {
+ err = -EIO;
+ goto finish;
+ }
err = pulse_wait_operation(pcm->p, o);
--
1.5.5.1