[pulseaudio-commits] r2385 - in /branches/glitch-free/src/modules: module-ladspa-sink.c module-remap-sink.c

svnmailer-noreply at 0pointer.de svnmailer-noreply at 0pointer.de
Wed May 7 13:36:41 PDT 2008


Author: lennart
Date: Wed May  7 22:36:41 2008
New Revision: 2385

URL: http://0pointer.de/cgi-bin/viewcvs.cgi?rev=2385&root=pulseaudio&view=rev
Log:
fix a race condition when tearing down the ladspa/remap sink

Modified:
    branches/glitch-free/src/modules/module-ladspa-sink.c
    branches/glitch-free/src/modules/module-remap-sink.c

Modified: branches/glitch-free/src/modules/module-ladspa-sink.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/branches/glitch-free/src/modules/module-ladspa-sink.c?rev=2385&root=pulseaudio&r1=2384&r2=2385&view=diff
==============================================================================
--- branches/glitch-free/src/modules/module-ladspa-sink.c (original)
+++ branches/glitch-free/src/modules/module-ladspa-sink.c Wed May  7 22:36:41 2008
@@ -174,7 +174,7 @@
     pa_assert(chunk);
     pa_assert_se(u = i->userdata);
 
-    if (!u->sink)
+    if (!u->sink || !PA_SINK_IS_OPENED(u->sink->thread_info.state))
         return -1;
 
     while (pa_memblockq_peek(u->memblockq, &tchunk) < 0) {
@@ -223,7 +223,7 @@
     pa_assert_se(u = i->userdata);
     pa_assert(nbytes > 0);
 
-    if (!u->sink)
+    if (!u->sink || !PA_SINK_IS_OPENED(u->sink->thread_info.state))
         return;
 
     if (u->sink->thread_info.rewind_nbytes > 0) {
@@ -236,7 +236,7 @@
         if (amount > 0) {
             unsigned c;
 
-            pa_memblockq_seek(u->memblockq, -amount, PA_SEEK_RELATIVE);
+            pa_memblockq_seek(u->memblockq, - (int64_t) amount, PA_SEEK_RELATIVE);
             pa_sink_process_rewind(u->sink, amount);
 
             pa_log_debug("Resetting plugin");
@@ -261,7 +261,7 @@
     pa_sink_input_assert_ref(i);
     pa_assert_se(u = i->userdata);
 
-    if (!u->sink)
+    if (!u->sink || !PA_SINK_IS_OPENED(u->sink->thread_info.state))
         return;
 
     pa_memblockq_set_maxrewind(u->memblockq, nbytes);
@@ -275,7 +275,7 @@
     pa_sink_input_assert_ref(i);
     pa_assert_se(u = i->userdata);
 
-    if (!u->sink)
+    if (!u->sink || !PA_SINK_IS_OPENED(u->sink->thread_info.state))
         return;
 
     pa_sink_detach_within_thread(u->sink);
@@ -290,7 +290,7 @@
     pa_sink_input_assert_ref(i);
     pa_assert_se(u = i->userdata);
 
-    if (!u->sink)
+    if (!u->sink || !PA_SINK_IS_OPENED(u->sink->thread_info.state))
         return;
 
     pa_sink_set_asyncmsgq(u->sink, i->sink->asyncmsgq);
@@ -309,10 +309,10 @@
     pa_assert_se(u = i->userdata);
 
     pa_sink_unlink(u->sink);
+    pa_sink_input_unlink(u->sink_input);
+
     pa_sink_unref(u->sink);
     u->sink = NULL;
-
-    pa_sink_input_unlink(u->sink_input);
     pa_sink_input_unref(u->sink_input);
     u->sink_input = NULL;
 

Modified: branches/glitch-free/src/modules/module-remap-sink.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/branches/glitch-free/src/modules/module-remap-sink.c?rev=2385&root=pulseaudio&r1=2384&r2=2385&view=diff
==============================================================================
--- branches/glitch-free/src/modules/module-remap-sink.c (original)
+++ branches/glitch-free/src/modules/module-remap-sink.c Wed May  7 22:36:41 2008
@@ -143,7 +143,7 @@
     pa_assert(chunk);
     pa_assert_se(u = i->userdata);
 
-    if (!u->sink)
+    if (!u->sink || !PA_SINK_IS_OPENED(u->sink->thread_info.state))
         return -1;
 
     pa_sink_render(u->sink, nbytes, chunk);
@@ -158,7 +158,7 @@
     pa_assert_se(u = i->userdata);
     pa_assert(nbytes > 0);
 
-    if (!u->sink)
+    if (!u->sink || !PA_SINK_IS_OPENED(u->sink->thread_info.state))
         return;
 
     if (u->sink->thread_info.rewind_nbytes > 0) {
@@ -179,7 +179,7 @@
     pa_sink_input_assert_ref(i);
     pa_assert_se(u = i->userdata);
 
-    if (!u->sink)
+    if (!u->sink || !PA_SINK_IS_OPENED(u->sink->thread_info.state))
         return;
 
     pa_sink_set_max_rewind(u->sink, nbytes);
@@ -192,7 +192,7 @@
     pa_sink_input_assert_ref(i);
     pa_assert_se(u = i->userdata);
 
-    if (!u->sink)
+    if (!u->sink || !PA_SINK_IS_OPENED(u->sink->thread_info.state))
         return;
 
     pa_sink_detach_within_thread(u->sink);
@@ -207,7 +207,7 @@
     pa_sink_input_assert_ref(i);
     pa_assert_se(u = i->userdata);
 
-    if (!u->sink)
+    if (!u->sink || !PA_SINK_IS_OPENED(u->sink->thread_info.state))
         return;
 
     pa_sink_set_asyncmsgq(u->sink, i->sink->asyncmsgq);
@@ -226,10 +226,10 @@
     pa_assert_se(u = i->userdata);
 
     pa_sink_unlink(u->sink);
+    pa_sink_input_unlink(u->sink_input);
+
     pa_sink_unref(u->sink);
     u->sink = NULL;
-
-    pa_sink_input_unlink(u->sink_input);
     pa_sink_input_unref(u->sink_input);
     u->sink_input = NULL;
 




More information about the pulseaudio-commits mailing list