[pulseaudio-commits] [SCM] PulseAudio Sound Server branch, master, updated. v0.9.15-test5-27-gdfb3d2e

Lennart Poettering gitmailer-noreply at 0pointer.de
Fri Mar 20 05:51:21 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  fe3709c5c73f9ce837837908fb644147d5fa4eae (commit)

- Log -----------------------------------------------------------------
dfb3d2e always remap relative volume properly
a998038 introduce pa_sink_input_get_relative_volume()
bd3154a introduce pa_assert_fp() for fast path assertions
-----------------------------------------------------------------------

Summary of changes:
 src/daemon/main.c                   |    8 ++++++++
 src/modules/module-stream-restore.c |   22 ++++++++++------------
 src/pulsecore/macro.h               |   20 ++++++++++++++++----
 src/pulsecore/sink-input.c          |   22 ++++++++++++++++++++++
 src/pulsecore/sink-input.h          |    1 +
 5 files changed, 57 insertions(+), 16 deletions(-)

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

commit bd3154a861d7ed0c68c687dcaa214a181ffb9f9d
Author: Lennart Poettering <lennart at poettering.net>
Date:   Fri Mar 20 13:29:42 2009 +0100

    introduce pa_assert_fp() for fast path assertions

diff --git a/src/daemon/main.c b/src/daemon/main.c
index 0048e7b..47ca267 100644
--- a/src/daemon/main.c
+++ b/src/daemon/main.c
@@ -851,6 +851,14 @@ int main(int argc, char *argv[]) {
     pa_log_debug(_("Optimized build: no"));
 #endif
 
+#ifdef NDEBUG
+    pa_log_debug(_("NDEBUG defined, all asserts disabled."));
+#elif defined(FASTPATH)
+    pa_log_debug(_("FASTPATH defined, only fast path asserts disabled."));
+#else
+    pa_log_debug(_("All asserts enabled."));
+#endif
+
     if (!(s = pa_machine_id())) {
         pa_log(_("Failed to get machine ID"));
         goto finish;
diff --git a/src/pulsecore/macro.h b/src/pulsecore/macro.h
index 20015bf..309f1a0 100644
--- a/src/pulsecore/macro.h
+++ b/src/pulsecore/macro.h
@@ -164,8 +164,8 @@ typedef int pa_bool_t;
 
 #define pa_return_null_if_fail(expr) pa_return_val_if_fail(expr, NULL)
 
-/* An assert which guarantees side effects of x, i.e. is never
- * optimized away */
+/* pa_assert_se() is an assert which guarantees side effects of x,
+ * i.e. is never optimized away, regardless of NDEBUG or FASTPATH. */
 #define pa_assert_se(expr)                                              \
     do {                                                                \
         if (PA_UNLIKELY(!(expr))) {                                     \
@@ -174,11 +174,23 @@ typedef int pa_bool_t;
         }                                                               \
     } while (FALSE)
 
-/* An assert that may be optimized away by defining NDEBUG */
+/* Does exactly nothing */
+#define pa_nop() do {} while (FALSE)
+
+/* pa_assert() is an assert that may be optimized away by defining
+ * NDEBUG. pa_assert_fp() is an assert that may be optimized away by
+ * defining FASTPATH. It is supposed to be used in inner loops. It's
+ * there for extra paranoia checking and should probably be removed in
+ * production builds. */
 #ifdef NDEBUG
-#define pa_assert(expr) do {} while (FALSE)
+#define pa_assert(expr) pa_nop()
+#define pa_assert_fp(expr) pa_nop()
+#elif defined (FASTPATH)
+#define pa_assert(expr) pa_assert_se(expr)
+#define pa_assert_fp(expr) pa_nop()
 #else
 #define pa_assert(expr) pa_assert_se(expr)
+#define pa_assert_fp(expr) pa_assert_se(expr)
 #endif
 
 #define pa_assert_not_reached()                                         \

commit a998038ee26f86054d0e314fcfe589169ce97ea7
Author: Lennart Poettering <lennart at poettering.net>
Date:   Fri Mar 20 13:50:26 2009 +0100

    introduce pa_sink_input_get_relative_volume()

diff --git a/src/pulsecore/sink-input.c b/src/pulsecore/sink-input.c
index 53e727b..ae2c6f5 100644
--- a/src/pulsecore/sink-input.c
+++ b/src/pulsecore/sink-input.c
@@ -924,6 +924,28 @@ const pa_cvolume *pa_sink_input_get_volume(pa_sink_input *i) {
 }
 
 /* Called from main context */
+pa_cvolume *pa_sink_input_get_relative_volume(pa_sink_input *i, pa_cvolume *v) {
+    pa_sink_input_assert_ref(i);
+    pa_assert(v);
+    pa_assert(PA_SINK_INPUT_IS_LINKED(i->state));
+
+    *v = i->virtual_volume;
+
+    /* This always returns a relative volume, even in flat volume mode */
+
+    if (i->sink->flags & PA_SINK_FLAT_VOLUME) {
+        pa_cvolume sv;
+
+        sv = *pa_sink_get_volume(i->sink, FALSE);
+
+        pa_sw_cvolume_divide(v, v,
+                             pa_cvolume_remap(&sv, &i->sink->channel_map, &i->channel_map));
+    }
+
+    return v;
+}
+
+/* Called from main context */
 void pa_sink_input_set_mute(pa_sink_input *i, pa_bool_t mute, pa_bool_t save) {
     pa_assert(i);
     pa_sink_input_assert_ref(i);
diff --git a/src/pulsecore/sink-input.h b/src/pulsecore/sink-input.h
index e380168..0bcb9d5 100644
--- a/src/pulsecore/sink-input.h
+++ b/src/pulsecore/sink-input.h
@@ -302,6 +302,7 @@ pa_usec_t pa_sink_input_get_latency(pa_sink_input *i, pa_usec_t *sink_latency);
 
 void pa_sink_input_set_volume(pa_sink_input *i, const pa_cvolume *volume, pa_bool_t save);
 const pa_cvolume *pa_sink_input_get_volume(pa_sink_input *i);
+pa_cvolume *pa_sink_input_get_relative_volume(pa_sink_input *i, pa_cvolume *v);
 void pa_sink_input_set_mute(pa_sink_input *i, pa_bool_t mute, pa_bool_t save);
 pa_bool_t pa_sink_input_get_mute(pa_sink_input *i);
 void pa_sink_input_update_proplist(pa_sink_input *i, pa_update_mode_t mode, pa_proplist *p);

commit dfb3d2ec57f234d450076fdd9393a8e18dd57e45
Author: Lennart Poettering <lennart at poettering.net>
Date:   Fri Mar 20 13:51:08 2009 +0100

    always remap relative volume properly

diff --git a/src/modules/module-stream-restore.c b/src/modules/module-stream-restore.c
index 723b5d7..2c90e72 100644
--- a/src/modules/module-stream-restore.c
+++ b/src/modules/module-stream-restore.c
@@ -192,7 +192,7 @@ static struct entry* read_entry(struct userdata *u, const char *name) {
         goto fail;
     }
 
-    if ((e->relative_volume_valid || e->absolute_volume_valid) && !(pa_channel_map_valid(&e->channel_map))) {
+    if ((e->relative_volume_valid || e->absolute_volume_valid) && !pa_channel_map_valid(&e->channel_map)) {
         pa_log_warn("Invalid channel map stored in database for stream %s", name);
         goto fail;
     }
@@ -293,16 +293,14 @@ static void subscribe_callback(pa_core *c, pa_subscription_event_type_t t, uint3
 
         entry.channel_map = sink_input->channel_map;
 
+        pa_sink_input_get_relative_volume(sink_input, &entry.relative_volume);
+        entry.relative_volume_valid = sink_input->save_volume;
+
         if (sink_input->sink->flags & PA_SINK_FLAT_VOLUME) {
             entry.absolute_volume = *pa_sink_input_get_volume(sink_input);
             entry.absolute_volume_valid = sink_input->save_volume;
-
-            pa_sw_cvolume_divide(&entry.relative_volume, &entry.absolute_volume, pa_sink_get_volume(sink_input->sink, FALSE));
-            entry.relative_volume_valid = sink_input->save_volume;
-        } else {
-            entry.relative_volume = *pa_sink_input_get_volume(sink_input);
-            entry.relative_volume_valid = sink_input->save_volume;
-        }
+        } else
+            entry.absolute_volume_valid = FALSE;
 
         entry.muted = pa_sink_input_get_mute(sink_input);
         entry.muted_valid = sink_input->save_muted;
@@ -528,11 +526,11 @@ static void apply_entry(struct userdata *u, const char *name, struct entry *e) {
         if (!(n = get_name(si->proplist, "sink-input")))
             continue;
 
-        if (strcmp(name, n)) {
+        if (!pa_streq(name, n)) {
             pa_xfree(n);
             continue;
         }
-	pa_xfree(n);
+        pa_xfree(n);
 
         if (u->restore_volume) {
             pa_cvolume v;
@@ -578,11 +576,11 @@ static void apply_entry(struct userdata *u, const char *name, struct entry *e) {
         if (!(n = get_name(so->proplist, "source-output")))
             continue;
 
-        if (strcmp(name, n)) {
+        if (!pa_streq(name, n)) {
             pa_xfree(n);
             continue;
         }
-	pa_xfree(n);
+        pa_xfree(n);
 
         if (u->restore_device &&
             e->device_valid &&

-- 
hooks/post-receive
PulseAudio Sound Server



More information about the pulseaudio-commits mailing list