[pulseaudio-commits] 14 commits - configure.ac README src/.gitignore src/Makefile.am src/modules src/pulsecore src/tests

Arun Raghavan arun at kemper.freedesktop.org
Wed Nov 2 12:11:33 PDT 2011


 README                                            |    2 
 configure.ac                                      |    4 
 src/.gitignore                                    |   61 +++++-----
 src/Makefile.am                                   |   20 +--
 src/modules/bluetooth/bluetooth-util.c            |   14 +-
 src/modules/bluetooth/bluetooth-util.h            |    1 
 src/modules/bluetooth/module-bluetooth-device.c   |  115 +++++++++++++++++-
 src/modules/bluetooth/module-bluetooth-discover.c |    4 
 src/pulsecore/sink.c                              |    9 -
 src/pulsecore/source.c                            |    9 -
 src/tests/asyncmsgq-test.c                        |   16 +-
 src/tests/asyncq-test.c                           |   11 +
 src/tests/extended-test.c                         |    2 
 src/tests/get-binary-name-test.c                  |   10 -
 src/tests/interpol-test.c                         |   20 +--
 src/tests/ipacl-test.c                            |  112 +++++-------------
 src/tests/lock-autospawn-test.c                   |    2 
 src/tests/memblock-test.c                         |   49 ++++----
 src/tests/memblockq-test.c                        |   30 +---
 src/tests/mix-test.c                              |    8 -
 src/tests/once-test.c                             |    7 -
 src/tests/prioq-test.c                            |   11 +
 src/tests/proplist-test.c                         |   15 +-
 src/tests/resampler-test.c                        |   36 ++---
 src/tests/smoother-test.c                         |   11 +
 src/tests/thread-mainloop-test.c                  |    2 
 src/tests/thread-test.c                           |   22 +--
 src/tests/utf8-test.c                             |    6 
 src/tests/voltest.c                               |  134 ----------------------
 src/tests/volume-test.c                           |  134 ++++++++++++++++++++++
 30 files changed, 478 insertions(+), 399 deletions(-)

New commits:
commit 6124bf8951fc3788a961e45a201d61894577df82
Author: Frédéric Dalleau <frederic.dalleau at linux.intel.com>
Date:   Tue Oct 4 09:37:27 2011 +0200

    bluetooth: Remove match for org.bluez.MediaTransport.PropertyChanged

