[pulseaudio-commits] [SCM] PulseAudio Sound Server branch, master, updated. v0.9.11-162-g450fe17

Lennart Poettering gitmailer-noreply at 0pointer.de
Thu Aug 28 16:25:49 PDT 2008


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  bb8263be6fbbb227989e8cb4f5dc7dc67216724d (commit)

- Log -----------------------------------------------------------------
450fe17... fix up latency before calling into stream code, to make sure we don't ask for too much data to early
63505be... add missing config.h inclusion
6723699... rework pa_ulog2 and base it on __builtin_clz if available, make pa_make_power_of_two based on it
-----------------------------------------------------------------------

Summary of changes:
 src/pulsecore/core-util.h     |   36 +++++++++++++++++++++---------------
 src/pulsecore/sink-input.c    |    5 +----
 src/pulsecore/sink.c          |   16 +++++++++++-----
 src/pulsecore/source-output.c |    5 +----
 src/pulsecore/source.c        |    3 +++
 src/tests/channelmap-test.c   |    4 ++++
 6 files changed, 41 insertions(+), 28 deletions(-)

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

commit 6723699ef88a570387f88d24b4096da32c39db3f
Author: Lennart Poettering <lennart at poettering.net>
Date:   Fri Aug 29 01:13:50 2008 +0200

    rework pa_ulog2 and base it on __builtin_clz if available, make pa_make_power_of_two based on it

diff --git a/src/pulsecore/core-util.h b/src/pulsecore/core-util.h
index 7167972..c9e307f 100644
--- a/src/pulsecore/core-util.h
+++ b/src/pulsecore/core-util.h
@@ -142,29 +142,35 @@ static inline int pa_is_power_of_two(unsigned n) {
     return !(n & (n - 1));
 }
 
