[pulseaudio-commits] [SCM] PulseAudio Sound Server branch, master, updated. v0.9.15-test7-19-gca39fa2

Lennart Poettering gitmailer-noreply at 0pointer.de
Fri Apr 3 19:13:22 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  f7083280f82f2b5cf4bde0d64cbec9fb7ac9f970 (commit)

- Log -----------------------------------------------------------------
ca39fa2 initialize sound cards only after the 'control' object appeared
9bea250 increase log buffer further
77a1e38 refuse to initialize on modem devices
-----------------------------------------------------------------------

Summary of changes:
 src/modules/alsa/alsa-sink.c    |    5 +++++
 src/modules/alsa/alsa-source.c  |    5 +++++
 src/modules/alsa/alsa-util.c    |   12 ++++++++++++
 src/modules/alsa/alsa-util.h    |    2 ++
 src/modules/module-hal-detect.c |   30 +++++++++++++++++++++++++-----
 src/pulsecore/log.c             |    2 +-
 6 files changed, 50 insertions(+), 6 deletions(-)

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

commit 77a1e3876bb11be79b32509d744136f89d76025f
Author: Lennart Poettering <lennart at poettering.net>
Date:   Sat Apr 4 04:12:42 2009 +0200

    refuse to initialize on modem devices

diff --git a/src/modules/alsa/alsa-sink.c b/src/modules/alsa/alsa-sink.c
index b43fa06..cdf1ca8 100644
--- a/src/modules/alsa/alsa-sink.c
+++ b/src/modules/alsa/alsa-sink.c
@@ -1617,6 +1617,11 @@ pa_sink *pa_alsa_sink_new(pa_module *m, pa_modargs *ma, const char*driver, pa_ca
     pa_assert(u->device_name);
     pa_log_info("Successfully opened device %s.", u->device_name);
 
+    if (pa_alsa_pcm_is_modem(u->pcm_handle)) {
+        pa_log_notice("Device %s is modem, refusing further initialization.", u->device_name);
+        goto fail;
+    }
+
     if (profile)
         pa_log_info("Selected configuration '%s' (%s).", profile->description, profile->name);
 
diff --git a/src/modules/alsa/alsa-source.c b/src/modules/alsa/alsa-source.c
index 348cd08..d9c6010 100644
--- a/src/modules/alsa/alsa-source.c
+++ b/src/modules/alsa/alsa-source.c
@@ -1469,6 +1469,11 @@ pa_source *pa_alsa_source_new(pa_module *m, pa_modargs *ma, const char*driver, p
     pa_assert(u->device_name);
     pa_log_info("Successfully opened device %s.", u->device_name);
 
+    if (pa_alsa_pcm_is_modem(u->pcm_handle)) {
+        pa_log_notice("Device %s is modem, refusing further initialization.", u->device_name);
+        goto fail;
+    }
+
     if (profile)
         pa_log_info("Selected configuration '%s' (%s).", profile->description, profile->name);
 
diff --git a/src/modules/alsa/alsa-util.c b/src/modules/alsa/alsa-util.c
index be8cd1c..870cf0f 100644
--- a/src/modules/alsa/alsa-util.c
+++ b/src/modules/alsa/alsa-util.c
@@ -1769,3 +1769,15 @@ pa_bool_t pa_alsa_pcm_is_hw(snd_pcm_t *pcm) {
 
     return snd_pcm_info_get_card(info) >= 0;
 }
+
+pa_bool_t pa_alsa_pcm_is_modem(snd_pcm_t *pcm) {
+    snd_pcm_info_t* info;
+    snd_pcm_info_alloca(&info);
+
+    pa_assert(pcm);
+
+    if (snd_pcm_info(pcm, info) < 0)
+        return FALSE;
+
+    return snd_pcm_info_get_class(info) == SND_PCM_CLASS_MODEM;
+}
diff --git a/src/modules/alsa/alsa-util.h b/src/modules/alsa/alsa-util.h
index 5cad295..94f27d1 100644
--- a/src/modules/alsa/alsa-util.h
+++ b/src/modules/alsa/alsa-util.h
@@ -141,4 +141,6 @@ char *pa_alsa_get_reserve_name(const char *device);
 
 pa_bool_t pa_alsa_pcm_is_hw(snd_pcm_t *pcm);
 
+pa_bool_t pa_alsa_pcm_is_modem(snd_pcm_t *pcm);
+
 #endif

commit 9bea2503d9faf5c1a4236194ea44754e27bf86e8
Author: Lennart Poettering <lennart at poettering.net>
Date:   Sat Apr 4 04:13:11 2009 +0200

    increase log buffer further

diff --git a/src/pulsecore/log.c b/src/pulsecore/log.c
index 750d73b..60ea9c5 100644
--- a/src/pulsecore/log.c
+++ b/src/pulsecore/log.c
@@ -262,7 +262,7 @@ void pa_log_levelv_meta(
 
     /* We don't use dynamic memory allocation here to minimize the hit
      * in RT threads */
-    char text[4096], location[128], timestamp[32];
+    char text[16*1024], location[128], timestamp[32];
 
     pa_assert(level < PA_LOG_LEVEL_MAX);
     pa_assert(format);

commit ca39fa2c6f9036a4c90804625842f6af38fb8008
Author: Lennart Poettering <lennart at poettering.net>
Date:   Sat Apr 4 04:13:58 2009 +0200

    initialize sound cards only after the 'control' object appeared

diff --git a/src/modules/module-hal-detect.c b/src/modules/module-hal-detect.c
index 0dd22cb..b6139e4 100644
--- a/src/modules/module-hal-detect.c
+++ b/src/modules/module-hal-detect.c
@@ -121,6 +121,7 @@ static const char *strip_udi(const char *udi) {
 enum alsa_type {
     ALSA_TYPE_PLAYBACK,
     ALSA_TYPE_CAPTURE,
+    ALSA_TYPE_CONTROL,
     ALSA_TYPE_OTHER
 };
 
@@ -141,6 +142,8 @@ static enum alsa_type hal_alsa_device_get_type(LibHalContext *context, const cha
         t = ALSA_TYPE_PLAYBACK;
     else if (pa_streq(type, "capture"))
         t = ALSA_TYPE_CAPTURE;
+    else if (pa_streq(type, "control"))
+        t = ALSA_TYPE_CONTROL;
 
     libhal_free_string(type);
 
@@ -171,7 +174,8 @@ static pa_bool_t hal_alsa_device_is_modem(LibHalContext *context, const char *ud
 
 finish:
     if (dbus_error_is_set(&error)) {
-        pa_log_error("D-Bus error while parsing HAL ALSA data: %s: %s", error.name, error.message);
+        if (!dbus_error_has_name(&error, "org.freedesktop.Hal.NoSuchProperty"))
+            pa_log_error("D-Bus error while parsing HAL ALSA data: %s: %s", error.name, error.message);
         dbus_error_free(&error);
     }
 
@@ -193,10 +197,23 @@ static int hal_device_load_alsa(struct userdata *u, const char *udi, struct devi
 
     /* We only care for PCM devices */
     type = hal_alsa_device_get_type(u->context, udi);
-    if (type == ALSA_TYPE_OTHER)
+
+    /* For each ALSA card that appears the control device will be the
+     * last one to be created, this is considered part of the ALSA
+     * usperspace API. We rely on this and load our modules only when
+     * the control device is available assuming that *all* device
+     * nodes have been properly created and assigned the right ACLs at
+     * that time. Also see:
+     *
+     * http://mailman.alsa-project.org/pipermail/alsa-devel/2009-April/015958.html
+     *
+     * and the associated thread.*/
+
+    if (type != ALSA_TYPE_CONTROL)
         goto fail;
 
-    /* We don't care for modems */
+    /* We don't care for modems -- this is most likely not set for
+     * control devices, so kind of pointless here. */
     if (hal_alsa_device_is_modem(u->context, udi))
         goto fail;
 
@@ -411,9 +428,10 @@ static int hal_device_add_all(struct userdata *u) {
         for (i = 0; i < n; i++) {
             struct device *d;
 
-            if ((d = hal_device_add(u, udis[i])))
+            if ((d = hal_device_add(u, udis[i]))) {
                 count++;
-            else
+                pa_log_debug("Loaded device %s", udis[i]);
+            } else
                 pa_log_debug("Not loaded device %s", udis[i]);
         }
     }
@@ -449,6 +467,8 @@ static void device_added_cb(LibHalContext *context, const char *udi) {
 
     if (!hal_device_add(u, udi))
         pa_log_debug("Not loaded device %s", udi);
+    else
+        pa_log_debug("Loaded device %s", udi);
 
 finish:
     if (dbus_error_is_set(&error)) {

-- 
hooks/post-receive
PulseAudio Sound Server



More information about the pulseaudio-commits mailing list