diff --git a/src/modules/bluetooth/module-bluetooth-device.c b/src/modules/bluetooth/module-bluetooth-device.c
index 80754be..7992e12 100644
--- a/src/modules/bluetooth/module-bluetooth-device.c
+++ b/src/modules/bluetooth/module-bluetooth-device.c
@@ -3057,6 +3057,7 @@ void pa__done(pa_module *m) {
             mike = pa_sprintf_malloc("type='signal',sender='org.bluez',interface='org.bluez.Headset',member='MicrophoneGainChanged',path='%s'", u->path);
 
             pa_dbus_remove_matches(pa_dbus_connection_get(u->connection), speaker, mike,
+                "type='signal',sender='org.bluez',interface='org.bluez.MediaTransport',member='PropertyChanged'",
                 "type='signal',sender='org.bluez',interface='org.bluez.HandsfreeGateway',member='PropertyChanged'",
                 NULL);
 

commit 12abb05ebdb576b4a10c9f4f5abc4729060b850f
Author: Frédéric Dalleau <frederic.dalleau at linux.intel.com>
Date:   Tue Oct 4 09:37:26 2011 +0200

    bluetooth: Use static string in DBUS signal handler description

diff --git a/src/modules/bluetooth/module-bluetooth-device.c b/src/modules/bluetooth/module-bluetooth-device.c
index 880d581..80754be 100644
--- a/src/modules/bluetooth/module-bluetooth-device.c
+++ b/src/modules/bluetooth/module-bluetooth-device.c
@@ -2895,7 +2895,7 @@ int pa__init(pa_module* m) {
     struct userdata *u;
     const char *address, *path;
     DBusError err;
-    char *mike, *speaker, *transport;
+    char *mike, *speaker;
     const pa_bluetooth_device *device;
 
     pa_assert(m);
@@ -2978,19 +2978,17 @@ int pa__init(pa_module* m) {
 
     speaker = pa_sprintf_malloc("type='signal',sender='org.bluez',interface='org.bluez.Headset',member='SpeakerGainChanged',path='%s'", u->path);
     mike = pa_sprintf_malloc("type='signal',sender='org.bluez',interface='org.bluez.Headset',member='MicrophoneGainChanged',path='%s'", u->path);
-    transport = pa_sprintf_malloc("type='signal',sender='org.bluez',interface='org.bluez.MediaTransport',member='PropertyChanged'");
 
     if (pa_dbus_add_matches(
                 pa_dbus_connection_get(u->connection), &err,
                 speaker,
                 mike,
-                transport,
+                "type='signal',sender='org.bluez',interface='org.bluez.MediaTransport',member='PropertyChanged'",
                 "type='signal',sender='org.bluez',interface='org.bluez.HandsfreeGateway',member='PropertyChanged'",
                 NULL) < 0) {
 
         pa_xfree(speaker);
         pa_xfree(mike);
-        pa_xfree(transport);
 
         pa_log("Failed to add D-Bus matches: %s", err.message);
         goto fail;
@@ -2998,7 +2996,6 @@ int pa__init(pa_module* m) {
 
     pa_xfree(speaker);
     pa_xfree(mike);
-    pa_xfree(transport);
 
     /* Connect to the BT service */
     init_bt(u);

commit 79c836ec6aef05735bce53b91714cf60d0f7e32e
Author: Frédéric Dalleau <frederic.dalleau at linux.intel.com>
Date:   Tue Oct 4 09:37:25 2011 +0200

    bluetooth: Set hfgw profile when HandsfreeGateway is playing
    
    Allow module-bluetooth-device to listens to HandsfreeGateway state
    changes using DBUS signals. When an handsfree connects, module-bluetooth-device
    is loaded and goes to playing state. When the handsfree disconnect audio,
    the card profile is set to "off". If the headset connects audio again after
    that, the card profile should switch to "hfgw" again to match state of audio
    connection.

diff --git a/src/modules/bluetooth/bluetooth-util.c b/src/modules/bluetooth/bluetooth-util.c
index 0054954..2e4d93c 100644
--- a/src/modules/bluetooth/bluetooth-util.c
+++ b/src/modules/bluetooth/bluetooth-util.c
@@ -76,7 +76,7 @@ struct pa_bluetooth_discovery {
 static void get_properties_reply(DBusPendingCall *pending, void *userdata);
 static pa_dbus_pending* send_and_add_to_pending(pa_bluetooth_discovery *y, DBusMessage *m, DBusPendingCallNotifyFunction func, void *call_data);
 
-static pa_bt_audio_state_t pa_bt_audio_state_from_string(const char* value) {
+pa_bt_audio_state_t pa_bt_audio_state_from_string(const char* value) {
     pa_assert(value);
 
     if (pa_streq(value, "disconnected"))
diff --git a/src/modules/bluetooth/bluetooth-util.h b/src/modules/bluetooth/bluetooth-util.h
index 248ca47..2752a69 100644
--- a/src/modules/bluetooth/bluetooth-util.h
+++ b/src/modules/bluetooth/bluetooth-util.h
@@ -138,5 +138,6 @@ const char* pa_bluetooth_get_form_factor(uint32_t class);
 char *pa_bluetooth_cleanup_name(const char *name);
 
 pa_bool_t pa_bluetooth_uuid_has(pa_bluetooth_uuid *uuids, const char *uuid);
+pa_bt_audio_state_t pa_bt_audio_state_from_string(const char* value);
 
 #endif
diff --git a/src/modules/bluetooth/module-bluetooth-device.c b/src/modules/bluetooth/module-bluetooth-device.c
index d90f779..880d581 100644
--- a/src/modules/bluetooth/module-bluetooth-device.c
+++ b/src/modules/bluetooth/module-bluetooth-device.c
@@ -1834,6 +1834,56 @@ static DBusHandlerResult filter_cb(DBusConnection *bus, DBusMessage *m, void *us
             pa_log_debug("dbus: property 'NREC' changed to value '%s'", t->nrec ? "True" : "False");
             pa_proplist_sets(u->source->proplist, "bluetooth.nrec", t->nrec ? "1" : "0");
         }
+    } else if (dbus_message_is_signal(m, "org.bluez.HandsfreeGateway", "PropertyChanged")) {
+        const char *key;
+        DBusMessageIter iter;
+        DBusMessageIter variant;
+        pa_bt_audio_state_t state = PA_BT_AUDIO_STATE_INVALID;
+
+        if (!dbus_message_iter_init(m, &iter)) {
+            pa_log("Failed to parse PropertyChanged: %s", err.message);
+            goto fail;
+        }
+
+        if (dbus_message_iter_get_arg_type(&iter) != DBUS_TYPE_STRING) {
+            pa_log("Property name not a string.");
+            goto fail;
+        }
+
+        dbus_message_iter_get_basic(&iter, &key);
+
+        if (!dbus_message_iter_next(&iter)) {
+            pa_log("Property value missing");
+            goto fail;
+        }
+
+        dbus_message_iter_recurse(&iter, &variant);
+
+        if (dbus_message_iter_get_arg_type(&variant) == DBUS_TYPE_STRING) {
+            const char *value;
+            dbus_message_iter_get_basic(&variant, &value);
+
+            if (pa_streq(key, "State")) {
+                pa_log_debug("dbus: HSHFAG property 'State' changed to value '%s'", value);
+                state = pa_bt_audio_state_from_string(value);
+            }
+        }
+
+        switch(state) {
+            case PA_BT_AUDIO_STATE_INVALID:
+            case PA_BT_AUDIO_STATE_DISCONNECTED:
+            case PA_BT_AUDIO_STATE_CONNECTED:
+            case PA_BT_AUDIO_STATE_CONNECTING:
+                goto fail;
+
+            case PA_BT_AUDIO_STATE_PLAYING:
+                if (u->card) {
+                    pa_log_debug("Changing profile to hfgw");
+                    if (pa_card_set_profile(u->card, "hfgw", FALSE) < 0)
+                        pa_log("Failed to change profile to hfgw");
+                }
+                break;
+        }
     }
 
 fail:
@@ -2935,6 +2985,7 @@ int pa__init(pa_module* m) {
                 speaker,
                 mike,
                 transport,
+                "type='signal',sender='org.bluez',interface='org.bluez.HandsfreeGateway',member='PropertyChanged'",
                 NULL) < 0) {
 
         pa_xfree(speaker);
@@ -3008,7 +3059,9 @@ void pa__done(pa_module *m) {
             speaker = pa_sprintf_malloc("type='signal',sender='org.bluez',interface='org.bluez.Headset',member='SpeakerGainChanged',path='%s'", u->path);
             mike = pa_sprintf_malloc("type='signal',sender='org.bluez',interface='org.bluez.Headset',member='MicrophoneGainChanged',path='%s'", u->path);
 
-            pa_dbus_remove_matches(pa_dbus_connection_get(u->connection), speaker, mike, NULL);
+            pa_dbus_remove_matches(pa_dbus_connection_get(u->connection), speaker, mike,
+                "type='signal',sender='org.bluez',interface='org.bluez.HandsfreeGateway',member='PropertyChanged'",
+                NULL);
 
             pa_xfree(speaker);
             pa_xfree(mike);

commit 2f24a6e62770b13f1e21445abc5187285921b865
Author: Frédéric Dalleau <frederic.dalleau at linux.intel.com>
Date:   Tue Oct 4 09:37:24 2011 +0200

    bluetooth: Set off profile on SCO disconnect
    
    Sends a message from IO thread to main thread using pa_msgobject when POLLERR
    or POLLHUP is received on SCO socket.

diff --git a/src/modules/bluetooth/module-bluetooth-device.c b/src/modules/bluetooth/module-bluetooth-device.c
index 4d1969b..d90f779 100644
--- a/src/modules/bluetooth/module-bluetooth-device.c
+++ b/src/modules/bluetooth/module-bluetooth-device.c
@@ -126,6 +126,15 @@ struct hsp_info {
     pa_hook_slot *source_state_changed_slot;
 };
 
+struct bluetooth_msg {
+    pa_msgobject parent;
+    pa_card *card;
+};
+
+typedef struct bluetooth_msg bluetooth_msg;
+PA_DEFINE_PRIVATE_CLASS(bluetooth_msg, pa_msgobject);
+#define BLUETOOTH_MSG(o) (bluetooth_msg_cast(o))
+
 struct userdata {
     pa_core *core;
     pa_module *module;
@@ -148,6 +157,7 @@ struct userdata {
     pa_rtpoll *rtpoll;
     pa_rtpoll_item *rtpoll_item;
     pa_thread *thread;
+    bluetooth_msg *msg;
 
     uint64_t read_index, write_index;
     pa_usec_t started_at;
@@ -176,6 +186,11 @@ struct userdata {
     pa_bool_t filter_added;
 };
 
+enum {
+    BLUETOOTH_MESSAGE_SET_PROFILE,
+    BLUETOOTH_MESSAGE_MAX
+};
+
 #define FIXED_LATENCY_PLAYBACK_A2DP (25*PA_USEC_PER_MSEC)
 #define FIXED_LATENCY_RECORD_A2DP (25*PA_USEC_PER_MSEC)
 #define FIXED_LATENCY_PLAYBACK_HSP (125*PA_USEC_PER_MSEC)
@@ -1115,6 +1130,23 @@ static int source_process_msg(pa_msgobject *o, int code, void *data, int64_t off
     return (r < 0 || !failed) ? r : -1;
 }
 
+/* Called from main thread context */
+static int device_process_msg(pa_msgobject *obj, int code, void *data, int64_t offset, pa_memchunk *chunk) {
+    struct bluetooth_msg *u = BLUETOOTH_MSG(obj);
+
+    switch (code) {
+        case BLUETOOTH_MESSAGE_SET_PROFILE: {
+            const char *profile = data;
+            pa_log_debug("Switch profile to %s requested", profile);
+
+            if (pa_card_set_profile(u->card, profile, FALSE) < 0)
+                pa_log_debug("Failed to switch profile to %s", profile);
+            break;
+        }
+    }
+    return 0;
+}
+
 /* Run from IO thread */
 static int hsp_process_render(struct userdata *u) {
     int ret = 0;
@@ -1721,6 +1753,7 @@ static void thread_func(void *userdata) {
 fail:
     /* If this was no regular exit from the loop we have to continue processing messages until we receive PA_MESSAGE_SHUTDOWN */
     pa_log_debug("IO thread failed");
+    pa_asyncmsgq_post(pa_thread_mq_get()->outq, PA_MSGOBJECT(u->msg), BLUETOOTH_MESSAGE_SET_PROFILE, "off", 0, NULL, NULL);
     pa_asyncmsgq_wait_for(u->thread_mq.inq, PA_MESSAGE_SHUTDOWN);
 
 finish:
@@ -2881,6 +2914,12 @@ int pa__init(pa_module* m) {
     if (add_card(u, device) < 0)
         goto fail;
 
+    if (!(u->msg = pa_msgobject_new(bluetooth_msg)))
+        goto fail;
+
+    u->msg->parent.process_msg = device_process_msg;
+    u->msg->card = u->card;
+
     if (!dbus_connection_add_filter(pa_dbus_connection_get(u->connection), filter_cb, u, NULL)) {
         pa_log_error("Failed to add filter function");
         goto fail;
@@ -2981,6 +3020,9 @@ void pa__done(pa_module *m) {
         pa_dbus_connection_unref(u->connection);
     }
 
+    if (u->msg)
+        pa_xfree(u->msg);
+
     if (u->card)
         pa_card_free(u->card);
 

commit 2c213607e2dad22cb0cd16ecbaa13a763758cb13
Author: Frédéric Dalleau <frederic.dalleau at linux.intel.com>
Date:   Tue Oct 4 09:37:23 2011 +0200

    bluetooth: Release MediaEnpoint if card profile is set to Off
    
    If card profile is set to "off", the audio stream should be released.
    Current implementation releases the stream when the card profile
    is changed to "hsp" or "hfgw" again and immediatly reconnects after that.

diff --git a/src/modules/bluetooth/module-bluetooth-device.c b/src/modules/bluetooth/module-bluetooth-device.c
index 81abcd6..4d1969b 100644
--- a/src/modules/bluetooth/module-bluetooth-device.c
+++ b/src/modules/bluetooth/module-bluetooth-device.c
@@ -2564,6 +2564,13 @@ static int card_set_profile(pa_card *c, pa_card_profile *new_profile) {
     }
 
     stop_thread(u);
+
+    if (u->profile != PROFILE_OFF && u->transport) {
+        bt_transport_release(u);
+        pa_xfree(u->transport);
+        u->transport = NULL;
+    }
+
     shutdown_bt(u);
 
     if (USE_SCO_OVER_PCM(u))

commit 54f3b9a6fa47b618a31474d3786ed26248d3091d
Author: Frédéric Dalleau <frederic.dalleau at linux.intel.com>
Date:   Tue Oct 4 09:37:22 2011 +0200

    bluetooth: Do not unload module-bluetooth-device on ERR or HUP
    
    This happens in the following scenario :
    An HandsfreeGateway connects RFCOMM and then SCO. A card appears in
    PA and can be used. If for some reason, SCO is disconnected,
    module-bluetooth-device is unloaded. The card will disappear, even
    if RFCOMM is still connected. After that, it is not possible to
    connect SCO again from PA.

diff --git a/src/modules/bluetooth/module-bluetooth-device.c b/src/modules/bluetooth/module-bluetooth-device.c
index ac76a19..81abcd6 100644
--- a/src/modules/bluetooth/module-bluetooth-device.c
+++ b/src/modules/bluetooth/module-bluetooth-device.c
@@ -1721,7 +1721,6 @@ static void thread_func(void *userdata) {
 fail:
     /* If this was no regular exit from the loop we have to continue processing messages until we receive PA_MESSAGE_SHUTDOWN */
     pa_log_debug("IO thread failed");
-    pa_asyncmsgq_post(u->thread_mq.outq, PA_MSGOBJECT(u->core), PA_CORE_MESSAGE_UNLOAD_MODULE, u->module, 0, NULL, NULL);
     pa_asyncmsgq_wait_for(u->thread_mq.inq, PA_MESSAGE_SHUTDOWN);
 
 finish:

commit 3f6aa0391239fcbc54bd8d882e95b12d001664a7
Author: Frédéric Dalleau <frederic.dalleau at linux.intel.com>
Date:   Tue Oct 4 09:37:21 2011 +0200

    bluetooth: Fix Media Endpoint for HandsfreeGateway
    
    This patch will add the necessary quirks so that pulseaudio can register
    an endpoint on the /MediaEndpoint/HFPHS path. This endpoint is to be
    used for HFP Handsfree profile.

diff --git a/src/modules/bluetooth/bluetooth-util.c b/src/modules/bluetooth/bluetooth-util.c
index 1c93ca9..0054954 100644
--- a/src/modules/bluetooth/bluetooth-util.c
+++ b/src/modules/bluetooth/bluetooth-util.c
@@ -34,6 +34,7 @@
 #include "a2dp-codecs.h"
 
 #define HFP_AG_ENDPOINT "/MediaEndpoint/HFPAG"
+#define HFP_HS_ENDPOINT "/MediaEndpoint/HFPHS"
 #define A2DP_SOURCE_ENDPOINT "/MediaEndpoint/A2DPSource"
 #define A2DP_SINK_ENDPOINT "/MediaEndpoint/A2DPSink"
 
@@ -628,7 +629,7 @@ static void register_endpoint(pa_bluetooth_discovery *y, const char *path, const
 
     pa_dbus_append_basic_variant_dict_entry(&d, "Codec", DBUS_TYPE_BYTE, &codec);
 
-    if (pa_streq(uuid, HFP_AG_UUID)) {
+    if (pa_streq(uuid, HFP_AG_UUID) || pa_streq(uuid, HFP_HS_UUID)) {
         uint8_t capability = 0;
         pa_dbus_append_basic_array_variant_dict_entry(&d, "Capabilities", DBUS_TYPE_BYTE, &capability, 1);
     } else {
@@ -660,6 +661,7 @@ static void found_adapter(pa_bluetooth_discovery *y, const char *path) {
     send_and_add_to_pending(y, m, list_devices_reply, NULL);
 
     register_endpoint(y, path, HFP_AG_ENDPOINT, HFP_AG_UUID);
+    register_endpoint(y, path, HFP_HS_ENDPOINT, HFP_HS_UUID);
     register_endpoint(y, path, A2DP_SOURCE_ENDPOINT, A2DP_SOURCE_UUID);
     register_endpoint(y, path, A2DP_SINK_ENDPOINT, A2DP_SINK_UUID);
 }
@@ -1158,6 +1160,8 @@ static DBusMessage *endpoint_set_configuration(DBusConnection *conn, DBusMessage
 
     if (dbus_message_has_path(m, HFP_AG_ENDPOINT))
         p = PROFILE_HSP;
+    else if (dbus_message_has_path(m, HFP_HS_ENDPOINT))
+        p = PROFILE_HFGW;
     else if (dbus_message_has_path(m, A2DP_SOURCE_ENDPOINT))
         p = PROFILE_A2DP;
     else
@@ -1288,7 +1292,7 @@ static DBusMessage *endpoint_select_configuration(DBusConnection *c, DBusMessage
         goto fail;
     }
 
-    if (dbus_message_has_path(m, HFP_AG_ENDPOINT))
+    if (dbus_message_has_path(m, HFP_AG_ENDPOINT) || dbus_message_has_path(m, HFP_HS_ENDPOINT))
         goto done;
 
     pa_assert(size == sizeof(config));
@@ -1401,7 +1405,7 @@ static DBusHandlerResult endpoint_handler(DBusConnection *c, DBusMessage *m, voi
     path = dbus_message_get_path(m);
     dbus_error_init(&e);
 
-    if (!pa_streq(path, A2DP_SOURCE_ENDPOINT) && !pa_streq(path, A2DP_SINK_ENDPOINT) && !pa_streq(path, HFP_AG_ENDPOINT))
+    if (!pa_streq(path, A2DP_SOURCE_ENDPOINT) && !pa_streq(path, A2DP_SINK_ENDPOINT) && !pa_streq(path, HFP_AG_ENDPOINT) && !pa_streq(path, HFP_HS_ENDPOINT))
         return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
 
     if (dbus_message_is_method_call(m, "org.freedesktop.DBus.Introspectable", "Introspect")) {
@@ -1482,6 +1486,7 @@ pa_bluetooth_discovery* pa_bluetooth_discovery_get(pa_core *c) {
     }
 
     pa_assert_se(dbus_connection_register_object_path(pa_dbus_connection_get(y->connection), HFP_AG_ENDPOINT, &vtable_endpoint, y));
+    pa_assert_se(dbus_connection_register_object_path(pa_dbus_connection_get(y->connection), HFP_HS_ENDPOINT, &vtable_endpoint, y));
     pa_assert_se(dbus_connection_register_object_path(pa_dbus_connection_get(y->connection), A2DP_SOURCE_ENDPOINT, &vtable_endpoint, y));
     pa_assert_se(dbus_connection_register_object_path(pa_dbus_connection_get(y->connection), A2DP_SINK_ENDPOINT, &vtable_endpoint, y));
 
@@ -1524,6 +1529,7 @@ void pa_bluetooth_discovery_unref(pa_bluetooth_discovery *y) {
 
     if (y->connection) {
         dbus_connection_unregister_object_path(pa_dbus_connection_get(y->connection), HFP_AG_ENDPOINT);
+        dbus_connection_unregister_object_path(pa_dbus_connection_get(y->connection), HFP_HS_ENDPOINT);
         dbus_connection_unregister_object_path(pa_dbus_connection_get(y->connection), A2DP_SOURCE_ENDPOINT);
         dbus_connection_unregister_object_path(pa_dbus_connection_get(y->connection), A2DP_SINK_ENDPOINT);
         pa_dbus_remove_matches(pa_dbus_connection_get(y->connection),
diff --git a/src/modules/bluetooth/module-bluetooth-device.c b/src/modules/bluetooth/module-bluetooth-device.c
index efbc144..ac76a19 100644
--- a/src/modules/bluetooth/module-bluetooth-device.c
+++ b/src/modules/bluetooth/module-bluetooth-device.c
@@ -2545,7 +2545,7 @@ static int card_set_profile(pa_card *c, pa_card_profile *new_profile) {
         pa_log_warn("A2DP is not connected, refused to switch profile");
         return -PA_ERR_IO;
     }
-    else if (device->hfgw_state <= PA_BT_AUDIO_STATE_CONNECTED && *d == PROFILE_HFGW) {
+    else if (device->hfgw_state < PA_BT_AUDIO_STATE_CONNECTED && *d == PROFILE_HFGW) {
         pa_log_warn("HandsfreeGateway is not connected, refused to switch profile");
         return -PA_ERR_IO;
     }
diff --git a/src/modules/bluetooth/module-bluetooth-discover.c b/src/modules/bluetooth/module-bluetooth-discover.c
index 7b27f6b..e96a4f3 100644
--- a/src/modules/bluetooth/module-bluetooth-discover.c
+++ b/src/modules/bluetooth/module-bluetooth-discover.c
@@ -77,7 +77,7 @@ static pa_hook_result_t load_module_for_device(pa_bluetooth_discovery *y, const
     if (!d->dead && d->device_connected > 0 &&
         (d->audio_state >= PA_BT_AUDIO_STATE_CONNECTED ||
          d->audio_source_state >= PA_BT_AUDIO_STATE_CONNECTED ||
-         d->hfgw_state > PA_BT_AUDIO_STATE_CONNECTED)) {
+         d->hfgw_state >= PA_BT_AUDIO_STATE_CONNECTED)) {
 
         if (!mi) {
             pa_module *m = NULL;
@@ -110,7 +110,7 @@ static pa_hook_result_t load_module_for_device(pa_bluetooth_discovery *y, const
             if (d->audio_source_state >= PA_BT_AUDIO_STATE_CONNECTED)
                 args = pa_sprintf_malloc("%s profile=\"a2dp_source\" auto_connect=no", args);
 
-            if (d->hfgw_state > PA_BT_AUDIO_STATE_CONNECTED)
+            if (d->hfgw_state >= PA_BT_AUDIO_STATE_CONNECTED)
                 args = pa_sprintf_malloc("%s profile=\"hfgw\"", args);
 
             pa_log_debug("Loading module-bluetooth-device %s", args);

commit 041f255c9d8a9cf937453b0eb721811a84d6597b
Author: Arun Raghavan <arun.raghavan at collabora.co.uk>
Date:   Wed Nov 2 19:40:15 2011 +0530

    doc: Fix some old 0pointer.de references

diff --git a/README b/README
index 10debd4..32d1aea 100644
--- a/README
+++ b/README
@@ -13,7 +13,7 @@ MAILING LIST:
 	http://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss
 
 GIT COMMITS MAILING LIST:
-	https://tango.0pointer.de/mailman/listinfo/pulseaudio-commits
+	http://lists.freedesktop.org/mailman/listinfo/pulseaudio-commits
 
 TRAC/BUGZILLA TICKET CHANGES MAILING LIST:
 	http://lists.freedesktop.org/mailman/listinfo/pulseaudio-bugs
diff --git a/configure.ac b/configure.ac
index b6c9625..324e32e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -22,7 +22,7 @@
 
 AC_PREREQ(2.63)
 
-AC_INIT([pulseaudio],[m4_esyscmd(./git-version-gen .tarball-version)],[mzchyfrnhqvb (at) 0pointer (dot) net],[pulseaudio],[http://pulseaudio.org/])
+AC_INIT([pulseaudio],[m4_esyscmd(./git-version-gen .tarball-version)],[pulseaudio-discuss (at) lists (dot) freedesktop (dot) org],[pulseaudio],[http://pulseaudio.org/])
 AC_CONFIG_SRCDIR([src/daemon/main.c])
 AC_CONFIG_MACRO_DIR([m4])
 AC_CONFIG_HEADERS([config.h])

commit bca44b770026e8ba3d81da8dd93b26ea2437ba7b
Author: Maarten Bosmans <mkbosmans at gmail.com>
Date:   Tue Oct 4 14:12:20 2011 +0200

    tests: Revisit which tests to run with make check
    
    Some tests (remix-test, sig2str) only display information, so they are not
    useful for automated testing.  Others (interpol-test, once-test, thread-test)
    do return an error on failure, so should be included in TESTS.

diff --git a/src/Makefile.am b/src/Makefile.am
index 94b12be..edeb6e3 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -233,12 +233,11 @@ TESTS = \
 		asyncmsgq-test \
 		queue-test \
 		rtpoll-test \
-		sig2str-test \
 		resampler-test \
 		smoother-test \
+		thread-test \
 		volume-test \
 		mix-test \
-		remix-test \
 		proplist-test \
 		lock-autospawn-test \
 		prioq-test
@@ -250,9 +249,10 @@ TESTS_norun = \
 		extended-test \
 		sync-playback \
 		interpol-test \
-		thread-test \
 		flist-test \
+		remix-test \
 		rtstutter \
+		sig2str-test \
 		stripnul \
 		connect-stress \
 		echo-cancel-test
@@ -264,7 +264,7 @@ TESTS += \
 endif
 
 if !OS_IS_DARWIN
-TESTS_norun += \
+TESTS += \
 		once-test
 endif
 

commit 07dd717bc03b4234348a237f63cd51015de8216c
Author: Maarten Bosmans <mkbosmans at gmail.com>
Date:   Tue Oct 4 14:08:05 2011 +0200

    tests: Rename voltest to volume-test

diff --git a/src/.gitignore b/src/.gitignore
index 51a1452..e7e5880 100644
--- a/src/.gitignore
+++ b/src/.gitignore
@@ -1,11 +1,4 @@
-once-test
-usergroup-test
-sigbus-test
 TAGS
-alsa-time-test
-gtk-test
-prioq-test
-lock-autospawn-test
 *.lo
 *.o
 *.la
@@ -13,46 +6,60 @@ lock-autospawn-test
 .libs
 Makefile
 Makefile.in
-asyncmsgq-test
-asyncq-test
 proximity-helper
-channelmap-test
 client.conf
-close-test
-cpulimit-test
-cpulimit-test2
 daemon.conf
 default.pa
 echo-cancel-test
 esdcompat
-flist-test
 gconf-helper
+pacat
+pacmd
+pactl
+paplay
+pasuspender
+pax11publish
+pulseaudio
+start-pulseaudio-x11
+start-pulseaudio-kde
+*-symdef.h
+*-orc-gen.[ch]
+# tests
+alsa-time-test
+asyncmsgq-test
+asyncq-test
+channelmap-test
+close-test
+connect-stress
+cpulimit-test
+cpulimit-test2
+extended-test
+flist-test
+format-test
 get-binary-name-test
+gtk-test
 hook-list-test
 interpol-test
 ipacl-test
+lock-autospawn-test
 mainloop-test
 mainloop-test-glib
 mcalign-test
-memblock-test
 memblockq-test
+memblock-test
 mix-test
-pacat
+once-test
 pacat-simple
-pacmd
-pactl
-paplay
 parec-simple
-pasuspender
-pax11publish
+prioq-test
 proplist-test
-pulseaudio
 queue-test
 remix-test
 resampler-test
 rtpoll-test
 rtstutter
 sig2str-test
+sigbus-test
 smoother-test
 stripnul
 strlist-test
@@ -60,13 +67,7 @@ sync-playback
 system.pa
 thread-mainloop-test
 thread-test
+usergroup-test
 utf8-test
-voltest
-start-pulseaudio-x11
-start-pulseaudio-kde
 vector-test
-*-symdef.h
-connect-stress
-extended-test
-format-test
-*-orc-gen.[ch]
+volume-test
diff --git a/src/Makefile.am b/src/Makefile.am
index 23e6203..94b12be 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -219,7 +219,6 @@ TESTS = \
 		mainloop-test \
 		strlist-test \
 		close-test \
-		voltest \
 		vector-test \
 		memblockq-test \
 		channelmap-test \
@@ -237,6 +236,7 @@ TESTS = \
 		sig2str-test \
 		resampler-test \
 		smoother-test \
+		volume-test \
 		mix-test \
 		remix-test \
 		proplist-test \
@@ -402,10 +402,10 @@ close_test_CFLAGS = $(AM_CFLAGS)
 close_test_LDADD = $(AM_LDADD) $(WINSOCK_LIBS) libpulsecore- at PA_MAJORMINOR@.la libpulse.la libpulsecommon- at PA_MAJORMINOR@.la
 close_test_LDFLAGS = $(AM_LDFLAGS) $(BINLDFLAGS)
 
-voltest_SOURCES = tests/voltest.c
-voltest_CFLAGS = $(AM_CFLAGS)
-voltest_LDADD = $(AM_LDADD) libpulse.la libpulsecommon- at PA_MAJORMINOR@.la
-voltest_LDFLAGS = $(AM_LDFLAGS) $(BINLDFLAGS)
+volume_test_SOURCES = tests/volume-test.c
+volume_test_CFLAGS = $(AM_CFLAGS)
+volume_test_LDADD = $(AM_LDADD) libpulse.la libpulsecommon- at PA_MAJORMINOR@.la
+volume_test_LDFLAGS = $(AM_LDFLAGS) $(BINLDFLAGS)
 
 vector_test_SOURCES = tests/vector-test.c
 vector_test_CFLAGS = $(AM_CFLAGS)
diff --git a/src/tests/voltest.c b/src/tests/voltest.c
deleted file mode 100644
index f7405ff..0000000
--- a/src/tests/voltest.c
+++ /dev/null
@@ -1,134 +0,0 @@
-/***
-  This file is part of PulseAudio.
-
-  PulseAudio is free software; you can redistribute it and/or modify
-  it under the terms of the GNU Lesser General Public License as published
-  by the Free Software Foundation; either version 2.1 of the License,
-  or (at your option) any later version.
-
-  PulseAudio is distributed in the hope that it will be useful, but
-  WITHOUT ANY WARRANTY; without even the implied warranty of
-  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-  General Public License for more details.
-
-  You should have received a copy of the GNU Lesser General Public License
-  along with PulseAudio; if not, write to the Free Software
-  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-  USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <stdio.h>
-#include <math.h>
-
-#include <pulse/volume.h>
-
-#include <pulsecore/log.h>
-#include <pulsecore/macro.h>
-
-int main(int argc, char *argv[]) {
-    pa_volume_t v;
-    pa_cvolume cv;
-    float b;
-    pa_channel_map map;
-    pa_volume_t md = 0;
-    unsigned mdn = 0;
-
-    if (!getenv("MAKE_CHECK"))
-        pa_log_set_level(PA_LOG_DEBUG);
-
-    pa_log("Attenuation of sample 1 against 32767: %g dB", 20.0*log10(1.0/32767.0));
-    pa_log("Smallest possible attenuation > 0 applied to 32767: %li", lrint(32767.0*pa_sw_volume_to_linear(1)));
-
-    for (v = PA_VOLUME_MUTED; v <= PA_VOLUME_NORM*2; v += 256) {
-
-        double dB = pa_sw_volume_to_dB(v);
-        double f = pa_sw_volume_to_linear(v);
-
-        pa_log_debug("Volume: %3i; percent: %i%%; decibel %0.2f; linear = %0.2f; volume(decibel): %3i; volume(linear): %3i",
-               v, (v*100)/PA_VOLUME_NORM, dB, f, pa_sw_volume_from_dB(dB), pa_sw_volume_from_linear(f));
-    }
-
-    for (v = PA_VOLUME_MUTED; v <= PA_VOLUME_NORM*2; v += 256) {
-        char s[PA_CVOLUME_SNPRINT_MAX], t[PA_SW_CVOLUME_SNPRINT_DB_MAX];
-
-        pa_cvolume_set(&cv, 2, v);
-
-        pa_log_debug("Volume: %3i [%s] [%s]", v, pa_cvolume_snprint(s, sizeof(s), &cv), pa_sw_cvolume_snprint_dB(t, sizeof(t), &cv));
-    }
-
-    map.channels = cv.channels = 2;
-    map.map[0] = PA_CHANNEL_POSITION_LEFT;
-    map.map[1] = PA_CHANNEL_POSITION_RIGHT;
-
-    for (cv.values[0] = PA_VOLUME_MUTED; cv.values[0] <= PA_VOLUME_NORM*2; cv.values[0] += 4096)
-        for (cv.values[1] = PA_VOLUME_MUTED; cv.values[1] <= PA_VOLUME_NORM*2; cv.values[1] += 4096) {
-            char s[PA_CVOLUME_SNPRINT_MAX];
-
-            pa_log_debug("Volume: [%s]; balance: %2.1f", pa_cvolume_snprint(s, sizeof(s), &cv), pa_cvolume_get_balance(&cv, &map));
-        }
-
-    for (cv.values[0] = PA_VOLUME_MUTED+4096; cv.values[0] <= PA_VOLUME_NORM*2; cv.values[0] += 4096)
-        for (cv.values[1] = PA_VOLUME_MUTED; cv.values[1] <= PA_VOLUME_NORM*2; cv.values[1] += 4096)
-            for (b = -1.0f; b <= 1.0f; b += 0.2f) {
-                char s[PA_CVOLUME_SNPRINT_MAX];
-                pa_cvolume r;
-                float k;
-
-                pa_log_debug("Before: volume: [%s]; balance: %2.1f", pa_cvolume_snprint(s, sizeof(s), &cv), pa_cvolume_get_balance(&cv, &map));
-
-                r = cv;
-                pa_cvolume_set_balance(&r, &map,b);
-
-                k = pa_cvolume_get_balance(&r, &map);
-                pa_log_debug("After: volume: [%s]; balance: %2.1f (intended: %2.1f) %s", pa_cvolume_snprint(s, sizeof(s), &r), k, b, k < b-.05 || k > b+.5 ? "MISMATCH" : "");
-            }
-
-    for (v = PA_VOLUME_MUTED; v <= PA_VOLUME_NORM*2; v += 51) {
-
-        double l = pa_sw_volume_to_linear(v);
-        pa_volume_t k = pa_sw_volume_from_linear(l);
-        double db = pa_sw_volume_to_dB(v);
-        pa_volume_t r = pa_sw_volume_from_dB(db);
-        pa_volume_t w;
-
-        pa_assert(k == v);
-        pa_assert(r == v);
-
-        for (w = PA_VOLUME_MUTED; w < PA_VOLUME_NORM*2; w += 37) {
-
-            double t = pa_sw_volume_to_linear(w);
-            double db2 = pa_sw_volume_to_dB(w);
-            pa_volume_t p, p1, p2;
-            double q, qq;
-
-            p = pa_sw_volume_multiply(v, w);
-            qq = db + db2;
-            p2 = pa_sw_volume_from_dB(qq);
-            q = l*t;
-            p1 = pa_sw_volume_from_linear(q);
-
-            if (p2 > p && p2 - p > md)
-                md = p2 - p;
-            if (p2 < p && p - p2 > md)
-                md = p - p2;
-            if (p1 > p && p1 - p > md)
-                md = p1 - p;
-            if (p1 < p && p - p1 > md)
-                md = p - p1;
-
-            if (p1 != p || p2 != p)
-                mdn++;
-        }
-    }
-
-    pa_log("max deviation: %lu n=%lu", (unsigned long) md, (unsigned long) mdn);
-
-    pa_assert(md <= 1);
-    pa_assert(mdn <= 251);
-
-    return 0;
-}
diff --git a/src/tests/volume-test.c b/src/tests/volume-test.c
new file mode 100644
index 0000000..f7405ff
--- /dev/null
+++ b/src/tests/volume-test.c
@@ -0,0 +1,134 @@
+/***
+  This file is part of PulseAudio.
+
+  PulseAudio is free software; you can redistribute it and/or modify
+  it under the terms of the GNU Lesser General Public License as published
+  by the Free Software Foundation; either version 2.1 of the License,
+  or (at your option) any later version.
+
+  PulseAudio is distributed in the hope that it will be useful, but
+  WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+  General Public License for more details.
+
+  You should have received a copy of the GNU Lesser General Public License
+  along with PulseAudio; if not, write to the Free Software
+  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+  USA.
+***/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <stdio.h>
+#include <math.h>
+
+#include <pulse/volume.h>
+
+#include <pulsecore/log.h>
+#include <pulsecore/macro.h>
+
+int main(int argc, char *argv[]) {
+    pa_volume_t v;
+    pa_cvolume cv;
+    float b;
+    pa_channel_map map;
+    pa_volume_t md = 0;
+    unsigned mdn = 0;
+
+    if (!getenv("MAKE_CHECK"))
+        pa_log_set_level(PA_LOG_DEBUG);
+
+    pa_log("Attenuation of sample 1 against 32767: %g dB", 20.0*log10(1.0/32767.0));
+    pa_log("Smallest possible attenuation > 0 applied to 32767: %li", lrint(32767.0*pa_sw_volume_to_linear(1)));
+
+    for (v = PA_VOLUME_MUTED; v <= PA_VOLUME_NORM*2; v += 256) {
+
+        double dB = pa_sw_volume_to_dB(v);
+        double f = pa_sw_volume_to_linear(v);
+
+        pa_log_debug("Volume: %3i; percent: %i%%; decibel %0.2f; linear = %0.2f; volume(decibel): %3i; volume(linear): %3i",
+               v, (v*100)/PA_VOLUME_NORM, dB, f, pa_sw_volume_from_dB(dB), pa_sw_volume_from_linear(f));
+    }
+
+    for (v = PA_VOLUME_MUTED; v <= PA_VOLUME_NORM*2; v += 256) {
+        char s[PA_CVOLUME_SNPRINT_MAX], t[PA_SW_CVOLUME_SNPRINT_DB_MAX];
+
+        pa_cvolume_set(&cv, 2, v);
+
+        pa_log_debug("Volume: %3i [%s] [%s]", v, pa_cvolume_snprint(s, sizeof(s), &cv), pa_sw_cvolume_snprint_dB(t, sizeof(t), &cv));
+    }
+
+    map.channels = cv.channels = 2;
+    map.map[0] = PA_CHANNEL_POSITION_LEFT;
+    map.map[1] = PA_CHANNEL_POSITION_RIGHT;
+
+    for (cv.values[0] = PA_VOLUME_MUTED; cv.values[0] <= PA_VOLUME_NORM*2; cv.values[0] += 4096)
+        for (cv.values[1] = PA_VOLUME_MUTED; cv.values[1] <= PA_VOLUME_NORM*2; cv.values[1] += 4096) {
+            char s[PA_CVOLUME_SNPRINT_MAX];
+
+            pa_log_debug("Volume: [%s]; balance: %2.1f", pa_cvolume_snprint(s, sizeof(s), &cv), pa_cvolume_get_balance(&cv, &map));
+        }
+
+    for (cv.values[0] = PA_VOLUME_MUTED+4096; cv.values[0] <= PA_VOLUME_NORM*2; cv.values[0] += 4096)
+        for (cv.values[1] = PA_VOLUME_MUTED; cv.values[1] <= PA_VOLUME_NORM*2; cv.values[1] += 4096)
+            for (b = -1.0f; b <= 1.0f; b += 0.2f) {
+                char s[PA_CVOLUME_SNPRINT_MAX];
+                pa_cvolume r;
+                float k;
+
+                pa_log_debug("Before: volume: [%s]; balance: %2.1f", pa_cvolume_snprint(s, sizeof(s), &cv), pa_cvolume_get_balance(&cv, &map));
+
+                r = cv;
+                pa_cvolume_set_balance(&r, &map,b);
+
+                k = pa_cvolume_get_balance(&r, &map);
+                pa_log_debug("After: volume: [%s]; balance: %2.1f (intended: %2.1f) %s", pa_cvolume_snprint(s, sizeof(s), &r), k, b, k < b-.05 || k > b+.5 ? "MISMATCH" : "");
+            }
+
+    for (v = PA_VOLUME_MUTED; v <= PA_VOLUME_NORM*2; v += 51) {
+
+        double l = pa_sw_volume_to_linear(v);
+        pa_volume_t k = pa_sw_volume_from_linear(l);
+        double db = pa_sw_volume_to_dB(v);
+        pa_volume_t r = pa_sw_volume_from_dB(db);
+        pa_volume_t w;
+
+        pa_assert(k == v);
+        pa_assert(r == v);
+
+        for (w = PA_VOLUME_MUTED; w < PA_VOLUME_NORM*2; w += 37) {
+
+            double t = pa_sw_volume_to_linear(w);
+            double db2 = pa_sw_volume_to_dB(w);
+            pa_volume_t p, p1, p2;
+            double q, qq;
+
+            p = pa_sw_volume_multiply(v, w);
+            qq = db + db2;
+            p2 = pa_sw_volume_from_dB(qq);
+            q = l*t;
+            p1 = pa_sw_volume_from_linear(q);
+
+            if (p2 > p && p2 - p > md)
+                md = p2 - p;
+            if (p2 < p && p - p2 > md)
+                md = p - p2;
+            if (p1 > p && p1 - p > md)
+                md = p1 - p;
+            if (p1 < p && p - p1 > md)
+                md = p - p1;
+
+            if (p1 != p || p2 != p)
+                mdn++;
+        }
+    }
+
+    pa_log("max deviation: %lu n=%lu", (unsigned long) md, (unsigned long) mdn);
+
+    pa_assert(md <= 1);
+    pa_assert(mdn <= 251);
+
+    return 0;
+}

commit 681aaf7a9a3eaa9e087b276ca1b52a2964e24181
Author: Maarten Bosmans <mkbosmans at gmail.com>
Date:   Tue Oct 4 14:01:03 2011 +0200

    tests: More useful output of make check
    
    Instead of spilling thousands of lines of output, make check now runs the
    test-suite in about 100 lines or so.  If running under make check, the output of
    tests is reduced. The MAKE_CHECK environment variable is used for this, so that
    when running the test manually, the full output is still shown.  Furthermore,
    pa_log is used consistently instead of printf, so that all test output goes to
    stderr by default.  Colored output from make check goes to stdout.

diff --git a/configure.ac b/configure.ac
index 9322ca0..b6c9625 100644
--- a/configure.ac
+++ b/configure.ac
@@ -26,7 +26,7 @@ AC_INIT([pulseaudio],[m4_esyscmd(./git-version-gen .tarball-version)],[mzchyfrnh
 AC_CONFIG_SRCDIR([src/daemon/main.c])
 AC_CONFIG_MACRO_DIR([m4])
 AC_CONFIG_HEADERS([config.h])
-AM_INIT_AUTOMAKE([foreign 1.11 -Wall -Wno-portability silent-rules dist-xz tar-ustar])
+AM_INIT_AUTOMAKE([foreign 1.11 -Wall -Wno-portability silent-rules color-tests dist-xz tar-ustar])
 
 m4_define(pa_major, `echo $VERSION | cut -d. -f1 | cut -d- -f1`)
 m4_define(pa_minor, `echo $VERSION | cut -d. -f2 | cut -d- -f1`)
diff --git a/src/Makefile.am b/src/Makefile.am
index cc3e13b..23e6203 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -289,6 +289,8 @@ TESTS_norun += \
 		alsa-time-test
 endif
 
+TESTS_ENVIRONMENT=MAKE_CHECK=1
+
 if BUILD_TESTS_DEFAULT
 noinst_PROGRAMS = $(TESTS) $(TESTS_norun)
 else
diff --git a/src/tests/asyncmsgq-test.c b/src/tests/asyncmsgq-test.c
index 96e5a0d..9fbe5bc 100644
--- a/src/tests/asyncmsgq-test.c
+++ b/src/tests/asyncmsgq-test.c
@@ -49,19 +49,19 @@ static void the_thread(void *_q) {
         switch (code) {
 
             case OPERATION_A:
-                printf("Operation A\n");
+                pa_log_info("Operation A");
                 break;
 
             case OPERATION_B:
-                printf("Operation B\n");
+                pa_log_info("Operation B");
                 break;
 
             case OPERATION_C:
-                printf("Operation C\n");
+                pa_log_info("Operation C");
                 break;
 
             case QUIT:
-                printf("quit\n");
+                pa_log_info("quit");
                 quit = 1;
                 break;
         }
@@ -79,22 +79,22 @@ int main(int argc, char *argv[]) {
 
     pa_assert_se(t = pa_thread_new("test", the_thread, q));
 
-    printf("Operation A post\n");
+    pa_log_info("Operation A post");
     pa_asyncmsgq_post(q, NULL, OPERATION_A, NULL, 0, NULL, NULL);
 
     pa_thread_yield();
 
-    printf("Operation B post\n");
+    pa_log_info("Operation B post");
     pa_asyncmsgq_post(q, NULL, OPERATION_B, NULL, 0, NULL, NULL);
 
     pa_thread_yield();
 
-    printf("Operation C send\n");
+    pa_log_info("Operation C send");
     pa_asyncmsgq_send(q, NULL, OPERATION_C, NULL, 0, NULL);
 
     pa_thread_yield();
 
-    printf("Quit post\n");
+    pa_log_info("Quit post");
     pa_asyncmsgq_post(q, NULL, QUIT, NULL, 0, NULL, NULL);
 
     pa_thread_free(t);
diff --git a/src/tests/asyncq-test.c b/src/tests/asyncq-test.c
index 46bac9f..6ac8cba 100644
--- a/src/tests/asyncq-test.c
+++ b/src/tests/asyncq-test.c
@@ -36,12 +36,12 @@ static void producer(void *_q) {
     int i;
 
     for (i = 0; i < 1000; i++) {
-        printf("pushing %i\n", i);
+        pa_log_debug("pushing %i", i);
         pa_asyncq_push(q, PA_UINT_TO_PTR(i+1), 1);
     }
 
     pa_asyncq_push(q, PA_UINT_TO_PTR(-1), TRUE);
-    printf("pushed end\n");
+    pa_log_debug("pushed end");
 }
 
 static void consumer(void *_q) {
@@ -59,16 +59,19 @@ static void consumer(void *_q) {
 
         pa_assert(p == PA_UINT_TO_PTR(i+1));
 
-        printf("popped %i\n", i);
+        pa_log_debug("popped %i", i);
     }
 
-    printf("popped end\n");
+    pa_log_debug("popped end");
 }
 
 int main(int argc, char *argv[]) {
     pa_asyncq *q;
     pa_thread *t1, *t2;
 
+    if (!getenv("MAKE_CHECK"))
+        pa_log_set_level(PA_LOG_DEBUG);
+
     pa_assert_se(q = pa_asyncq_new(0));
 
     pa_assert_se(t1 = pa_thread_new("producer", producer, q));
diff --git a/src/tests/get-binary-name-test.c b/src/tests/get-binary-name-test.c
index c35160f..7a09bc2 100644
--- a/src/tests/get-binary-name-test.c
+++ b/src/tests/get-binary-name-test.c
@@ -27,6 +27,8 @@
 #include <pulse/util.h>
 #include <pulse/xmalloc.h>
 
+#include <pulsecore/log.h>
+
 int main(int argc, char *argv[]) {
     char *exename;
     size_t allocated = 128;
@@ -35,13 +37,13 @@ int main(int argc, char *argv[]) {
         exename = pa_xmalloc(allocated);
 
         if (!pa_get_binary_name(exename, allocated)) {
-            printf("failed to read binary name\n");
+            pa_log_error("failed to read binary name");
             pa_xfree(exename);
             break;
         }
 
         if (strlen(exename) < allocated - 1) {
-            printf("%s\n", exename);
+            pa_log("%s", exename);
             pa_xfree(exename);
             return 0;
         }
diff --git a/src/tests/interpol-test.c b/src/tests/interpol-test.c
index 1a7c4b4..ad00aca 100644
--- a/src/tests/interpol-test.c
+++ b/src/tests/interpol-test.c
@@ -31,6 +31,7 @@
 #include <pulse/pulseaudio.h>
 #include <pulse/mainloop.h>
 
+#include <pulsecore/log.h>
 #include <pulsecore/macro.h>
 #include <pulsecore/thread.h>
 
@@ -118,7 +119,7 @@ static void context_state_callback(pa_context *c, void *userdata) {
             if (latency > 0)
                 flags |= PA_STREAM_ADJUST_LATENCY;
 
-            fprintf(stderr, "Connection established.\n");
+            pa_log("Connection established");
 
             pa_assert_se(stream = pa_stream_new(c, "interpol-test", &ss, NULL));
 
@@ -140,7 +141,7 @@ static void context_state_callback(pa_context *c, void *userdata) {
 
         case PA_CONTEXT_FAILED:
         default:
-            fprintf(stderr, "Context error: %s\n", pa_strerror(pa_context_errno(c)));
+            pa_log_error("Context error: %s", pa_strerror(pa_context_errno(c)));
             abort();
     }
 }
@@ -154,13 +155,11 @@ int main(int argc, char *argv[]) {
     pa_bool_t corked = FALSE;
 #endif
 
-    pa_log_set_level(PA_LOG_DEBUG);
+    if (!getenv("MAKE_CHECK"))
+        pa_log_set_level(PA_LOG_DEBUG);
 
     playback = argc <= 1 || !pa_streq(argv[1], "-r");
-
-    latency =
-        (argc >= 2 && !pa_streq(argv[1], "-r")) ? atoi(argv[1]) :
-        (argc >= 3 ? atoi(argv[2]) : 0);
+    latency = (argc >= 2 && !pa_streq(argv[1], "-r")) ? atoi(argv[1]) : (argc >= 3 ? atoi(argv[2]) : 0);
 
     /* Set up a new main loop */
     pa_assert_se(m = pa_threaded_mainloop_new());
@@ -214,7 +213,7 @@ int main(int argc, char *argv[]) {
             pa_bool_t cork_now;
 #endif
             rtc = pa_timeval_diff(&now, &start);
-            printf("%i\t%llu\t%llu\t%llu\t%llu\t%lli\t%u\t%u\t%llu\t%llu\n", k,
+            pa_log_info("%i\t%llu\t%llu\t%llu\t%llu\t%lli\t%u\t%u\t%llu\t%llu\n", k,
                    (unsigned long long) rtc,
                    (unsigned long long) t,
                    (unsigned long long) (rtc-old_rtc),
@@ -245,7 +244,6 @@ int main(int argc, char *argv[]) {
         }
 
         /* Spin loop, ugly but normal usleep() is just too badly grained */
-
         tv = now;
         while (pa_timeval_diff(pa_gettimeofday(&now), &tv) < 1000)
             pa_thread_yield();
diff --git a/src/tests/ipacl-test.c b/src/tests/ipacl-test.c
index 74bafd7..fa190cf 100644
--- a/src/tests/ipacl-test.c
+++ b/src/tests/ipacl-test.c
@@ -17,8 +17,9 @@
 #include <netinet/ip.h>
 #endif
 
-#include <pulsecore/socket.h>
+#include <pulsecore/log.h>
 #include <pulsecore/macro.h>
+#include <pulsecore/socket.h>
 #include <pulsecore/ipacl.h>
 #include <pulsecore/arpa-inet.h>
 
@@ -30,7 +31,7 @@ static void do_ip_acl_check(const char *s, int fd, int expected) {
     result = pa_ip_acl_check(acl, fd);
     pa_ip_acl_free(acl);
 
-    printf("%-20s result=%u (should be %u)\n", s, result, expected);
+    pa_log_info("%-20s result=%u (should be %u)", s, result, expected);
     pa_assert(result == expected);
 }
 
@@ -42,6 +43,9 @@ int main(int argc, char *argv[]) {
     int fd;
     int r;
 
+    if (!getenv("MAKE_CHECK"))
+        pa_log_set_level(PA_LOG_DEBUG);
+
     fd = socket(PF_INET, SOCK_STREAM, 0);
     pa_assert(fd >= 0);
 
@@ -65,7 +69,7 @@ int main(int argc, char *argv[]) {
 
 #ifdef HAVE_IPV6
     if ( (fd = socket(PF_INET6, SOCK_STREAM, 0)) < 0 ) {
-      printf("Unable to open IPv6 socket, IPv6 tests ignored");
+      pa_log_error("Unable to open IPv6 socket, IPv6 tests ignored");
       return 0;
     }
 
diff --git a/src/tests/lock-autospawn-test.c b/src/tests/lock-autospawn-test.c
index 9ba6129..e2db24c 100644
--- a/src/tests/lock-autospawn-test.c
+++ b/src/tests/lock-autospawn-test.c
@@ -103,7 +103,5 @@ int main(int argc, char**argv) {
     pa_thread_free(c);
     pa_thread_free(d);
 
-    pa_log("End");
-
     return 0;
 }
diff --git a/src/tests/memblock-test.c b/src/tests/memblock-test.c
index a36ce22..b82c41a 100644
--- a/src/tests/memblock-test.c
+++ b/src/tests/memblock-test.c
@@ -24,33 +24,35 @@
 #include <stdio.h>
 #include <unistd.h>
 
+#include <pulse/xmalloc.h>
+
+#include <pulsecore/log.h>
 #include <pulsecore/memblock.h>
 #include <pulsecore/macro.h>
-#include <pulse/xmalloc.h>
 
 static void release_cb(pa_memimport *i, uint32_t block_id, void *userdata) {
-    printf("%s: Imported block %u is released.\n", (char*) userdata, block_id);
+    pa_log("%s: Imported block %u is released.", (char*) userdata, block_id);
 }
 
 static void revoke_cb(pa_memexport *e, uint32_t block_id, void *userdata) {
-    printf("%s: Exported block %u is revoked.\n", (char*) userdata, block_id);
+    pa_log("%s: Exported block %u is revoked.", (char*) userdata, block_id);
 }
 
 static void print_stats(pa_mempool *p, const char *text) {
     const pa_mempool_stat*s = pa_mempool_get_stat(p);
 
-    printf("%s = {\n"
-           "n_allocated = %u\n"
-           "n_accumulated = %u\n"
-           "n_imported = %u\n"
-           "n_exported = %u\n"
-           "allocated_size = %u\n"
-           "accumulated_size = %u\n"
-           "imported_size = %u\n"
-           "exported_size = %u\n"
-           "n_too_large_for_pool = %u\n"
-           "n_pool_full = %u\n"
-           "}\n",
+    pa_log_debug("%s = {\n"
+                 "\tn_allocated = %u\n"
+                 "\tn_accumulated = %u\n"
+                 "\tn_imported = %u\n"
+                 "\tn_exported = %u\n"
+                 "\tallocated_size = %u\n"
+                 "\taccumulated_size = %u\n"
+                 "\timported_size = %u\n"
+                 "\texported_size = %u\n"
+                 "\tn_too_large_for_pool = %u\n"
+                 "\tn_pool_full = %u\n"
+                 "}",
            text,
            (unsigned) pa_atomic_load(&s->n_allocated),
            (unsigned) pa_atomic_load(&s->n_accumulated),
@@ -78,6 +80,9 @@ int main(int argc, char *argv[]) {
 
     const char txt[] = "This is a test!";
 
+    if (!getenv("MAKE_CHECK"))
+        pa_log_set_level(PA_LOG_DEBUG);
+
     pool_a = pa_mempool_new(TRUE, 0);
     pool_b = pa_mempool_new(TRUE, 0);
     pool_c = pa_mempool_new(TRUE, 0);
@@ -104,7 +109,7 @@ int main(int argc, char *argv[]) {
     blocks[4] = NULL;
 
     for (i = 0; blocks[i]; i++) {
-        printf("Memory block %u\n", i);
+        pa_log("Memory block %u", i);
 
         mb_a = blocks[i];
         pa_assert(mb_a);
@@ -123,7 +128,7 @@ int main(int argc, char *argv[]) {
         pa_assert(r >= 0);
         pa_assert(shm_id == id_a);
 
-        printf("A: Memory block exported as %u\n", id);
+        pa_log("A: Memory block exported as %u", id);
 
         mb_b = pa_memimport_get(import_b, id, shm_id, offset, size);
         pa_assert(mb_b);
@@ -132,12 +137,12 @@ int main(int argc, char *argv[]) {
         pa_assert(shm_id == id_a || shm_id == id_b);
         pa_memblock_unref(mb_b);
 
-        printf("B: Memory block exported as %u\n", id);
+        pa_log("B: Memory block exported as %u", id);
 
         mb_c = pa_memimport_get(import_c, id, shm_id, offset, size);
         pa_assert(mb_c);
         x = pa_memblock_acquire(mb_c);
-        printf("1 data=%s\n", x);
+        pa_log_debug("1 data=%s", x);
         pa_memblock_release(mb_c);
 
         print_stats(pool_a, "A");
@@ -146,7 +151,7 @@ int main(int argc, char *argv[]) {
 
         pa_memexport_free(export_b);
         x = pa_memblock_acquire(mb_c);
-        printf("2 data=%s\n", x);
+        pa_log_debug("2 data=%s", x);
         pa_memblock_release(mb_c);
         pa_memblock_unref(mb_c);
 
@@ -158,13 +163,13 @@ int main(int argc, char *argv[]) {
         pa_memexport_free(export_a);
     }
 
-    printf("vacuuming...\n");
+    pa_log("vacuuming...");
 
     pa_mempool_vacuum(pool_a);
     pa_mempool_vacuum(pool_b);
     pa_mempool_vacuum(pool_c);
 
-    printf("vacuuming done...\n");
+    pa_log("vacuuming done...");
 
     pa_mempool_free(pool_a);
     pa_mempool_free(pool_b);
diff --git a/src/tests/memblockq-test.c b/src/tests/memblockq-test.c
index 09d2142..51e1717 100644
--- a/src/tests/memblockq-test.c
+++ b/src/tests/memblockq-test.c
@@ -38,7 +38,7 @@ static void dump_chunk(const pa_memchunk *chunk) {
 
     q = pa_memblock_acquire(chunk->memblock);
     for (e = (char*) q + chunk->index, n = 0; n < chunk->length; n++, e++)
-        printf("%c", *e);
+        fprintf(stderr, "%c", *e);
     pa_memblock_release(chunk->memblock);
 }
 
@@ -48,14 +48,14 @@ static void dump(pa_memblockq *bq) {
     pa_assert(bq);
 
     /* First let's dump this as fixed block */
-    printf("FIXED >");
+    fprintf(stderr, "FIXED >");
     pa_memblockq_peek_fixed_size(bq, 64, &out);
     dump_chunk(&out);
     pa_memblock_unref(out.memblock);
-    printf("<\n");
+    fprintf(stderr, "<\n");
 
     /* Then let's dump the queue manually */
-    printf("MANUAL>");
+    fprintf(stderr, "MANUAL>");
 
     for (;;) {
         if (pa_memblockq_peek(bq, &out) < 0)
@@ -66,7 +66,7 @@ static void dump(pa_memblockq *bq) {
         pa_memblockq_drop(bq, out.length);
     }
 
-    printf("<\n");
+    fprintf(stderr, "<\n");
 }
 
 int main(int argc, char *argv[]) {
diff --git a/src/tests/mix-test.c b/src/tests/mix-test.c
index 7c05b8e..19b5ea5 100644
--- a/src/tests/mix-test.c
+++ b/src/tests/mix-test.c
@@ -35,6 +35,9 @@ static void dump_block(const pa_sample_spec *ss, const pa_memchunk *chunk) {
     void *d;
     unsigned i;
 
+    if (getenv("MAKE_CHECK"))
+        return;
+
     d = pa_memblock_acquire(chunk->memblock);
 
     switch (ss->format) {
@@ -202,7 +205,8 @@ int main(int argc, char *argv[]) {
     pa_sample_spec a;
     pa_cvolume v;
 
-    pa_log_set_level(PA_LOG_DEBUG);
+    if (!getenv("MAKE_CHECK"))
+        pa_log_set_level(PA_LOG_DEBUG);
 
     pa_assert_se(pool = pa_mempool_new(FALSE, 0));
 
@@ -217,7 +221,7 @@ int main(int argc, char *argv[]) {
         pa_mix_info m[2];
         void *ptr;
 
-        printf("=== mixing: %s\n", pa_sample_format_to_string(a.format));
+        pa_log_debug("=== mixing: %s\n", pa_sample_format_to_string(a.format));
 
         /* Generate block */
         i.memblock = generate_block(pool, &a);
diff --git a/src/tests/once-test.c b/src/tests/once-test.c
index 8a9995d..b1ef6ba 100644
--- a/src/tests/once-test.c
+++ b/src/tests/once-test.c
@@ -61,7 +61,7 @@ static void thread_func(void *data) {
     pa_assert_se(pthread_setaffinity_np(pthread_self(), sizeof(mask), &mask) == 0);
 #endif
 
-    /* pa_log("started up: %s", data); */
+    pa_log_debug("started up: %s", (char *) data);
 
     r = pthread_barrier_wait(&barrier);
     pa_assert(r == 0 || r == PTHREAD_BARRIER_SERIAL_THREAD);
@@ -73,6 +73,9 @@ static void thread_func(void *data) {
 int main(int argc, char *argv[]) {
     unsigned n, i;
 
+    if (!getenv("MAKE_CHECK"))
+        pa_log_set_level(PA_LOG_DEBUG);
+
     n_cpu = pa_ncpus();
 
     for (n = 0; n < N_ITERATIONS; n++) {
@@ -92,7 +95,7 @@ int main(int argc, char *argv[]) {
             pa_thread_join(threads[i]);
 
         pa_assert(n_run == 1);
-        pa_log("ran by %s", ran_by);
+        pa_log_info("ran by %s", ran_by);
 
         for (i = 0; i < N_THREADS; i++) {
             pa_xfree(pa_thread_get_data(threads[i]));
diff --git a/src/tests/prioq-test.c b/src/tests/prioq-test.c
index 120b512..bbcc92a 100644
--- a/src/tests/prioq-test.c
+++ b/src/tests/prioq-test.c
@@ -3,6 +3,7 @@
 #endif
 
 #include <pulsecore/prioq.h>
+#include <pulsecore/log.h>
 #include <pulsecore/macro.h>
 
 #define N 1024
@@ -13,6 +14,9 @@ int main(int argc, char *argv[]) {
 
     srand(0);
 
+    if (!getenv("MAKE_CHECK"))
+        pa_log_set_level(PA_LOG_DEBUG);
+
     q = pa_prioq_new(pa_idxset_trivial_compare_func);
 
     /* Fill in 1024 */
@@ -22,20 +26,19 @@ int main(int argc, char *argv[]) {
     /* Remove half of it again */
     for (i = 0; i < N/2; i++){
         unsigned u = PA_PTR_TO_UINT(pa_prioq_pop(q));
-        pa_log("%16u", u);
+        pa_log_debug("%16u", u);
     }
 
-    pa_log("Refilling");
+    pa_log_debug("Refilling");
 
     /* Fill in another 1024 */
     for (i = 0; i < N; i++)
         pa_prioq_put(q, PA_UINT_TO_PTR((unsigned) rand()));
 
-
     /* Remove everything */
     while (!pa_prioq_isempty(q)) {
         unsigned u = PA_PTR_TO_UINT(pa_prioq_pop(q));
-        pa_log("%16u", u);
+        pa_log_debug("%16u", u);
     }
 
     pa_prioq_free(q, NULL, NULL);
diff --git a/src/tests/proplist-test.c b/src/tests/proplist-test.c
index 8b5a235..f5a54d6 100644
--- a/src/tests/proplist-test.c
+++ b/src/tests/proplist-test.c
@@ -36,6 +36,9 @@ int main(int argc, char*argv[]) {
     const char *text;
     const char *x[] = { "foo", NULL };
 
+    if (!getenv("MAKE_CHECK"))
+        pa_log_set_level(PA_LOG_DEBUG);
+
     a = pa_proplist_new();
     pa_assert_se(pa_proplist_sets(a, PA_PROP_MEDIA_TITLE, "Brandenburgische Konzerte") == 0);
     pa_assert_se(pa_proplist_sets(a, PA_PROP_MEDIA_ARTIST, "Johann Sebastian Bach") == 0);
@@ -48,12 +51,12 @@ int main(int argc, char*argv[]) {
 
     pa_assert_se(!pa_proplist_gets(a, PA_PROP_MEDIA_ICON));
 
-    printf("%s\n", pa_strnull(pa_proplist_gets(a, PA_PROP_MEDIA_TITLE)));
+    pa_log_debug("%s", pa_strnull(pa_proplist_gets(a, PA_PROP_MEDIA_TITLE)));
     pa_assert_se(pa_proplist_unset(b, PA_PROP_MEDIA_TITLE) == 0);
 
     s = pa_proplist_to_string(a);
     t = pa_proplist_to_string(b);
-    printf("---\n%s---\n%s", s, t);
+    pa_log_debug("---\n%s---\n%s", s, t);
 
     c = pa_proplist_from_string(s);
     u = pa_proplist_to_string(c);
@@ -69,16 +72,16 @@ int main(int argc, char*argv[]) {
 
     text = "  eins = zwei drei = \"\\\"vier\\\"\" fuenf=sechs sieben ='\\a\\c\\h\\t\\'\\\"' neun= hex:0123456789abCDef ";
 
-    printf("%s\n", text);
+    pa_log_debug("%s", text);
     d = pa_proplist_from_string(text);
     v = pa_proplist_to_string(d);
     pa_proplist_free(d);
-    printf("%s\n", v);
+    pa_log_debug("%s", v);
     d = pa_proplist_from_string(v);
     pa_xfree(v);
     v = pa_proplist_to_string(d);
     pa_proplist_free(d);
-    printf("%s\n", v);
+    pa_log_debug("%s", v);
     pa_xfree(v);
 
     pa_assert_se(ma = pa_modargs_new("foo='foobar=waldo foo2=\"lj\\\"dhflh\" foo3=\"kjlskj\\'\"'", x));
@@ -86,7 +89,7 @@ int main(int argc, char*argv[]) {
 
     pa_assert_se(pa_modargs_get_proplist(ma, "foo", a, PA_UPDATE_REPLACE) >= 0);
 
-    printf("%s\n", v = pa_proplist_to_string(a));
+    pa_log_debug("%s", v = pa_proplist_to_string(a));
     pa_xfree(v);
 
     pa_proplist_free(a);
diff --git a/src/tests/resampler-test.c b/src/tests/resampler-test.c
index 12d06d2..ebd6fdd 100644
--- a/src/tests/resampler-test.c
+++ b/src/tests/resampler-test.c
@@ -32,6 +32,7 @@
 #include <pulse/volume.h>
 
 #include <pulsecore/i18n.h>
+#include <pulsecore/log.h>
 #include <pulsecore/resampler.h>
 #include <pulsecore/macro.h>
 #include <pulsecore/endianmacros.h>
@@ -39,10 +40,14 @@
 #include <pulsecore/sample-util.h>
 #include <pulsecore/core-util.h>
 
-static void dump_block(const pa_sample_spec *ss, const pa_memchunk *chunk) {
+static void dump_block(const char *label, const pa_sample_spec *ss, const pa_memchunk *chunk) {
     void *d;
     unsigned i;
 
+    if (getenv("MAKE_CHECK"))
+        return;
+    printf("%s:  \t", label);
+
     d = pa_memblock_acquire(chunk->memblock);
 
     switch (ss->format) {
@@ -296,7 +301,7 @@ static void dump_resample_methods(void) {
 int main(int argc, char *argv[]) {
     pa_mempool *pool = NULL;
     pa_sample_spec a, b;
-    int ret = 1, verbose = 0, c;
+    int ret = 1, c;
     pa_bool_t all_formats = TRUE;
     pa_resample_method_t method;
     int seconds;
@@ -320,7 +325,9 @@ int main(int argc, char *argv[]) {
     setlocale(LC_ALL, "");
     bindtextdomain(GETTEXT_PACKAGE, PULSE_LOCALEDIR);
 
-    pa_log_set_level(PA_LOG_DEBUG);
+    pa_log_set_level(PA_LOG_WARN);
+    if (!getenv("MAKE_CHECK"))
+        pa_log_set_level(PA_LOG_INFO);
 
     pa_assert_se(pool = pa_mempool_new(FALSE, 0));
 
@@ -341,7 +348,6 @@ int main(int argc, char *argv[]) {
 
             case 'v':
                 pa_log_set_level(PA_LOG_DEBUG);
-                verbose = 1;
                 break;
 
             case ARG_VERSION:
@@ -407,16 +413,14 @@ int main(int argc, char *argv[]) {
         pa_memchunk i, j;
         pa_usec_t ts;
 
-        if (verbose) {
-            printf(_("Compilation CFLAGS: %s\n"), PA_CFLAGS);
-            printf(_("=== %d seconds: %d Hz %d ch (%s) -> %d Hz %d ch (%s)\n"), seconds,
+        pa_log_debug(_("Compilation CFLAGS: %s"), PA_CFLAGS);
+        pa_log_debug(_("=== %d seconds: %d Hz %d ch (%s) -> %d Hz %d ch (%s)"), seconds,
                    a.rate, a.channels, pa_sample_format_to_string(a.format),
                    b.rate, b.channels, pa_sample_format_to_string(b.format));
-        }
 
         ts = pa_rtclock_now();
         pa_assert_se(resampler = pa_resampler_new(pool, &a, NULL, &b, NULL, method, 0));
-        printf("init: %llu\n", (long long unsigned)(pa_rtclock_now() - ts));
+        pa_log_info("init: %llu", (long long unsigned)(pa_rtclock_now() - ts));
 
         i.memblock = pa_memblock_new(pool, pa_usec_to_bytes(1*PA_USEC_PER_SEC, &a));
 
@@ -427,7 +431,7 @@ int main(int argc, char *argv[]) {
             pa_resampler_run(resampler, &i, &j);
             pa_memblock_unref(j.memblock);
         }
-        printf("resampling: %llu\n", (long long unsigned)(pa_rtclock_now() - ts));
+        pa_log_info("resampling: %llu", (long long unsigned)(pa_rtclock_now() - ts));
         pa_memblock_unref(i.memblock);
 
         pa_resampler_free(resampler);
@@ -440,8 +444,7 @@ int main(int argc, char *argv[]) {
             pa_resampler *forth, *back;
             pa_memchunk i, j, k;
 
-            if (verbose)
-                printf("=== %s -> %s -> %s -> /2\n",
+            pa_log_debug("=== %s -> %s -> %s -> /2",
                        pa_sample_format_to_string(a.format),
                        pa_sample_format_to_string(b.format),
                        pa_sample_format_to_string(a.format));
@@ -455,12 +458,9 @@ int main(int argc, char *argv[]) {
             pa_resampler_run(forth, &i, &j);
             pa_resampler_run(back, &j, &k);
 
-            printf("before:  ");
-            dump_block(&a, &i);
-            printf("after :  ");
-            dump_block(&b, &j);
-            printf("reverse: ");
-            dump_block(&a, &k);
+            dump_block("before", &a, &i);
+            dump_block("after", &b, &j);
+            dump_block("reverse", &a, &k);
 
             pa_memblock_unref(i.memblock);
             pa_memblock_unref(j.memblock);
diff --git a/src/tests/smoother-test.c b/src/tests/smoother-test.c
index 2cc9f58..4471669 100644
--- a/src/tests/smoother-test.c
+++ b/src/tests/smoother-test.c
@@ -24,9 +24,11 @@
 #include <stdio.h>
 #include <stdlib.h>
 
-#include <pulsecore/time-smoother.h>
 #include <pulse/timeval.h>
 
+#include <pulsecore/log.h>
+#include <pulsecore/time-smoother.h>
+
 int main(int argc, char*argv[]) {
     pa_usec_t x;
     unsigned u = 0;
@@ -45,7 +47,8 @@ int main(int argc, char*argv[]) {
 
     srand(0);
 
-    pa_log_set_level(PA_LOG_DEBUG);
+    if (!getenv("MAKE_CHECK"))
+        pa_log_set_level(PA_LOG_DEBUG);
 
     for (m = 0, u = 0; u < PA_ELEMENTSOF(msec); u+= 2) {
 
@@ -67,13 +70,13 @@ int main(int argc, char*argv[]) {
 
         while (u < PA_ELEMENTSOF(msec) && (pa_usec_t) msec[u]*PA_USEC_PER_MSEC < x) {
             pa_smoother_put(s, (pa_usec_t) msec[u] * PA_USEC_PER_MSEC, (pa_usec_t) msec[u+1] * PA_USEC_PER_MSEC);
-            printf("%i\t\t%i\n", msec[u],  msec[u+1]);
+            pa_log_debug("%i\t\t%i", msec[u],  msec[u+1]);
             u += 2;
 
             pa_smoother_resume(s, (pa_usec_t) msec[u] * PA_USEC_PER_MSEC, TRUE);
         }
 
-        printf("%llu\t%llu\n", (unsigned long long) (x/PA_USEC_PER_MSEC), (unsigned long long) (pa_smoother_get(s, x)/PA_USEC_PER_MSEC));
+        pa_log_debug("%llu\t%llu", (unsigned long long) (x/PA_USEC_PER_MSEC), (unsigned long long) (pa_smoother_get(s, x)/PA_USEC_PER_MSEC));
     }
 
     pa_smoother_free(s);
diff --git a/src/tests/thread-mainloop-test.c b/src/tests/thread-mainloop-test.c
index 7227597..599f195 100644
--- a/src/tests/thread-mainloop-test.c
+++ b/src/tests/thread-mainloop-test.c
@@ -67,8 +67,6 @@ int main(int argc, char *argv[]) {
     fprintf(stderr, "waiting 5s (sleep)\n");
     pa_msleep(5000);
 
-    fprintf(stderr, "shutting down\n");
-
     pa_threaded_mainloop_stop(m);
 
     pa_threaded_mainloop_free(m);
diff --git a/src/tests/thread-test.c b/src/tests/thread-test.c
index aaa79fb..6441dc7 100644
--- a/src/tests/thread-test.c
+++ b/src/tests/thread-test.c
@@ -46,14 +46,14 @@ static pa_once once = PA_ONCE_INIT;
 static void thread_func(void *data) {
     pa_tls_set(tls, data);
 
-    pa_log("thread_func() for %s starting...", (char*) pa_tls_get(tls));
+    pa_log_info("thread_func() for %s starting...", (char*) pa_tls_get(tls));
 
     pa_mutex_lock(mutex);
 
     for (;;) {
         int k, n;
 
-        pa_log("%s waiting ...", (char*) pa_tls_get(tls));
+        pa_log_info("%s waiting ...", (char*) pa_tls_get(tls));
 
         for (;;) {
 
@@ -75,7 +75,7 @@ static void thread_func(void *data) {
 
         pa_cond_signal(cond2, 0);
 
-        pa_log("%s got number %i", (char*) pa_tls_get(tls), k);
+        pa_log_info("%s got number %i", (char*) pa_tls_get(tls), k);
 
         /* Spin! */
         for (n = 0; n < k; n++)
@@ -88,13 +88,16 @@ quit:
 
     pa_mutex_unlock(mutex);
 
-    pa_log("thread_func() for %s done...", (char*) pa_tls_get(tls));
+    pa_log_info("thread_func() for %s done...", (char*) pa_tls_get(tls));
 }
 
 int main(int argc, char *argv[]) {
     int i, k;
     pa_thread* t[THREADS_MAX];
 
+    if (!getenv("MAKE_CHECK"))
+        pa_log_set_level(PA_LOG_DEBUG);
+
     mutex = pa_mutex_new(FALSE, FALSE);
     cond1 = pa_cond_new();
     cond2 = pa_cond_new();
@@ -113,7 +116,7 @@ int main(int argc, char *argv[]) {
 
         magic_number = (int) rand() % 0x10000;
 
-        pa_log("iteration %i (%i)", k, magic_number);
+        pa_log_info("iteration %i (%i)", k, magic_number);
 
         pa_cond_signal(cond1, 0);
 
diff --git a/src/tests/utf8-test.c b/src/tests/utf8-test.c
index f1708ad..6dc5b50 100644
--- a/src/tests/utf8-test.c
+++ b/src/tests/utf8-test.c
@@ -13,11 +13,11 @@ int main(int argc, char *argv[]) {
     assert(pa_utf8_valid("hallo\n"));
     assert(pa_utf8_valid("hüpfburg\n"));
 
-    printf("LATIN1: %s\n", c = pa_utf8_filter("hüpfburg"));
+    fprintf(stderr, "LATIN1: %s\n", c = pa_utf8_filter("hüpfburg"));
     pa_xfree(c);
-    printf("UTF8: %sx\n", c = pa_utf8_filter("hüpfburg"));
+    fprintf(stderr, "UTF8: %sx\n", c = pa_utf8_filter("hüpfburg"));
     pa_xfree(c);
-    printf("LATIN1: %sx\n", c = pa_utf8_filter("üxknärzmörzeltörszß³§dsjkfh"));
+    fprintf(stderr, "LATIN1: %sx\n", c = pa_utf8_filter("üxknärzmörzeltörszß³§dsjkfh"));
     pa_xfree(c);
 
     return 0;
diff --git a/src/tests/voltest.c b/src/tests/voltest.c
index b45a468..f7405ff 100644
--- a/src/tests/voltest.c
+++ b/src/tests/voltest.c
@@ -26,6 +26,7 @@
 
 #include <pulse/volume.h>
 
+#include <pulsecore/log.h>
 #include <pulsecore/macro.h>
 
 int main(int argc, char *argv[]) {
@@ -36,15 +37,18 @@ int main(int argc, char *argv[]) {
     pa_volume_t md = 0;
     unsigned mdn = 0;
 
-    printf("Attenuation of sample 1 against 32767: %g dB\n", 20.0*log10(1.0/32767.0));
-    printf("Smallest possible attenuation > 0 applied to 32767: %li\n", lrint(32767.0*pa_sw_volume_to_linear(1)));
+    if (!getenv("MAKE_CHECK"))
+        pa_log_set_level(PA_LOG_DEBUG);
+
+    pa_log("Attenuation of sample 1 against 32767: %g dB", 20.0*log10(1.0/32767.0));
+    pa_log("Smallest possible attenuation > 0 applied to 32767: %li", lrint(32767.0*pa_sw_volume_to_linear(1)));
 
     for (v = PA_VOLUME_MUTED; v <= PA_VOLUME_NORM*2; v += 256) {
 
         double dB = pa_sw_volume_to_dB(v);
         double f = pa_sw_volume_to_linear(v);
 
-        printf("Volume: %3i; percent: %i%%; decibel %0.2f; linear = %0.2f; volume(decibel): %3i; volume(linear): %3i\n",
+        pa_log_debug("Volume: %3i; percent: %i%%; decibel %0.2f; linear = %0.2f; volume(decibel): %3i; volume(linear): %3i",
                v, (v*100)/PA_VOLUME_NORM, dB, f, pa_sw_volume_from_dB(dB), pa_sw_volume_from_linear(f));
     }
 
@@ -53,11 +57,7 @@ int main(int argc, char *argv[]) {
 
         pa_cvolume_set(&cv, 2, v);
 
-        printf("Volume: %3i [%s] [%s]\n",
-               v,
-               pa_cvolume_snprint(s, sizeof(s), &cv),
-               pa_sw_cvolume_snprint_dB(t, sizeof(t), &cv));
-
+        pa_log_debug("Volume: %3i [%s] [%s]", v, pa_cvolume_snprint(s, sizeof(s), &cv), pa_sw_cvolume_snprint_dB(t, sizeof(t), &cv));
     }
 
     map.channels = cv.channels = 2;
@@ -68,7 +68,7 @@ int main(int argc, char *argv[]) {
         for (cv.values[1] = PA_VOLUME_MUTED; cv.values[1] <= PA_VOLUME_NORM*2; cv.values[1] += 4096) {
             char s[PA_CVOLUME_SNPRINT_MAX];
 
-            printf("Volume: [%s]; balance: %2.1f\n", pa_cvolume_snprint(s, sizeof(s), &cv), pa_cvolume_get_balance(&cv, &map));
+            pa_log_debug("Volume: [%s]; balance: %2.1f", pa_cvolume_snprint(s, sizeof(s), &cv), pa_cvolume_get_balance(&cv, &map));
         }
 
     for (cv.values[0] = PA_VOLUME_MUTED+4096; cv.values[0] <= PA_VOLUME_NORM*2; cv.values[0] += 4096)
@@ -78,13 +78,13 @@ int main(int argc, char *argv[]) {
                 pa_cvolume r;
                 float k;
 
-                printf("Before: volume: [%s]; balance: %2.1f\n", pa_cvolume_snprint(s, sizeof(s), &cv), pa_cvolume_get_balance(&cv, &map));
+                pa_log_debug("Before: volume: [%s]; balance: %2.1f", pa_cvolume_snprint(s, sizeof(s), &cv), pa_cvolume_get_balance(&cv, &map));
 
                 r = cv;
                 pa_cvolume_set_balance(&r, &map,b);
 
                 k = pa_cvolume_get_balance(&r, &map);
-                printf("After: volume: [%s]; balance: %2.1f (intended: %2.1f) %s\n", pa_cvolume_snprint(s, sizeof(s), &r), k, b, k < b-.05 || k > b+.5 ? "MISMATCH" : "");
+                pa_log_debug("After: volume: [%s]; balance: %2.1f (intended: %2.1f) %s", pa_cvolume_snprint(s, sizeof(s), &r), k, b, k < b-.05 || k > b+.5 ? "MISMATCH" : "");
             }
 
     for (v = PA_VOLUME_MUTED; v <= PA_VOLUME_NORM*2; v += 51) {
@@ -125,7 +125,7 @@ int main(int argc, char *argv[]) {
         }
     }
 
-    printf("max deviation: %lu n=%lu\n", (unsigned long) md, (unsigned long) mdn);
+    pa_log("max deviation: %lu n=%lu", (unsigned long) md, (unsigned long) mdn);
 
     pa_assert(md <= 1);
     pa_assert(mdn <= 251);

commit 6be5515e6a456abf35795452bd824e74dbb43dc8
Author: Maarten Bosmans <mkbosmans at gmail.com>
Date:   Fri Oct 28 16:30:05 2011 +0200

    tests: Make sure tests assert on failures and return error status
    
    When a test program exits with a nonzero return value (or an assert is hit),
    the test is regarded as a FAIL.
    This makes `make check` a little more useful.

diff --git a/src/tests/extended-test.c b/src/tests/extended-test.c
index 631fdc8..0647aea 100644
--- a/src/tests/extended-test.c
+++ b/src/tests/extended-test.c
@@ -156,7 +156,7 @@ static void context_state_callback(pa_context *c, void *userdata) {
 
 int main(int argc, char *argv[]) {
     pa_mainloop* m = NULL;
-    int i, ret = 0;
+    int i, ret = 1;
 
     for (i = 0; i < SAMPLE_HZ; i++)
         data[i] = (float) sin(((double) i/SAMPLE_HZ)*2*M_PI*SINE_HZ)/2;
diff --git a/src/tests/get-binary-name-test.c b/src/tests/get-binary-name-test.c
index 4afe81b..c35160f 100644
--- a/src/tests/get-binary-name-test.c
+++ b/src/tests/get-binary-name-test.c
@@ -43,12 +43,12 @@ int main(int argc, char *argv[]) {
         if (strlen(exename) < allocated - 1) {
             printf("%s\n", exename);
             pa_xfree(exename);
-            break;
+            return 0;
         }
 
         pa_xfree(exename);
         allocated *= 2;
     }
 
-    return 0;
+    return 1;
 }
diff --git a/src/tests/interpol-test.c b/src/tests/interpol-test.c
index ffe4ab3..1a7c4b4 100644
--- a/src/tests/interpol-test.c
+++ b/src/tests/interpol-test.c
@@ -25,13 +25,13 @@
 #include <string.h>
 #include <errno.h>
 #include <unistd.h>
-#include <assert.h>
 #include <stdio.h>
 #include <stdlib.h>
 
 #include <pulse/pulseaudio.h>
 #include <pulse/mainloop.h>
 
+#include <pulsecore/macro.h>
 #include <pulsecore/thread.h>
 
 #define INTERPOLATE
@@ -87,7 +87,7 @@ static void stream_latency_cb(pa_stream *p, void *userdata) {
 
 /* This is called whenever the context status changes */
 static void context_state_callback(pa_context *c, void *userdata) {
-    assert(c);
+    pa_assert(c);
 
     switch (pa_context_get_state(c)) {
         case PA_CONTEXT_CONNECTING:
diff --git a/src/tests/ipacl-test.c b/src/tests/ipacl-test.c
index 7a7267d..74bafd7 100644
--- a/src/tests/ipacl-test.c
+++ b/src/tests/ipacl-test.c
@@ -5,7 +5,6 @@
 #include <sys/types.h>
 #include <stdio.h>
 #include <unistd.h>
-#include <assert.h>
 #include <string.h>
 
 #ifdef HAVE_NETINET_IN_H
@@ -27,12 +26,12 @@ static void do_ip_acl_check(const char *s, int fd, int expected) {
     pa_ip_acl *acl;
     int result;
 
-    acl = pa_ip_acl_new(s);
-    assert(acl);
+    pa_assert_se(acl = pa_ip_acl_new(s));
     result = pa_ip_acl_check(acl, fd);
     pa_ip_acl_free(acl);
 
     printf("%-20s result=%u (should be %u)\n", s, result, expected);
+    pa_assert(result == expected);
 }
 
 int main(int argc, char *argv[]) {
@@ -44,14 +43,14 @@ int main(int argc, char *argv[]) {
     int r;
 
     fd = socket(PF_INET, SOCK_STREAM, 0);
-    assert(fd >= 0);
+    pa_assert(fd >= 0);
 
     sa.sin_family = AF_INET;
     sa.sin_port = htons(22);
     sa.sin_addr.s_addr = inet_addr("127.0.0.1");
 
     r = connect(fd, (struct sockaddr*) &sa, sizeof(sa));
-    assert(r >= 0);
+    pa_assert(r >= 0);
 
     do_ip_acl_check("127.0.0.1", fd, 1);
     do_ip_acl_check("127.0.0.2/0", fd, 1);
@@ -76,7 +75,7 @@ int main(int argc, char *argv[]) {
     pa_assert_se(inet_pton(AF_INET6, "::1", &sa6.sin6_addr) == 1);
 
     r = connect(fd, (struct sockaddr*) &sa6, sizeof(sa6));
-    assert(r >= 0);
+    pa_assert(r >= 0);
 
     do_ip_acl_check("::1", fd, 1);
     do_ip_acl_check("::1/9", fd, 1);
diff --git a/src/tests/memblockq-test.c b/src/tests/memblockq-test.c
index 085d70e..09d2142 100644
--- a/src/tests/memblockq-test.c
+++ b/src/tests/memblockq-test.c
@@ -22,12 +22,12 @@
 #endif
 
 #include <stdlib.h>
-#include <assert.h>
 #include <stdio.h>
 #include <signal.h>
 
 #include <pulsecore/memblockq.h>
 #include <pulsecore/log.h>
+#include <pulsecore/macro.h>
 
 static void dump_chunk(const pa_memchunk *chunk) {
     size_t n;
@@ -86,33 +86,27 @@ int main(int argc, char *argv[]) {
 
     p = pa_mempool_new(FALSE, 0);
 
-    silence.memblock = pa_memblock_new_fixed(p, (char*) "__", 2, 1);
-    assert(silence.memblock);
+    pa_assert_se(silence.memblock = pa_memblock_new_fixed(p, (char*) "__", 2, 1));
     silence.index = 0;
     silence.length = pa_memblock_get_length(silence.memblock);
 
-    bq = pa_memblockq_new("test memblockq", 0, 200, 10, &ss, 4, 4, 40, &silence);
-    assert(bq);
+    pa_assert_se(bq = pa_memblockq_new("test memblockq", 0, 200, 10, &ss, 4, 4, 40, &silence));
 
-    chunk1.memblock = pa_memblock_new_fixed(p, (char*) "11", 2, 1);
+    pa_assert_se(chunk1.memblock = pa_memblock_new_fixed(p, (char*) "11", 2, 1));
     chunk1.index = 0;
     chunk1.length = 2;
-    assert(chunk1.memblock);
 
-    chunk2.memblock = pa_memblock_new_fixed(p, (char*) "XX22", 4, 1);
+    pa_assert_se(chunk2.memblock = pa_memblock_new_fixed(p, (char*) "XX22", 4, 1));
     chunk2.index = 2;
     chunk2.length = 2;
-    assert(chunk2.memblock);
 
-    chunk3.memblock = pa_memblock_new_fixed(p, (char*) "3333", 4, 1);
+    pa_assert_se(chunk3.memblock = pa_memblock_new_fixed(p, (char*) "3333", 4, 1));
     chunk3.index = 0;
     chunk3.length = 4;
-    assert(chunk3.memblock);
 
-    chunk4.memblock = pa_memblock_new_fixed(p, (char*) "44444444", 8, 1);
+    pa_assert_se(chunk4.memblock = pa_memblock_new_fixed(p, (char*) "44444444", 8, 1));
     chunk4.index = 0;
     chunk4.length = 8;
-    assert(chunk4.memblock);
 
     ret = pa_memblockq_push(bq, &chunk1);
     assert(ret == 0);
diff --git a/src/tests/thread-test.c b/src/tests/thread-test.c
index 4071e42..aaa79fb 100644
--- a/src/tests/thread-test.c
+++ b/src/tests/thread-test.c
@@ -21,12 +21,13 @@
 #include <config.h>
 #endif
 
+#include <pulse/xmalloc.h>
 #include <pulsecore/thread.h>
+#include <pulsecore/macro.h>
 #include <pulsecore/mutex.h>
 #include <pulsecore/once.h>
 #include <pulsecore/log.h>
 #include <pulsecore/core-util.h>
-#include <pulse/xmalloc.h>
 
 static pa_mutex *mutex = NULL;
 static pa_cond *cond1 = NULL, *cond2 = NULL;
@@ -100,8 +101,7 @@ int main(int argc, char *argv[]) {
     tls = pa_tls_new(pa_xfree);
 
     for (i = 0; i < THREADS_MAX; i++) {
-        t[i] = pa_thread_new("test", thread_func, pa_sprintf_malloc("Thread #%i", i+1));
-        assert(t[i]);
+        pa_assert_se(t[i] = pa_thread_new("test", thread_func, pa_sprintf_malloc("Thread #%i", i+1)));
     }
 
     pa_mutex_lock(mutex);
@@ -109,8 +109,7 @@ int main(int argc, char *argv[]) {
     pa_log("loop-init");
 
     for (k = 0; k < 100; k++) {
-        assert(magic_number == 0);
-
+        pa_assert(magic_number == 0);
 
         magic_number = (int) rand() % 0x10000;
 

commit c2b5a8e694ca74577906fd29cee4684fce24c621
Author: Maarten Bosmans <mkbosmans at gmail.com>
Date:   Fri Oct 28 16:24:18 2011 +0200

    tests: refactor ipacl-test
    
    Common test code is moved to a separate function.

diff --git a/src/tests/ipacl-test.c b/src/tests/ipacl-test.c
index be9caad..7a7267d 100644
--- a/src/tests/ipacl-test.c
+++ b/src/tests/ipacl-test.c
@@ -23,6 +23,18 @@
 #include <pulsecore/ipacl.h>
 #include <pulsecore/arpa-inet.h>
 
+static void do_ip_acl_check(const char *s, int fd, int expected) {
+    pa_ip_acl *acl;
+    int result;
+
+    acl = pa_ip_acl_new(s);
+    assert(acl);
+    result = pa_ip_acl_check(acl, fd);
+    pa_ip_acl_free(acl);
+
+    printf("%-20s result=%u (should be %u)\n", s, result, expected);
+}
+
 int main(int argc, char *argv[]) {
     struct sockaddr_in sa;
 #ifdef HAVE_IPV6
@@ -30,7 +42,6 @@ int main(int argc, char *argv[]) {
 #endif
     int fd;
     int r;
-    pa_ip_acl *acl;
 
     fd = socket(PF_INET, SOCK_STREAM, 0);
     assert(fd >= 0);
@@ -42,45 +53,14 @@ int main(int argc, char *argv[]) {
     r = connect(fd, (struct sockaddr*) &sa, sizeof(sa));
     assert(r >= 0);
 
-    acl = pa_ip_acl_new("127.0.0.1");
-    assert(acl);
-    printf("result=%u (should be 1)\n", pa_ip_acl_check(acl, fd));
-    pa_ip_acl_free(acl);
-
-    acl = pa_ip_acl_new("127.0.0.2/0");
-    assert(acl);
-    printf("result=%u (should be 1)\n", pa_ip_acl_check(acl, fd));
-    pa_ip_acl_free(acl);
-
-    acl = pa_ip_acl_new("127.0.0.1/32");
-    assert(acl);
-    printf("result=%u (should be 1)\n", pa_ip_acl_check(acl, fd));
-    pa_ip_acl_free(acl);
-
-    acl = pa_ip_acl_new("127.0.0.1/7");
-    assert(acl);
-    printf("result=%u (should be 1)\n", pa_ip_acl_check(acl, fd));
-    pa_ip_acl_free(acl);
-
-    acl = pa_ip_acl_new("127.0.0.2");
-    assert(acl);
-    printf("result=%u (should be 0)\n", pa_ip_acl_check(acl, fd));
-    pa_ip_acl_free(acl);
-
-    acl = pa_ip_acl_new("127.0.0.0/8;0.0.0.0/32");
-    assert(acl);
-    printf("result=%u (should be 1)\n", pa_ip_acl_check(acl, fd));
-    pa_ip_acl_free(acl);
-
-    acl = pa_ip_acl_new("128.0.0.2/9");
-    assert(acl);
-    printf("result=%u (should be 0)\n", pa_ip_acl_check(acl, fd));
-    pa_ip_acl_free(acl);
-
-    acl = pa_ip_acl_new("::1/9");
-    assert(acl);
-    printf("result=%u (should be 0)\n", pa_ip_acl_check(acl, fd));
-    pa_ip_acl_free(acl);
+    do_ip_acl_check("127.0.0.1", fd, 1);
+    do_ip_acl_check("127.0.0.2/0", fd, 1);
+    do_ip_acl_check("127.0.0.1/32", fd, 1);
+    do_ip_acl_check("127.0.0.1/7", fd, 1);
+    do_ip_acl_check("127.0.0.2", fd, 0);
+    do_ip_acl_check("127.0.0.0/8;0.0.0.0/32", fd, 1);
+    do_ip_acl_check("128.0.0.2/9", fd, 0);
+    do_ip_acl_check("::1/9", fd, 0);
 
     close(fd);
 
@@ -98,35 +78,12 @@ int main(int argc, char *argv[]) {
     r = connect(fd, (struct sockaddr*) &sa6, sizeof(sa6));
     assert(r >= 0);
 
-    acl = pa_ip_acl_new("::1");
-    assert(acl);
-    printf("result=%u (should be 1)\n", pa_ip_acl_check(acl, fd));
-    pa_ip_acl_free(acl);
-
-    acl = pa_ip_acl_new("::1/9");
-    assert(acl);
-    printf("result=%u (should be 1)\n", pa_ip_acl_check(acl, fd));
-    pa_ip_acl_free(acl);
-
-    acl = pa_ip_acl_new("::/0");
-    assert(acl);
-    printf("result=%u (should be 1)\n", pa_ip_acl_check(acl, fd));
-    pa_ip_acl_free(acl);
-
-    acl = pa_ip_acl_new("::2/128");
-    assert(acl);
-    printf("result=%u (should be 0)\n", pa_ip_acl_check(acl, fd));
-    pa_ip_acl_free(acl);
-
-    acl = pa_ip_acl_new("::2/127");
-    assert(acl);
-    printf("result=%u (should be 0)\n", pa_ip_acl_check(acl, fd));
-    pa_ip_acl_free(acl);
-
-    acl = pa_ip_acl_new("::2/126");
-    assert(acl);
-    printf("result=%u (should be 1)\n", pa_ip_acl_check(acl, fd));
-    pa_ip_acl_free(acl);
+    do_ip_acl_check("::1", fd, 1);
+    do_ip_acl_check("::1/9", fd, 1);
+    do_ip_acl_check("::/0", fd, 1);
+    do_ip_acl_check("::2/128", fd, 0);
+    do_ip_acl_check("::2/127", fd, 0);
+    do_ip_acl_check("::2/126", fd, 1);
 
     close(fd);
 #endif

commit 6f148787e0226fac47403a4a52160102269736a8
Author: Tanu Kaskinen <tanuk at iki.fi>
Date:   Mon Oct 31 20:45:50 2011 +0200

    sink, source: Join two ifs with the same condition.
    
    Changes in v2:
     * Moved the comment in source.c to the right place.

diff --git a/src/pulsecore/sink.c b/src/pulsecore/sink.c
index 454285f..eb67b47 100644
--- a/src/pulsecore/sink.c
+++ b/src/pulsecore/sink.c
@@ -1943,13 +1943,7 @@ void pa_sink_set_volume(
         }
 
         pa_cvolume_remap(&new_reference_volume, &s->channel_map, &root_sink->channel_map);
-    }
-
-    /* If volume is NULL we synchronize the sink's real and reference
-     * volumes with the stream volumes. If it is not NULL we update
-     * the reference_volume with it. */
 
-    if (volume) {
         if (update_reference_volume(root_sink, &new_reference_volume, &root_sink->channel_map, save)) {
             if (pa_sink_flat_volume_enabled(root_sink)) {
                 /* OK, propagate this volume change back to the inputs */
@@ -1962,6 +1956,9 @@ void pa_sink_set_volume(
         }
 
     } else {
+        /* If volume is NULL we synchronize the sink's real and
+         * reference volumes with the stream volumes. */
+
         pa_assert(pa_sink_flat_volume_enabled(root_sink));
 
         /* Ok, let's determine the new real volume */
diff --git a/src/pulsecore/source.c b/src/pulsecore/source.c
index 6da6ef2..361780a 100644
--- a/src/pulsecore/source.c
+++ b/src/pulsecore/source.c
@@ -1508,13 +1508,7 @@ void pa_source_set_volume(
         }
 
         pa_cvolume_remap(&new_reference_volume, &s->channel_map, &root_source->channel_map);
-    }
-
-    /* If volume is NULL we synchronize the source's real and reference
-     * volumes with the stream volumes. If it is not NULL we update
-     * the reference_volume with it. */
 
-    if (volume) {
         if (update_reference_volume(root_source, &new_reference_volume, &root_source->channel_map, save)) {
             if (pa_source_flat_volume_enabled(root_source)) {
                 /* OK, propagate this volume change back to the outputs */
@@ -1527,6 +1521,9 @@ void pa_source_set_volume(
         }
 
     } else {
+        /* If volume is NULL we synchronize the source's real and
+         * reference volumes with the stream volumes. */
+
         pa_assert(pa_source_flat_volume_enabled(root_source));
 
         /* Ok, let's determine the new real volume */



More information about the pulseaudio-commits mailing list