-static inline unsigned pa_make_power_of_two(unsigned n) {
-    unsigned j = n;
+static inline unsigned pa_ulog2(unsigned n) {
 
-    if (pa_is_power_of_two(n))
-        return n;
+    if (n <= 1)
+        return 0;
 
-    while (j) {
-        j = j >> 1;
-        n = n | j;
-    }
+#if __GNUC__ >= 4 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
+    return 8U * (unsigned) sizeof(unsigned) - (unsigned) __builtin_clz(n) - 1;
+#else
+{
+    unsigned r = 0;
 
-    return n + 1;
-}
+    for (;;) {
+        n = n >> 1;
 
-static inline unsigned pa_ulog2(unsigned n) {
-    unsigned r = 0;
+        if (!n)
+            return r;
 
-    while (n) {
         r++;
-        n = n >> 1;
     }
+}
+#endif
+}
+
+static inline unsigned pa_make_power_of_two(unsigned n) {
+
+    if (pa_is_power_of_two(n))
+        return n;
 
-    return r;
+    return 1U << (pa_ulog2(n) + 1);
 }
 
 void pa_close_pipe(int fds[2]);

commit 63505bee07adf94f33ba4a8bdd4ab8dfdf0e57a1
Author: Lennart Poettering <lennart at poettering.net>
Date:   Fri Aug 29 01:15:58 2008 +0200

    add missing config.h inclusion

diff --git a/src/tests/channelmap-test.c b/src/tests/channelmap-test.c
index 12b39f1..6cf58fb 100644
--- a/src/tests/channelmap-test.c
+++ b/src/tests/channelmap-test.c
@@ -1,3 +1,7 @@
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
 #include <stdio.h>
 #include <assert.h>
 

commit 450fe170a5d8a38a9e49ddaae02ed7524e78a51f
Author: Lennart Poettering <lennart at poettering.net>
Date:   Fri Aug 29 01:20:25 2008 +0200

    fix up latency before calling into stream code, to make sure we don't ask for too much data to early

diff --git a/src/pulsecore/sink-input.c b/src/pulsecore/sink-input.c
index f4e803d..7d80242 100644
--- a/src/pulsecore/sink-input.c
+++ b/src/pulsecore/sink-input.c
@@ -756,14 +756,11 @@ pa_usec_t pa_sink_input_set_requested_latency(pa_sink_input *i, pa_usec_t usec)
 
     if (PA_SINK_INPUT_IS_LINKED(i->state))
         pa_assert_se(pa_asyncmsgq_send(i->sink->asyncmsgq, PA_MSGOBJECT(i), PA_SINK_INPUT_MESSAGE_SET_REQUESTED_LATENCY, &usec, 0, NULL) == 0);
-    else {
+    else
         /* If this sink input is not realized yet, we have to touch
          * the thread info data directly */
 
-        usec = fixup_latency(i->sink, usec);
         i->thread_info.requested_sink_latency = usec;
-        i->sink->thread_info.requested_latency_valid = FALSE;
-    }
 
     return usec;
 }
diff --git a/src/pulsecore/sink.c b/src/pulsecore/sink.c
index 24fb891..6fa22dc 100644
--- a/src/pulsecore/sink.c
+++ b/src/pulsecore/sink.c
@@ -1042,11 +1042,15 @@ int pa_sink_process_msg(pa_msgobject *o, int code, void *userdata, int64_t offse
 
             pa_sink_input_set_state_within_thread(i, i->state);
 
+            /* The requested latency of the sink input needs to be
+             * fixed up and then configured on the sink */
+
+            if (i->thread_info.requested_sink_latency != (pa_usec_t) -1)
+                pa_sink_input_set_requested_latency_within_thread(i, i->thread_info.requested_sink_latency);
+
             pa_sink_input_update_max_rewind(i, s->thread_info.max_rewind);
             pa_sink_input_update_max_request(i, s->thread_info.max_request);
 
-            pa_sink_invalidate_requested_latency(s);
-
             /* We don't rewind here automatically. This is left to the
              * sink input implementor because some sink inputs need a
              * slow start, i.e. need some time to buffer client
@@ -1158,11 +1162,12 @@ int pa_sink_process_msg(pa_msgobject *o, int code, void *userdata, int64_t offse
             if (i->attach)
                 i->attach(i);
 
+            if (i->thread_info.requested_sink_latency != (pa_usec_t) -1)
+                pa_sink_input_set_requested_latency_within_thread(i, i->thread_info.requested_sink_latency);
+
             pa_sink_input_update_max_rewind(i, s->thread_info.max_rewind);
             pa_sink_input_update_max_request(i, s->thread_info.max_request);
 
-            pa_sink_input_set_requested_latency_within_thread(i, i->thread_info.requested_sink_latency);
-
             if (i->thread_info.state != PA_SINK_INPUT_CORKED) {
                 pa_usec_t usec = 0;
                 size_t nbytes;
@@ -1424,7 +1429,6 @@ void pa_sink_set_max_rewind(pa_sink *s, size_t max_rewind) {
 
 /* Called from IO thread */
 void pa_sink_set_max_request(pa_sink *s, size_t max_request) {
-    pa_sink_input *i;
     void *state = NULL;
 
     pa_sink_assert_ref(s);
@@ -1435,6 +1439,8 @@ void pa_sink_set_max_request(pa_sink *s, size_t max_request) {
     s->thread_info.max_request = max_request;
 
     if (PA_SINK_IS_LINKED(s->thread_info.state)) {
+        pa_sink_input *i;
+
         while ((i = pa_hashmap_iterate(s->thread_info.inputs, &state, NULL)))
             pa_sink_input_update_max_request(i, s->thread_info.max_request);
     }
diff --git a/src/pulsecore/source-output.c b/src/pulsecore/source-output.c
index 4257154..5df950a 100644
--- a/src/pulsecore/source-output.c
+++ b/src/pulsecore/source-output.c
@@ -511,14 +511,11 @@ pa_usec_t pa_source_output_set_requested_latency(pa_source_output *o, pa_usec_t
 
     if (PA_SOURCE_OUTPUT_IS_LINKED(o->state))
         pa_assert_se(pa_asyncmsgq_send(o->source->asyncmsgq, PA_MSGOBJECT(o), PA_SOURCE_OUTPUT_MESSAGE_SET_REQUESTED_LATENCY, &usec, 0, NULL) == 0);
-    else {
+    else
         /* If this source output is not realized yet, we have to touch
          * the thread info data directly */
 
-        usec = fixup_latency(o->source, usec);
         o->thread_info.requested_source_latency = usec;
-        o->source->thread_info.requested_latency_valid = FALSE;
-    }
 
     return usec;
 }
diff --git a/src/pulsecore/source.c b/src/pulsecore/source.c
index 7ed32e9..edbbf01 100644
--- a/src/pulsecore/source.c
+++ b/src/pulsecore/source.c
@@ -670,6 +670,9 @@ int pa_source_process_msg(pa_msgobject *object, int code, void *userdata, int64_
 
             pa_source_output_set_state_within_thread(o, o->state);
 
+            if (o->thread_info.requested_source_latency != (pa_usec_t) -1)
+                pa_source_output_set_requested_latency_within_thread(o, o->thread_info.requested_source_latency);
+
             pa_source_output_update_max_rewind(o, s->thread_info.max_rewind);
 
             /* We don't just invalidate the requested latency here,

-- 
hooks/post-receive
PulseAudio Sound Server



More information about the pulseaudio-commits mailing list