]> code.delx.au - pulseaudio/commitdiff
alsa: Don't always suspend/unsuspend on sink-input removal
authorArun Raghavan <arun.raghavan@collabora.co.uk>
Wed, 17 Aug 2011 08:03:50 +0000 (13:33 +0530)
committerArun Raghavan <arun.raghavan@collabora.co.uk>
Wed, 17 Aug 2011 08:03:50 +0000 (13:33 +0530)
If the sink was already suspended, this avoids and assert when calling
suspend() again, and prevents an unnecessary unsuspend.

src/modules/alsa/alsa-sink.c

index eec38d8135e31dd9dbc0dff21d549c50fd36942d..2bf19c6011907b229d65f4b26b0a8a3624f12dde 100644 (file)
@@ -1106,12 +1106,12 @@ static int sink_process_msg(pa_msgobject *o, int code, void *data, int64_t offse
                 break;
 
             /* .. we do */
-            if ((r = suspend(u)) < 0)
+            if (PA_SINK_IS_OPENED(u->sink->thread_info.state) && ((r = suspend(u)) < 0))
                 return r;
 
             u->sink->sample_spec.rate = u->old_rate;
 
-            if ((r = unsuspend(u)) < 0)
+            if (PA_SINK_IS_OPENED(u->sink->thread_info.state) && ((r = unsuspend(u)) < 0))
                 return r;
 
             break;