[pulseaudio-commits] [SCM] PulseAudio Sound Server branch, master, updated. v0.9.16-test3-2-gc14f6c1

Lennart Poettering gitmailer-noreply at 0pointer.de
Thu Jul 30 16:05:36 PDT 2009


This is an automated email from the git hooks/post-receive script. It was
generated because of a push to the "PulseAudio Sound Server" repository.

The master branch has been updated
      from  f8873ab82bee230ec7d0c3a858f8a8b07bc6dddd (commit)

- Log -----------------------------------------------------------------
c14f6c1 tunnel: don't assert on misaligned reads, closes #597 and rhbz #496310
4f5e2b7 threaded-mainloop: loop around pa_cond_wait() invocation in pa_threaded_mainloop_signal()
-----------------------------------------------------------------------

Summary of changes:
 src/modules/module-tunnel.c |   26 ++++++++++++++++++++++----
 src/pulse/thread-mainloop.c |   13 ++++++++++---
 src/pulse/thread-mainloop.h |    4 +++-
 3 files changed, 35 insertions(+), 8 deletions(-)

-----------------------------------------------------------------------

commit 4f5e2b745ea357e2b5c815ff33a556505a7d1f18
Author: Lennart Poettering <lennart at poettering.net>
Date:   Thu Jul 30 23:46:25 2009 +0200

    threaded-mainloop: loop around pa_cond_wait() invocation in pa_threaded_mainloop_signal()

diff --git a/src/pulse/thread-mainloop.c b/src/pulse/thread-mainloop.c
index 6916d86..a2b98ce 100644
--- a/src/pulse/thread-mainloop.c
+++ b/src/pulse/thread-mainloop.c
@@ -51,7 +51,7 @@
 
 struct pa_threaded_mainloop {
     pa_mainloop *real_mainloop;
-    int n_waiting;
+    int n_waiting, n_waiting_for_accept;
 
     pa_thread* thread;
     pa_mutex* mutex;
@@ -190,8 +190,12 @@ void pa_threaded_mainloop_signal(pa_threaded_mainloop *m, int wait_for_accept) {
 
     pa_cond_signal(m->cond, 1);
 
-    if (wait_for_accept && m->n_waiting > 0)
-        pa_cond_wait(m->accept_cond, m->mutex);
+    if (wait_for_accept) {
+        m->n_waiting_for_accept ++;
+
+        while (m->n_waiting_for_accept > 0)
+            pa_cond_wait(m->accept_cond, m->mutex);
+    }
 }
 
 void pa_threaded_mainloop_wait(pa_threaded_mainloop *m) {
@@ -214,6 +218,9 @@ void pa_threaded_mainloop_accept(pa_threaded_mainloop *m) {
     /* Make sure that this function is not called from the helper thread */
     pa_assert(!m->thread || !pa_thread_is_running(m->thread) || !in_worker(m));
 
+    pa_assert(m->n_waiting_for_accept > 0);
+    m->n_waiting_for_accept --;
+
     pa_cond_signal(m->accept_cond, 0);
 }
 
diff --git a/src/pulse/thread-mainloop.h b/src/pulse/thread-mainloop.h
index 8eddce4..41159d9 100644
--- a/src/pulse/thread-mainloop.h
+++ b/src/pulse/thread-mainloop.h
@@ -274,7 +274,9 @@ void pa_threaded_mainloop_unlock(pa_threaded_mainloop *m);
  * inside the event loop thread. Prior to this call the event loop
  * object needs to be locked using pa_threaded_mainloop_lock(). While
  * waiting the lock will be released, immediately before returning it
- * will be acquired again. */
+ * will be acquired again. This function may spuriously wake up even
+ * without _signal() being called. You need to make sure to handle
+ * that! */
 void pa_threaded_mainloop_wait(pa_threaded_mainloop *m);
 
 /** Signal all threads waiting for a signalling event in

commit c14f6c179fb3a52219f2796d20a1c6f5648aa8a1
Author: Lennart Poettering <lennart at poettering.net>
Date:   Fri Jul 31 00:50:19 2009 +0200

    tunnel: don't assert on misaligned reads, closes #597 and rhbz #496310

diff --git a/src/modules/module-tunnel.c b/src/modules/module-tunnel.c
index d115382..f788f66 100644
--- a/src/modules/module-tunnel.c
+++ b/src/modules/module-tunnel.c
@@ -55,6 +55,7 @@
 #include <pulsecore/core-error.h>
 #include <pulsecore/proplist-util.h>
 #include <pulsecore/auth-cookie.h>
+#include <pulsecore/mcalign.h>
 
 #ifdef TUNNEL_SINK
 #include "module-tunnel-sink-symdef.h"
@@ -194,6 +195,7 @@ struct userdata {
 #else
     char *source_name;
     pa_source *source;
+    pa_mcalign *mcalign;
 #endif
 
     pa_auth_cookie *auth_cookie;
@@ -614,14 +616,23 @@ static int source_process_msg(pa_msgobject *o, int code, void *data, int64_t off
             return 0;
         }
 
-        case SOURCE_MESSAGE_POST:
+        case SOURCE_MESSAGE_POST: {
+            pa_memchunk c;
 
-            if (PA_SOURCE_IS_OPENED(u->source->thread_info.state))
-                pa_source_post(u->source, chunk);
+            pa_mcalign_push(u->mcalign, chunk);
 
-            u->counter += (int64_t) chunk->length;
+            while (pa_mcalign_pop(u->mcalign, &c) >= 0) {
+
+                if (PA_SOURCE_IS_OPENED(u->source->thread_info.state))
+                    pa_source_post(u->source, &c);
+
+                pa_memblock_unref(c.memblock);
+
+                u->counter += (int64_t) c.length;
+            }
 
             return 0;
+        }
 
         case SOURCE_MESSAGE_REMOTE_SUSPEND:
 
@@ -1937,6 +1948,8 @@ int pa__init(pa_module*m) {
 
     pa_source_set_asyncmsgq(u->source, u->thread_mq.inq);
     pa_source_set_rtpoll(u->source, u->rtpoll);
+
+    u->mcalign = pa_mcalign_new(pa_frame_size(&u->source->sample_spec));
 #endif
 
     pa_xfree(dn);
@@ -2030,6 +2043,11 @@ void pa__done(pa_module*m) {
     if (u->time_event)
         u->core->mainloop->time_free(u->time_event);
 
+#ifndef TUNNEL_SINK
+    if (u->mcalign)
+        pa_mcalign_free(u->mcalign);
+#endif
+
 #ifdef TUNNEL_SINK
     pa_xfree(u->sink_name);
 #else

-- 
hooks/post-receive
PulseAudio Sound Server



More information about the pulseaudio-commits mailing list