]> git.alsa-project.org Git - alsa-plugins.git/commitdiff
pulse - Returns errors instead of assert()
authorTakashi Iwai <tiwai@suse.de>
Wed, 16 Jul 2008 13:15:42 +0000 (15:15 +0200)
committerTakashi Iwai <tiwai@suse.de>
Wed, 16 Jul 2008 13:48:06 +0000 (15:48 +0200)
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

index e4a6232475b29a5e3eccba642010607e7cd29cc2..efff509426e27fc5f764e166c01df4736d7a80bc 100644 (file)
@@ -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);