Make pa_sink_render_* and pa_source_post work only when in RUNNING state, to fix...
authorLennart Poettering <lennart@poettering.net>
Fri, 13 Jul 2007 00:09:59 +0000 (00:09 +0000)
committerLennart Poettering <lennart@poettering.net>
Fri, 13 Jul 2007 00:09:59 +0000 (00:09 +0000)
git-svn-id: file:///home/lennart/svn/public/pulseaudio/branches/lennart@1509 fefdeb5f-60dc-0310-8127-8f9354f1896f

src/pulsecore/sink.c
src/pulsecore/source.c

index d5ca061..ced23a5 100644 (file)
@@ -361,7 +361,7 @@ void pa_sink_render(pa_sink*s, size_t length, pa_memchunk *result) {
 
     pa_sink_ref(s);
 
-    n = fill_mix_info(s, info, MAX_MIX_CHANNELS);
+    n = s->thread_info.state == PA_SINK_RUNNING ? fill_mix_info(s, info, MAX_MIX_CHANNELS) : 0;
 
     if (n == 0) {
 
@@ -426,7 +426,7 @@ void pa_sink_render_into(pa_sink*s, pa_memchunk *target) {
 
     pa_sink_ref(s);
 
-    n = fill_mix_info(s, info, MAX_MIX_CHANNELS);
+    n = s->thread_info.state == PA_SINK_RUNNING ? fill_mix_info(s, info, MAX_MIX_CHANNELS) : 0;
 
     if (n == 0) {
         pa_silence_memchunk(target, &s->sample_spec);
index f0a898f..ce1ee98 100644 (file)
@@ -232,6 +232,9 @@ void pa_source_post(pa_source*s, const pa_memchunk *chunk) {
     pa_source_assert_ref(s);
     pa_assert(chunk);
 
+    if (s->thread_info.state != PA_SOURCE_RUNNING)
+        return;
+    
     if (s->thread_info.soft_muted || !pa_cvolume_is_norm(&s->thread_info.soft_volume)) {
         pa_memchunk vchunk = *chunk;