diff options
author | Lennart Poettering <lennart@poettering.net> | 2008-05-07 20:36:41 +0000 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2008-05-07 20:36:41 +0000 |
commit | 876d5b408aa23e053b9c35830512038d3227f8e5 (patch) | |
tree | e8b01d5939184074f2bef9afc1d2f79281ee470b | |
parent | 6f4d44bb503409cf4c5a36e1e88517fdd29c7b0f (diff) | |
download | pulseaudio-876d5b408aa23e053b9c35830512038d3227f8e5.tar.gz |
fix a race condition when tearing down the ladspa/remap sink
git-svn-id: file:///home/lennart/svn/public/pulseaudio/branches/glitch-free@2385 fefdeb5f-60dc-0310-8127-8f9354f1896f
-rw-r--r-- | src/modules/module-ladspa-sink.c | 16 | ||||
-rw-r--r-- | src/modules/module-remap-sink.c | 14 |
2 files changed, 15 insertions, 15 deletions
diff --git a/src/modules/module-ladspa-sink.c b/src/modules/module-ladspa-sink.c index 664d73e94..245efcb04 100644 --- a/src/modules/module-ladspa-sink.c +++ b/src/modules/module-ladspa-sink.c @@ -174,7 +174,7 @@ static int sink_input_pop_cb(pa_sink_input *i, size_t nbytes, pa_memchunk *chunk 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 @@ static void sink_input_process_rewind_cb(pa_sink_input *i, size_t nbytes) { 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 @@ static void sink_input_process_rewind_cb(pa_sink_input *i, size_t nbytes) { 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 @@ static void sink_input_update_max_rewind_cb(pa_sink_input *i, size_t nbytes) { 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 @@ static void sink_input_detach_cb(pa_sink_input *i) { 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 @@ static void sink_input_attach_cb(pa_sink_input *i) { 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 @@ static void sink_input_kill_cb(pa_sink_input *i) { 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; diff --git a/src/modules/module-remap-sink.c b/src/modules/module-remap-sink.c index 985afbc8f..0b9825e17 100644 --- a/src/modules/module-remap-sink.c +++ b/src/modules/module-remap-sink.c @@ -143,7 +143,7 @@ static int sink_input_pop_cb(pa_sink_input *i, size_t nbytes, pa_memchunk *chunk 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 @@ static void sink_input_process_rewind_cb(pa_sink_input *i, size_t nbytes) { 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 @@ static void sink_input_update_max_rewind_cb(pa_sink_input *i, size_t nbytes) { 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 @@ static void sink_input_detach_cb(pa_sink_input *i) { 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 @@ static void sink_input_attach_cb(pa_sink_input *i) { 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 @@ static void sink_input_kill_cb(pa_sink_input *i) { 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; |