rpms/pulseaudio/F-11 0001-alsa-allow-configuration-of-fallback-device-strings.patch, NONE, 1.1 0001-alsa-be-a-bit-more-verbose-when-a-hwparam-call-fail.patch, NONE, 1.1 0001-alsa-don-t-hit-an-assert-when-invalid-module-argume.patch, NONE, 1.1 0001-alsa-fix-wording-we-are-speaking-of-card-profiles.patch, NONE, 1.1 0001-alsa-initialize-buffer-size-before-number-of-period.patch, NONE, 1.1 0001-conf-remove-obsolete-module-idle-time-directive-fro.patch, NONE, 1.1 0001-core-cache-requested-latency-only-when-we-are-runni.patch, NONE, 1.1 0001-core-introduce-pa_-sink-source-_set_fixed_latency.patch, NONE, 1.1 0001-core-make-sure-soft-mute-status-stays-in-sync-with.patch, NONE, 1.1 0001-endian-fix-LE-BE-order-for-24-bit-accessor-function.patch, NONE, 1.1 0001-idxset-add-enumeration-macro-PA_IDXSET_FOREACH.patch, NONE, 1.1 0001-log-print-file-name-only-when-we-have-it.patch, NONE, 1.1 0001-man-document-24bit-sample-types-in-man-page.patch, NONE, 1.1 0001-man-document-log-related-daemon.conf-options.patch, NONE, 1.1 0001-man-document-that-tsched-doesn-t-use-fragment-setti.patch, NONE, 1.1 0001-mutex-when-we-fail-to-fill-in-mutex-into-static-mut.patch, NONE, 1.1 0001-oss-don-t-deadlock-when-we-try-to-resume-an-OSS-dev.patch, NONE, 1.1 0001-rescue-make-we-don-t-end-up-in-an-endless-loop-when.patch, NONE, 1.1 0001-rescue-streams-when-one-stream-move-fails-try-to-co.patch, NONE, 1.1 0001-sample-correctly-pass-s24-32-formats.patch, NONE, 1.1 0001-sample-util-fix-iteration-loop-when-adjusting-volum.patch, NONE, 1.1 0001-sample-util-properly-allocate-silence-block-for-s24.patch, NONE, 1.1 0001-sconv-fix-a-few-minor-conversion-issues.patch, NONE, 1.1 0001-shm-page-align-shm-size-when-mmap-ing-it.patch, NONE, 1.1 0001-simple-protocol-don-t-hit-an-assert-when-we-call-co.patch, NONE, 1.1 0001-util-if-NULL-is-passed-to-pa_path_get_filename-ju.patch, NONE, 1.1 pulseaudio.spec, 1.81, 1.82

Lennart Poettering lennart at fedoraproject.org
Mon Jun 8 16:10:28 UTC 2009


Author: lennart

Update of /cvs/pkgs/rpms/pulseaudio/F-11
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv30664

Modified Files:
	pulseaudio.spec 
Added Files:
	0001-alsa-allow-configuration-of-fallback-device-strings.patch 
	0001-alsa-be-a-bit-more-verbose-when-a-hwparam-call-fail.patch 
	0001-alsa-don-t-hit-an-assert-when-invalid-module-argume.patch 
	0001-alsa-fix-wording-we-are-speaking-of-card-profiles.patch 
	0001-alsa-initialize-buffer-size-before-number-of-period.patch 
	0001-conf-remove-obsolete-module-idle-time-directive-fro.patch 
	0001-core-cache-requested-latency-only-when-we-are-runni.patch 
	0001-core-introduce-pa_-sink-source-_set_fixed_latency.patch 
	0001-core-make-sure-soft-mute-status-stays-in-sync-with.patch 
	0001-endian-fix-LE-BE-order-for-24-bit-accessor-function.patch 
	0001-idxset-add-enumeration-macro-PA_IDXSET_FOREACH.patch 
	0001-log-print-file-name-only-when-we-have-it.patch 
	0001-man-document-24bit-sample-types-in-man-page.patch 
	0001-man-document-log-related-daemon.conf-options.patch 
	0001-man-document-that-tsched-doesn-t-use-fragment-setti.patch 
	0001-mutex-when-we-fail-to-fill-in-mutex-into-static-mut.patch 
	0001-oss-don-t-deadlock-when-we-try-to-resume-an-OSS-dev.patch 
	0001-rescue-make-we-don-t-end-up-in-an-endless-loop-when.patch 
	0001-rescue-streams-when-one-stream-move-fails-try-to-co.patch 
	0001-sample-correctly-pass-s24-32-formats.patch 
	0001-sample-util-fix-iteration-loop-when-adjusting-volum.patch 
	0001-sample-util-properly-allocate-silence-block-for-s24.patch 
	0001-sconv-fix-a-few-minor-conversion-issues.patch 
	0001-shm-page-align-shm-size-when-mmap-ing-it.patch 
	0001-simple-protocol-don-t-hit-an-assert-when-we-call-co.patch 
	0001-util-if-NULL-is-passed-to-pa_path_get_filename-ju.patch 
Log Message:
Fix a couple of issues, including #497742, #494851

0001-alsa-allow-configuration-of-fallback-device-strings.patch:

--- NEW FILE 0001-alsa-allow-configuration-of-fallback-device-strings.patch ---
>From d8710711fb0c74b4ad83ac99c2501218155b502b Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart at poettering.net>
Date: Wed, 29 Apr 2009 01:58:18 +0200
Subject: [PATCH] alsa: allow configuration of fallback device strings in profiles

This has the benefit that we can properly support ALSA devices where
only the raw 'hw' device exists but no 'front' although it's a proper
2ch stereo device.
---
 src/modules/alsa/alsa-util.c |  126 +++++++++++++++++++++++++++++------------
 src/modules/alsa/alsa-util.h |    1 +
 2 files changed, 90 insertions(+), 37 deletions(-)

diff --git a/src/modules/alsa/alsa-util.c b/src/modules/alsa/alsa-util.c
index 18d6880..a3a0450 100644
--- a/src/modules/alsa/alsa-util.c
+++ b/src/modules/alsa/alsa-util.c
@@ -528,7 +528,7 @@ int pa_alsa_set_sw_params(snd_pcm_t *pcm, snd_pcm_uframes_t avail_min) {
 
 static const struct pa_alsa_profile_info device_table[] = {
     {{ 1, { PA_CHANNEL_POSITION_MONO }},
-     "hw",
+     "hw", NULL,
      N_("Analog Mono"),
      "analog-mono",
      1,
@@ -536,7 +536,7 @@ static const struct pa_alsa_profile_info device_table[] = {
      "Capture", "Mic" },
 
     {{ 2, { PA_CHANNEL_POSITION_LEFT, PA_CHANNEL_POSITION_RIGHT }},
-     "front",
+     "front", "hw",
      N_("Analog Stereo"),
      "analog-stereo",
      10,
@@ -544,7 +544,7 @@ static const struct pa_alsa_profile_info device_table[] = {
      "Capture", "Mic" },
 
     {{ 2, { PA_CHANNEL_POSITION_LEFT, PA_CHANNEL_POSITION_RIGHT }},
-     "iec958",
+     "iec958", NULL,
      N_("Digital Stereo (IEC958)"),
      "iec958-stereo",
      5,
@@ -552,7 +552,7 @@ static const struct pa_alsa_profile_info device_table[] = {
      "IEC958 In", NULL },
 
     {{ 2, { PA_CHANNEL_POSITION_LEFT, PA_CHANNEL_POSITION_RIGHT }},
-     "hdmi",
+     "hdmi", NULL,
      N_("Digital Stereo (HDMI)"),
      "hdmi-stereo",
      4,
@@ -561,7 +561,7 @@ static const struct pa_alsa_profile_info device_table[] = {
 
     {{ 4, { PA_CHANNEL_POSITION_FRONT_LEFT, PA_CHANNEL_POSITION_FRONT_RIGHT,
             PA_CHANNEL_POSITION_REAR_LEFT, PA_CHANNEL_POSITION_REAR_RIGHT }},
-     "surround40",
+     "surround40", NULL,
      N_("Analog Surround 4.0"),
      "analog-surround-40",
      7,
@@ -570,7 +570,7 @@ static const struct pa_alsa_profile_info device_table[] = {
 
     {{ 4, { PA_CHANNEL_POSITION_FRONT_LEFT, PA_CHANNEL_POSITION_FRONT_RIGHT,
             PA_CHANNEL_POSITION_REAR_LEFT, PA_CHANNEL_POSITION_REAR_RIGHT }},
-     "a52",
+     "a52", NULL,
      N_("Digital Surround 4.0 (IEC958/AC3)"),
      "iec958-ac3-surround-40",
      2,
@@ -580,7 +580,7 @@ static const struct pa_alsa_profile_info device_table[] = {
     {{ 5, { PA_CHANNEL_POSITION_FRONT_LEFT, PA_CHANNEL_POSITION_FRONT_RIGHT,
             PA_CHANNEL_POSITION_REAR_LEFT, PA_CHANNEL_POSITION_REAR_RIGHT,
             PA_CHANNEL_POSITION_LFE }},
-     "surround41",
+     "surround41", NULL,
      N_("Analog Surround 4.1"),
      "analog-surround-41",
      7,
@@ -590,7 +590,7 @@ static const struct pa_alsa_profile_info device_table[] = {
     {{ 5, { PA_CHANNEL_POSITION_FRONT_LEFT, PA_CHANNEL_POSITION_FRONT_RIGHT,
             PA_CHANNEL_POSITION_REAR_LEFT, PA_CHANNEL_POSITION_REAR_RIGHT,
             PA_CHANNEL_POSITION_CENTER }},
-     "surround50",
+     "surround50", NULL,
      N_("Analog Surround 5.0"),
      "analog-surround-50",
      7,
@@ -600,7 +600,7 @@ static const struct pa_alsa_profile_info device_table[] = {
     {{ 6, { PA_CHANNEL_POSITION_FRONT_LEFT, PA_CHANNEL_POSITION_FRONT_RIGHT,
             PA_CHANNEL_POSITION_REAR_LEFT, PA_CHANNEL_POSITION_REAR_RIGHT,
             PA_CHANNEL_POSITION_CENTER, PA_CHANNEL_POSITION_LFE }},
-     "surround51",
+     "surround51", NULL,
      N_("Analog Surround 5.1"),
      "analog-surround-51",
      8,
@@ -610,7 +610,7 @@ static const struct pa_alsa_profile_info device_table[] = {
     {{ 6, { PA_CHANNEL_POSITION_FRONT_LEFT, PA_CHANNEL_POSITION_FRONT_RIGHT,
             PA_CHANNEL_POSITION_REAR_LEFT, PA_CHANNEL_POSITION_REAR_RIGHT,
             PA_CHANNEL_POSITION_FRONT_CENTER, PA_CHANNEL_POSITION_LFE}},
-     "a52",
+     "a52", NULL,
      N_("Digital Surround 5.1 (IEC958/AC3)"),
      "iec958-ac3-surround-51",
      3,
@@ -621,16 +621,72 @@ static const struct pa_alsa_profile_info device_table[] = {
             PA_CHANNEL_POSITION_REAR_LEFT, PA_CHANNEL_POSITION_REAR_RIGHT,
             PA_CHANNEL_POSITION_CENTER, PA_CHANNEL_POSITION_LFE,
             PA_CHANNEL_POSITION_SIDE_LEFT, PA_CHANNEL_POSITION_SIDE_RIGHT }},
-     "surround71",
+     "surround71", NULL,
      N_("Analog Surround 7.1"),
      "analog-surround-71",
      7,
      "Master", "PCM",
      "Capture", "Mic" },
 
-    {{ 0, { 0 }}, NULL, NULL, NULL, 0, NULL, NULL, NULL, NULL }
+    {{ 0, { 0 }}, NULL, NULL, NULL, NULL, 0, NULL, NULL, NULL, NULL }
 };
 
+static snd_pcm_t *open_by_device_string_with_fallback(
+        const char *prefix,
+        const char *prefix_fallback,
+        const char *dev_id,
+        char **dev,
+        pa_sample_spec *ss,
+        pa_channel_map* map,
+        int mode,
+        uint32_t *nfrags,
+        snd_pcm_uframes_t *period_size,
+        snd_pcm_uframes_t tsched_size,
+        pa_bool_t *use_mmap,
+        pa_bool_t *use_tsched,
+        pa_bool_t require_exact_channel_number) {
+
+    snd_pcm_t *pcm_handle;
+    char *d;
+
+    d = pa_sprintf_malloc("%s:%s", prefix, dev_id);
+
+    pcm_handle = pa_alsa_open_by_device_string(
+            d,
+            dev,
+            ss,
+            map,
+            mode,
+            nfrags,
+            period_size,
+            tsched_size,
+            use_mmap,
+            use_tsched,
+            require_exact_channel_number);
+    pa_xfree(d);
+
+    if (!pcm_handle && prefix_fallback) {
+
+        d = pa_sprintf_malloc("%s:%s", prefix_fallback, dev_id);
+
+        pcm_handle = pa_alsa_open_by_device_string(
+                d,
+                dev,
+                ss,
+                map,
+                mode,
+                nfrags,
+                period_size,
+                tsched_size,
+                use_mmap,
+                use_tsched,
+                require_exact_channel_number);
+        pa_xfree(d);
+    }
+
+    return pcm_handle;
+}
+
 snd_pcm_t *pa_alsa_open_by_device_id_auto(
         const char *dev_id,
         char **dev,
@@ -671,14 +727,14 @@ snd_pcm_t *pa_alsa_open_by_device_id_auto(
 
             pa_log_debug("Checking for %s (%s)", device_table[i].name, device_table[i].alsa_name);
 
-            d = pa_sprintf_malloc("%s:%s", device_table[i].alsa_name, dev_id);
-
             try_ss.channels = device_table[i].map.channels;
             try_ss.rate = ss->rate;
             try_ss.format = ss->format;
 
-            pcm_handle = pa_alsa_open_by_device_string(
-                    d,
+            pcm_handle = open_by_device_string_with_fallback(
+                    device_table[i].alsa_name,
+                    device_table[i].alsa_name_fallback,
+                    dev_id,
                     dev,
                     &try_ss,
                     map,
@@ -690,8 +746,6 @@ snd_pcm_t *pa_alsa_open_by_device_id_auto(
                     use_tsched,
                     TRUE);
 
-            pa_xfree(d);
-
             if (pcm_handle) {
 
                 *ss = try_ss;
@@ -703,6 +757,7 @@ snd_pcm_t *pa_alsa_open_by_device_id_auto(
 
                 return pcm_handle;
             }
+
         }
 
         if (direction > 0) {
@@ -775,7 +830,6 @@ snd_pcm_t *pa_alsa_open_by_device_id_profile(
         pa_bool_t *use_tsched,
         const pa_alsa_profile_info *profile) {
 
-    char *d;
     snd_pcm_t *pcm_handle;
     pa_sample_spec try_ss;
 
@@ -787,14 +841,14 @@ snd_pcm_t *pa_alsa_open_by_device_id_profile(
     pa_assert(period_size);
     pa_assert(profile);
 
-    d = pa_sprintf_malloc("%s:%s", profile->alsa_name, dev_id);
-
     try_ss.channels = profile->map.channels;
     try_ss.rate = ss->rate;
     try_ss.format = ss->format;
 
-    pcm_handle = pa_alsa_open_by_device_string(
-            d,
+    pcm_handle = open_by_device_string_with_fallback(
+            profile->alsa_name,
+            profile->alsa_name_fallback,
+            dev_id,
             dev,
             &try_ss,
             map,
@@ -806,8 +860,6 @@ snd_pcm_t *pa_alsa_open_by_device_id_profile(
             use_tsched,
             TRUE);
 
-    pa_xfree(d);
-
     if (!pcm_handle)
         return NULL;
 
@@ -860,6 +912,8 @@ snd_pcm_t *pa_alsa_open_by_device_string(
             goto fail;
         }
 
+        pa_log_debug("Managed to open %s", d);
+
         if ((err = pa_alsa_set_hw_params(pcm_handle, ss, nfrags, period_size, tsched_size, use_mmap, use_tsched, require_exact_channel_number)) < 0) {
 
             if (!reformat) {
@@ -928,26 +982,25 @@ int pa_alsa_probe_profiles(
         snd_pcm_t *pcm_i = NULL;
 
         if (i->alsa_name) {
-            char *id;
             pa_sample_spec try_ss;
             pa_channel_map try_map;
 
             pa_log_debug("Checking for playback on %s (%s)", i->name, i->alsa_name);
-            id = pa_sprintf_malloc("%s:%s", i->alsa_name, dev_id);
 
             try_ss = *ss;
             try_ss.channels = i->map.channels;
             try_map = i->map;
 
-            pcm_i = pa_alsa_open_by_device_string(
-                    id, NULL,
+            pcm_i = open_by_device_string_with_fallback(
+                    i->alsa_name,
+                    i->alsa_name_fallback,
+                    dev_id,
+                    NULL,
                     &try_ss, &try_map,
                     SND_PCM_STREAM_PLAYBACK,
                     NULL, NULL, 0, NULL, NULL,
                     TRUE);
 
-            pa_xfree(id);
-
             if (!pcm_i)
                 continue;
         }
@@ -956,26 +1009,25 @@ int pa_alsa_probe_profiles(
             snd_pcm_t *pcm_j = NULL;
 
             if (j->alsa_name) {
-                char *jd;
                 pa_sample_spec try_ss;
                 pa_channel_map try_map;
 
                 pa_log_debug("Checking for capture on %s (%s)", j->name, j->alsa_name);
-                jd = pa_sprintf_malloc("%s:%s", j->alsa_name, dev_id);
 
                 try_ss = *ss;
                 try_ss.channels = j->map.channels;
                 try_map = j->map;
 
-                pcm_j = pa_alsa_open_by_device_string(
-                        jd, NULL,
+                pcm_j = open_by_device_string_with_fallback(
+                        j->alsa_name,
+                        j->alsa_name_fallback,
+                        dev_id,
+                        NULL,
                         &try_ss, &try_map,
                         SND_PCM_STREAM_CAPTURE,
                         NULL, NULL, 0, NULL, NULL,
                         TRUE);
 
-                pa_xfree(jd);
-
                 if (!pcm_j)
                     continue;
             }
diff --git a/src/modules/alsa/alsa-util.h b/src/modules/alsa/alsa-util.h
index 77ac8a7..4c5d336 100644
--- a/src/modules/alsa/alsa-util.h
+++ b/src/modules/alsa/alsa-util.h
@@ -56,6 +56,7 @@ int pa_alsa_set_sw_params(snd_pcm_t *pcm, snd_pcm_uframes_t avail_min);
 typedef struct pa_alsa_profile_info {
     pa_channel_map map;
     const char *alsa_name;
+    const char *alsa_name_fallback;
     const char *description; /* internationalized */
     const char *name;
     unsigned priority;
-- 
1.6.2.2


0001-alsa-be-a-bit-more-verbose-when-a-hwparam-call-fail.patch:

--- NEW FILE 0001-alsa-be-a-bit-more-verbose-when-a-hwparam-call-fail.patch ---
>From 0cb383717e1e65847f3ede7f3c904caff9129c93 Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart at poettering.net>
Date: Thu, 14 May 2009 01:25:07 +0200
Subject: [PATCH] alsa: be a bit more verbose when a hwparam call fails

---
 src/modules/alsa/alsa-util.c |   45 ++++++++++++++++++++++++++++++++++-------
 1 files changed, 37 insertions(+), 8 deletions(-)

diff --git a/src/modules/alsa/alsa-util.c b/src/modules/alsa/alsa-util.c
index 17c7c80..c03866c 100644
--- a/src/modules/alsa/alsa-util.c
+++ b/src/modules/alsa/alsa-util.c
@@ -272,6 +272,11 @@ static int set_format(snd_pcm_t *pcm_handle, snd_pcm_hw_params_t *hwparams, pa_s
     if ((ret = snd_pcm_hw_params_set_format(pcm_handle, hwparams, format_trans[*f])) >= 0)
         return ret;
 
+    pa_log_debug("snd_pcm_hw_params_set_format(%s) failed: %s",
+                 snd_pcm_format_description(format_trans[*f]),
+                 pa_alsa_strerror(ret));
+
+
     if (*f == PA_SAMPLE_FLOAT32BE)
         *f = PA_SAMPLE_FLOAT32LE;
     else if (*f == PA_SAMPLE_FLOAT32LE)
@@ -298,6 +303,10 @@ static int set_format(snd_pcm_t *pcm_handle, snd_pcm_hw_params_t *hwparams, pa_s
     if ((ret = snd_pcm_hw_params_set_format(pcm_handle, hwparams, format_trans[*f])) >= 0)
         return ret;
 
+    pa_log_debug("snd_pcm_hw_params_set_format(%s) failed: %s",
+                 snd_pcm_format_description(format_trans[*f]),
+                 pa_alsa_strerror(ret));
+
 try_auto:
 
     for (i = 0; try_order[i] != PA_SAMPLE_INVALID; i++) {
@@ -305,6 +314,10 @@ try_auto:
 
         if ((ret = snd_pcm_hw_params_set_format(pcm_handle, hwparams, format_trans[*f])) >= 0)
             return ret;
+
+        pa_log_debug("snd_pcm_hw_params_set_format(%s) failed: %s",
+                     snd_pcm_format_description(format_trans[*f]),
+                     pa_alsa_strerror(ret));
     }
 
     return -1;
@@ -338,11 +351,15 @@ int pa_alsa_set_hw_params(
 
     snd_pcm_hw_params_alloca(&hwparams);
 
-    if ((ret = snd_pcm_hw_params_any(pcm_handle, hwparams)) < 0)
+    if ((ret = snd_pcm_hw_params_any(pcm_handle, hwparams)) < 0) {
+        pa_log_debug("snd_pcm_hw_params_any() failed: %s", pa_alsa_strerror(ret));
         goto finish;
+    }
 
-    if ((ret = snd_pcm_hw_params_set_rate_resample(pcm_handle, hwparams, 0)) < 0)
+    if ((ret = snd_pcm_hw_params_set_rate_resample(pcm_handle, hwparams, 0)) < 0) {
+        pa_log_debug("snd_pcm_hw_params_set_rate_resample() failed: %s", pa_alsa_strerror(ret));
         goto finish;
+    }
 
     if (_use_mmap) {
 
@@ -350,14 +367,18 @@ int pa_alsa_set_hw_params(
 
             /* mmap() didn't work, fall back to interleaved */
 
-            if ((ret = snd_pcm_hw_params_set_access(pcm_handle, hwparams, SND_PCM_ACCESS_RW_INTERLEAVED)) < 0)
+            if ((ret = snd_pcm_hw_params_set_access(pcm_handle, hwparams, SND_PCM_ACCESS_RW_INTERLEAVED)) < 0) {
+                pa_log_debug("snd_pcm_hw_params_set_access() failed: %s", pa_alsa_strerror(ret));
                 goto finish;
+            }
 
             _use_mmap = FALSE;
         }
 
-    } else if ((ret = snd_pcm_hw_params_set_access(pcm_handle, hwparams, SND_PCM_ACCESS_RW_INTERLEAVED)) < 0)
+    } else if ((ret = snd_pcm_hw_params_set_access(pcm_handle, hwparams, SND_PCM_ACCESS_RW_INTERLEAVED)) < 0) {
+        pa_log_debug("snd_pcm_hw_params_set_access() failed: %s", pa_alsa_strerror(ret));
         goto finish;
+    }
 
     if (!_use_mmap)
         _use_tsched = FALSE;
@@ -365,19 +386,27 @@ int pa_alsa_set_hw_params(
     if ((ret = set_format(pcm_handle, hwparams, &f)) < 0)
         goto finish;
 
-    if ((ret = snd_pcm_hw_params_set_rate_near(pcm_handle, hwparams, &r, NULL)) < 0)
+    if ((ret = snd_pcm_hw_params_set_rate_near(pcm_handle, hwparams, &r, NULL)) < 0) {
+        pa_log_debug("snd_pcm_hw_params_set_rate_near() failed: %s", pa_alsa_strerror(ret));
         goto finish;
+    }
 
     if (require_exact_channel_number) {
-        if ((ret = snd_pcm_hw_params_set_channels(pcm_handle, hwparams, c)) < 0)
+        if ((ret = snd_pcm_hw_params_set_channels(pcm_handle, hwparams, c)) < 0) {
+            pa_log_debug("snd_pcm_hw_params_set_channels() failed: %s", pa_alsa_strerror(ret));
             goto finish;
+        }
     } else {
-        if ((ret = snd_pcm_hw_params_set_channels_near(pcm_handle, hwparams, &c)) < 0)
+        if ((ret = snd_pcm_hw_params_set_channels_near(pcm_handle, hwparams, &c)) < 0) {
+            pa_log_debug("snd_pcm_hw_params_set_channels_near() failed: %s", pa_alsa_strerror(ret));
             goto finish;
+        }
     }
 
-    if ((ret = snd_pcm_hw_params_set_periods_integer(pcm_handle, hwparams)) < 0)
+    if ((ret = snd_pcm_hw_params_set_periods_integer(pcm_handle, hwparams)) < 0) {
+        pa_log_debug("snd_pcm_hw_params_set_periods_integer() failed: %s", pa_alsa_strerror(ret));
         goto finish;
+    }
 
     if (_period_size && tsched_size && _periods) {
 
-- 
1.6.2.2


0001-alsa-don-t-hit-an-assert-when-invalid-module-argume.patch:

--- NEW FILE 0001-alsa-don-t-hit-an-assert-when-invalid-module-argume.patch ---
>From 4129f5119407da54708d1504c0ffa2d0888fa804 Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart at poettering.net>
Date: Fri, 1 May 2009 04:11:30 +0200
Subject: [PATCH] alsa: don't hit an assert when invalid module arguments are passed

---
 src/modules/alsa/alsa-sink.c   |    3 ++-
 src/modules/alsa/alsa-source.c |    3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/modules/alsa/alsa-sink.c b/src/modules/alsa/alsa-sink.c
index 41e8b47..4d8dade 100644
--- a/src/modules/alsa/alsa-sink.c
+++ b/src/modules/alsa/alsa-sink.c
@@ -1770,7 +1770,8 @@ pa_sink *pa_alsa_sink_new(pa_module *m, pa_modargs *ma, const char*driver, pa_ca
 
 fail:
 
-    userdata_free(u);
+    if (u)
+        userdata_free(u);
 
     return NULL;
 }
diff --git a/src/modules/alsa/alsa-source.c b/src/modules/alsa/alsa-source.c
index 843f70b..d49035c 100644
--- a/src/modules/alsa/alsa-source.c
+++ b/src/modules/alsa/alsa-source.c
@@ -1621,7 +1621,8 @@ pa_source *pa_alsa_source_new(pa_module *m, pa_modargs *ma, const char*driver, p
 
 fail:
 
-    userdata_free(u);
+    if (u)
+        userdata_free(u);
 
     return NULL;
 }
-- 
1.6.2.2


0001-alsa-fix-wording-we-are-speaking-of-card-profiles.patch:

--- NEW FILE 0001-alsa-fix-wording-we-are-speaking-of-card-profiles.patch ---
>From d2198c9ba1acb070b14747c49afaff87e85daa81 Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart at poettering.net>
Date: Tue, 26 May 2009 22:29:33 +0200
Subject: [PATCH] alsa: fix wording, we are speaking of card profiles, not output profiles

---
 src/modules/alsa/module-alsa-card.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/modules/alsa/module-alsa-card.c b/src/modules/alsa/module-alsa-card.c
index 51d466e..d894b9c 100644
--- a/src/modules/alsa/module-alsa-card.c
+++ b/src/modules/alsa/module-alsa-card.c
@@ -135,7 +135,7 @@ static void enumerate_cb(
             bonus += 20000;
     }
 
-    pa_log_info("Found output profile '%s'", t);
+    pa_log_info("Found profile '%s'", t);
 
     p = pa_card_profile_new(n, t, sizeof(struct profile_data));
 
-- 
1.6.2.2


0001-alsa-initialize-buffer-size-before-number-of-period.patch:

--- NEW FILE 0001-alsa-initialize-buffer-size-before-number-of-period.patch ---
>From 4bffc7849f7898fa85dd6ac8e735db86b57814b3 Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart at poettering.net>
Date: Fri, 1 May 2009 04:16:17 +0200
Subject: [PATCH] alsa: initialize buffer size before number of periods to improve compat with some backends

---
 src/modules/alsa/alsa-util.c |   33 ++++++++++++++++++++-------------
 1 files changed, 20 insertions(+), 13 deletions(-)

diff --git a/src/modules/alsa/alsa-util.c b/src/modules/alsa/alsa-util.c
index a3a0450..107bec3 100644
--- a/src/modules/alsa/alsa-util.c
+++ b/src/modules/alsa/alsa-util.c
@@ -334,7 +334,6 @@ int pa_alsa_set_hw_params(
     int ret = -1;
     snd_pcm_uframes_t _period_size = period_size ? *period_size : 0;
     unsigned int _periods = periods ? *periods : 0;
-    snd_pcm_uframes_t buffer_size;
     unsigned int r = ss->rate;
     unsigned int c = ss->channels;
     pa_sample_format_t f = ss->format;
@@ -390,39 +389,47 @@ int pa_alsa_set_hw_params(
         goto finish;
 
     if (_period_size && tsched_size && _periods) {
+
         /* Adjust the buffer sizes, if we didn't get the rate we were asking for */
         _period_size = (snd_pcm_uframes_t) (((uint64_t) _period_size * r) / ss->rate);
         tsched_size = (snd_pcm_uframes_t) (((uint64_t) tsched_size * r) / ss->rate);
 
         if (_use_tsched) {
-            _period_size = tsched_size;
-            _periods = 1;
+            snd_pcm_uframes_t buffer_size;
 
             pa_assert_se(snd_pcm_hw_params_get_buffer_size_max(hwparams, &buffer_size) == 0);
             pa_log_debug("Maximum hw buffer size is %u ms", (unsigned) buffer_size * 1000 / r);
+
+            _period_size = tsched_size;
+            _periods = 1;
         }
 
-        buffer_size = _periods * _period_size;
+        if (_period_size > 0 && _periods > 0) {
+            snd_pcm_uframes_t buffer_size;
+
+            buffer_size = _periods * _period_size;
+
+            if ((ret = snd_pcm_hw_params_set_buffer_size_near(pcm_handle, hwparams, &buffer_size)) < 0)
+                pa_log_info("snd_pcm_hw_params_set_buffer_size_near() failed: %s", pa_alsa_strerror(ret));
+        }
 
         if (_periods > 0) {
 
-            /* First we pass 0 as direction to get exactly what we asked
-             * for. That this is necessary is presumably a bug in ALSA */
+            /* First we pass 0 as direction to get exactly what we
+             * asked for. That this is necessary is presumably a bug
+             * in ALSA. All in all this is mostly a hint to ALSA, so
+             * we don't care if this fails. */
 
             dir = 0;
-            if ((ret = snd_pcm_hw_params_set_periods_near(pcm_handle, hwparams, &_periods, &dir)) < 0) {
+            if (snd_pcm_hw_params_set_periods_near(pcm_handle, hwparams, &_periods, &dir) < 0) {
                 dir = 1;
-                if ((ret = snd_pcm_hw_params_set_periods_near(pcm_handle, hwparams, &_periods, &dir)) < 0) {
+                if (snd_pcm_hw_params_set_periods_near(pcm_handle, hwparams, &_periods, &dir) < 0) {
                     dir = -1;
                     if ((ret = snd_pcm_hw_params_set_periods_near(pcm_handle, hwparams, &_periods, &dir)) < 0)
-                        goto finish;
+                        pa_log_info("snd_pcm_hw_params_set_periods_near() failed: %s", pa_alsa_strerror(ret));
                 }
             }
         }
-
-        if (_period_size > 0)
-            if ((ret = snd_pcm_hw_params_set_buffer_size_near(pcm_handle, hwparams, &buffer_size)) < 0)
-                goto finish;
     }
 
     if  ((ret = snd_pcm_hw_params(pcm_handle, hwparams)) < 0)
-- 
1.6.2.2


0001-conf-remove-obsolete-module-idle-time-directive-fro.patch:

--- NEW FILE 0001-conf-remove-obsolete-module-idle-time-directive-fro.patch ---
>From 78bccde2264c439702b103fd8491d9f56c79f54f Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart at poettering.net>
Date: Sun, 7 Jun 2009 00:44:16 +0200
Subject: [PATCH] conf: remove obsolete module-idle-time directive from default config file/man page

---
 man/pulse-daemon.conf.5.xml.in |    7 -------
 src/daemon/daemon.conf.in      |    1 -
 2 files changed, 0 insertions(+), 8 deletions(-)

diff --git a/man/pulse-daemon.conf.5.xml.in b/man/pulse-daemon.conf.5.xml.in
index b4a7fdb..a7c49a4 100644
--- a/man/pulse-daemon.conf.5.xml.in
+++ b/man/pulse-daemon.conf.5.xml.in
@@ -236,13 +236,6 @@ USA.
     </option>
 
     <option>
-      <p><opt>module-idle-time=</opt> Unload autoloaded modules after
-      being idle for this time in seconds. Defaults to 20. The
-      <opt>--module-idle-time</opt> command line option takes
-      precedence.</p>
-    </option>
-
-    <option>
       <p><opt>scache-idle-time=</opt> Unload autoloaded sample cache
       entries after being idle for this time in seconds. Defaults to
       20. The <opt>--scache-idle-time</opt> command line option takes
diff --git a/src/daemon/daemon.conf.in b/src/daemon/daemon.conf.in
index 746ea76..d119716 100644
--- a/src/daemon/daemon.conf.in
+++ b/src/daemon/daemon.conf.in
@@ -37,7 +37,6 @@
 ; realtime-priority = 5
 
 ; exit-idle-time = 20
-; module-idle-time = 20
 ; scache-idle-time = 20
 
 ; dl-search-path = (depends on architecture)
-- 
1.6.2.2


0001-core-cache-requested-latency-only-when-we-are-runni.patch:

--- NEW FILE 0001-core-cache-requested-latency-only-when-we-are-runni.patch ---
>From 8d9c26e3b6d29d3922a7cc740f273e34ea97498e Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart at poettering.net>
Date: Fri, 8 May 2009 02:02:36 +0200
Subject: [PATCH] core: cache requested latency only when we are running, not while we are still constructing

---
 src/pulsecore/sink.c   |    7 +++++--
 src/pulsecore/source.c |    7 +++++--
 2 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/src/pulsecore/sink.c b/src/pulsecore/sink.c
index 3eb759c..0f594da 100644
--- a/src/pulsecore/sink.c
+++ b/src/pulsecore/sink.c
@@ -1858,8 +1858,11 @@ pa_usec_t pa_sink_get_requested_latency_within_thread(pa_sink *s) {
     if (result != (pa_usec_t) -1)
         result = PA_CLAMP(result, s->thread_info.min_latency, s->thread_info.max_latency);
 
-    s->thread_info.requested_latency = result;
-    s->thread_info.requested_latency_valid = TRUE;
+    if (PA_SINK_IS_LINKED(s->thread_info.state)) {
+        /* Only cache if properly initialized */
+        s->thread_info.requested_latency = result;
+        s->thread_info.requested_latency_valid = TRUE;
+    }
 
     return result;
 }
diff --git a/src/pulsecore/source.c b/src/pulsecore/source.c
index 92387f6..47bc5fb 100644
--- a/src/pulsecore/source.c
+++ b/src/pulsecore/source.c
@@ -1113,8 +1113,11 @@ pa_usec_t pa_source_get_requested_latency_within_thread(pa_source *s) {
     if (result != (pa_usec_t) -1)
         result = PA_CLAMP(result, s->thread_info.min_latency, s->thread_info.max_latency);
 
-    s->thread_info.requested_latency = result;
-    s->thread_info.requested_latency_valid = TRUE;
+    if (PA_SOURCE_IS_LINKED(s->thread_info.state)) {
+        /* Only cache this if we are fully set up */
+        s->thread_info.requested_latency = result;
+        s->thread_info.requested_latency_valid = TRUE;
+    }
 
     return result;
 }
-- 
1.6.2.2


0001-core-introduce-pa_-sink-source-_set_fixed_latency.patch:

--- NEW FILE 0001-core-introduce-pa_-sink-source-_set_fixed_latency.patch ---
>From 3766850c8b98b3fe8abb3b5634d4801cbdb95377 Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart at poettering.net>
Date: Fri, 8 May 2009 01:56:21 +0200
Subject: [PATCH] core: introduce pa_{sink,source}_set_fixed_latency()

This allows us to forward the fixed latency directly from the sink to
the monitor source withut having to wait for pa_sink_put().
---
 src/modules/alsa/alsa-sink.c                    |    4 ++--
 src/modules/alsa/alsa-source.c                  |    4 ++--
 src/modules/bluetooth/module-bluetooth-device.c |   12 ++++++------
 src/modules/module-pipe-sink.c                  |    2 +-
 src/modules/module-pipe-source.c                |    2 +-
 src/modules/module-sine-source.c                |    3 +--
 src/modules/oss/module-oss.c                    |    4 ++--
 src/pulsecore/sink.c                            |   16 ++++++++++++++++
 src/pulsecore/sink.h                            |    1 +
 src/pulsecore/source.c                          |   15 +++++++++++++++
 src/pulsecore/source.h                          |    1 +
 11 files changed, 48 insertions(+), 16 deletions(-)

diff --git a/src/modules/alsa/alsa-sink.c b/src/modules/alsa/alsa-sink.c
index 4d8dade..2745a14 100644
--- a/src/modules/alsa/alsa-sink.c
+++ b/src/modules/alsa/alsa-sink.c
@@ -473,7 +473,7 @@ static int mmap_write(struct userdata *u, pa_usec_t *sleep_usec, pa_bool_t polle
             u->since_start += frames * u->frame_size;
 
 #ifdef DEBUG_TIMING
-            pa_log_debug("Wrote %lu bytes", (unsigned long) (frames * u->frame_size));
+            pa_log_debug("Wrote %lu bytes (of possible %lu bytes)", (unsigned long) (frames * u->frame_size), (unsigned long) n_bytes);
 #endif
 
             if ((size_t) frames * u->frame_size >= n_bytes)
@@ -1730,7 +1730,7 @@ pa_sink *pa_alsa_sink_new(pa_module *m, pa_modargs *ma, const char*driver, pa_ca
         pa_log_info("Time scheduling watermark is %0.2fms",
                     (double) pa_bytes_to_usec(u->tsched_watermark, &ss) / PA_USEC_PER_MSEC);
     } else
-        u->sink->fixed_latency = pa_bytes_to_usec(u->hwbuf_size, &ss);
+        pa_sink_set_fixed_latency(u->sink, pa_bytes_to_usec(u->hwbuf_size, &ss));
 
     reserve_update(u);
 
diff --git a/src/modules/alsa/alsa-source.c b/src/modules/alsa/alsa-source.c
index d49035c..af567c9 100644
--- a/src/modules/alsa/alsa-source.c
+++ b/src/modules/alsa/alsa-source.c
@@ -455,7 +455,7 @@ static int mmap_read(struct userdata *u, pa_usec_t *sleep_usec, pa_bool_t polled
             u->read_count += frames * u->frame_size;
 
 #ifdef DEBUG_TIMING
-            pa_log_debug("Read %lu bytes", (unsigned long) (frames * u->frame_size));
+            pa_log_debug("Read %lu bytes (of possible %lu bytes)", (unsigned long) (frames * u->frame_size), (unsigned long) n_bytes);
 #endif
 
             if ((size_t) frames * u->frame_size >= n_bytes)
@@ -1582,7 +1582,7 @@ pa_source *pa_alsa_source_new(pa_module *m, pa_modargs *ma, const char*driver, p
         pa_log_info("Time scheduling watermark is %0.2fms",
                     (double) pa_bytes_to_usec(u->tsched_watermark, &ss) / PA_USEC_PER_MSEC);
     } else
-        u->source->fixed_latency = pa_bytes_to_usec(u->hwbuf_size, &ss);
+        pa_source_set_fixed_latency(u->source, pa_bytes_to_usec(u->hwbuf_size, &ss));
 
     reserve_update(u);
 
diff --git a/src/modules/bluetooth/module-bluetooth-device.c b/src/modules/bluetooth/module-bluetooth-device.c
index ecb5e83..c5c55a1 100644
--- a/src/modules/bluetooth/module-bluetooth-device.c
+++ b/src/modules/bluetooth/module-bluetooth-device.c
@@ -1608,9 +1608,9 @@ static int add_sink(struct userdata *u) {
         u->sink->parent.process_msg = sink_process_msg;
 
         pa_sink_set_max_request(u->sink, u->block_size);
-        u->sink->fixed_latency =
-            (u->profile == PROFILE_A2DP ? FIXED_LATENCY_PLAYBACK_A2DP : FIXED_LATENCY_PLAYBACK_HSP) +
-            pa_bytes_to_usec(u->block_size, &u->sample_spec);
+        pa_sink_set_fixed_latency(u->sink,
+                                  (u->profile == PROFILE_A2DP ? FIXED_LATENCY_PLAYBACK_A2DP : FIXED_LATENCY_PLAYBACK_HSP) +
+                                  pa_bytes_to_usec(u->block_size, &u->sample_spec));
     }
 
     if (u->profile == PROFILE_HSP) {
@@ -1659,9 +1659,9 @@ static int add_source(struct userdata *u) {
         u->source->userdata = u;
         u->source->parent.process_msg = source_process_msg;
 
-        u->source->fixed_latency =
-            (/* u->profile == PROFILE_A2DP ? FIXED_LATENCY_RECORD_A2DP : */ FIXED_LATENCY_RECORD_HSP) +
-            pa_bytes_to_usec(u->block_size, &u->sample_spec);
+        pa_source_set_fixed_latency(u->source,
+                                    (/* u->profile == PROFILE_A2DP ? FIXED_LATENCY_RECORD_A2DP : */ FIXED_LATENCY_RECORD_HSP) +
+                                    pa_bytes_to_usec(u->block_size, &u->sample_spec));
     }
 
     if (u->profile == PROFILE_HSP) {
diff --git a/src/modules/module-pipe-sink.c b/src/modules/module-pipe-sink.c
index 9d3e55d..304d01c 100644
--- a/src/modules/module-pipe-sink.c
+++ b/src/modules/module-pipe-sink.c
@@ -293,7 +293,7 @@ int pa__init(pa_module*m) {
     pa_sink_set_asyncmsgq(u->sink, u->thread_mq.inq);
     pa_sink_set_rtpoll(u->sink, u->rtpoll);
     pa_sink_set_max_request(u->sink, PIPE_BUF);
-    u->sink->fixed_latency = pa_bytes_to_usec(PIPE_BUF, &u->sink->sample_spec);
+    pa_sink_set_fixed_latency(u->sink, pa_bytes_to_usec(PIPE_BUF, &u->sink->sample_spec));
 
     u->rtpoll_item = pa_rtpoll_item_new(u->rtpoll, PA_RTPOLL_NEVER, 1);
     pollfd = pa_rtpoll_item_get_pollfd(u->rtpoll_item, NULL);
diff --git a/src/modules/module-pipe-source.c b/src/modules/module-pipe-source.c
index df72d79..6ed4fbf 100644
--- a/src/modules/module-pipe-source.c
+++ b/src/modules/module-pipe-source.c
@@ -277,7 +277,7 @@ int pa__init(pa_module*m) {
 
     pa_source_set_asyncmsgq(u->source, u->thread_mq.inq);
     pa_source_set_rtpoll(u->source, u->rtpoll);
-    u->source->fixed_latency = pa_bytes_to_usec(PIPE_BUF, &u->source->sample_spec);
+    pa_source_set_fixed_latency(u->source, pa_bytes_to_usec(PIPE_BUF, &u->source->sample_spec));
 
     u->rtpoll_item = pa_rtpoll_item_new(u->rtpoll, PA_RTPOLL_NEVER, 1);
     pollfd = pa_rtpoll_item_get_pollfd(u->rtpoll_item, NULL);
diff --git a/src/modules/module-sine-source.c b/src/modules/module-sine-source.c
index a5f1ce7..a6e15d8 100644
--- a/src/modules/module-sine-source.c
+++ b/src/modules/module-sine-source.c
@@ -264,8 +264,7 @@ int pa__init(pa_module*m) {
 
     pa_source_set_asyncmsgq(u->source, u->thread_mq.inq);
     pa_source_set_rtpoll(u->source, u->rtpoll);
-    u->source->fixed_latency = u->block_usec;
-
+    pa_source_set_fixed_latency(u->source, u->block_usec);
 
     if (!(u->thread = pa_thread_new(thread_func, u))) {
         pa_log("Failed to create thread.");
diff --git a/src/modules/oss/module-oss.c b/src/modules/oss/module-oss.c
index 9f7863f..ab26137 100644
--- a/src/modules/oss/module-oss.c
+++ b/src/modules/oss/module-oss.c
@@ -1325,8 +1325,8 @@ int pa__init(pa_module*m) {
 
         pa_source_set_asyncmsgq(u->source, u->thread_mq.inq);
         pa_source_set_rtpoll(u->source, u->rtpoll);
+        pa_source_set_fixed_latency(u->source, pa_bytes_to_usec(u->in_hwbuf_size, &u->source->sample_spec));
         u->source->refresh_volume = TRUE;
-        u->source->fixed_latency = pa_bytes_to_usec(u->in_hwbuf_size, &u->source->sample_spec);
 
         if (use_mmap)
             u->in_mmap_memblocks = pa_xnew0(pa_memblock*, u->in_nfrags);
@@ -1387,8 +1387,8 @@ int pa__init(pa_module*m) {
 
         pa_sink_set_asyncmsgq(u->sink, u->thread_mq.inq);
         pa_sink_set_rtpoll(u->sink, u->rtpoll);
+        pa_sink_set_fixed_latency(u->sink, pa_bytes_to_usec(u->out_hwbuf_size, &u->sink->sample_spec));
         u->sink->refresh_volume = TRUE;
-        u->sink->fixed_latency = pa_bytes_to_usec(u->out_hwbuf_size, &u->sink->sample_spec);
 
         pa_sink_set_max_request(u->sink, u->out_hwbuf_size);
 
diff --git a/src/pulsecore/sink.c b/src/pulsecore/sink.c
index 30fa557..06c8b52 100644
--- a/src/pulsecore/sink.c
+++ b/src/pulsecore/sink.c
@@ -2050,6 +2050,22 @@ void pa_sink_set_latency_range_within_thread(pa_sink *s, pa_usec_t min_latency,
     pa_source_set_latency_range_within_thread(s->monitor_source, min_latency, max_latency);
 }
 
+/* Called from main thread, before the sink is put */
+void pa_sink_set_fixed_latency(pa_sink *s, pa_usec_t latency) {
+    pa_sink_assert_ref(s);
+
+    pa_assert(pa_sink_get_state(s) == PA_SINK_INIT);
+
+    if (latency < ABSOLUTE_MIN_LATENCY)
+        latency = ABSOLUTE_MIN_LATENCY;
+
+    if (latency > ABSOLUTE_MAX_LATENCY)
+        latency = ABSOLUTE_MAX_LATENCY;
+
+    s->fixed_latency = latency;
+    pa_source_set_fixed_latency(s->monitor_source, latency);
+}
+
 /* Called from main context */
 size_t pa_sink_get_max_rewind(pa_sink *s) {
     size_t r;
diff --git a/src/pulsecore/sink.h b/src/pulsecore/sink.h
index 352282b..e33b3cf 100644
--- a/src/pulsecore/sink.h
+++ b/src/pulsecore/sink.h
@@ -229,6 +229,7 @@ void pa_sink_set_rtpoll(pa_sink *s, pa_rtpoll *p);
 void pa_sink_set_max_rewind(pa_sink *s, size_t max_rewind);
 void pa_sink_set_max_request(pa_sink *s, size_t max_request);
 void pa_sink_set_latency_range(pa_sink *s, pa_usec_t min_latency, pa_usec_t max_latency);
+void pa_sink_set_fixed_latency(pa_sink *s, pa_usec_t latency);
 
 void pa_sink_detach(pa_sink *s);
 void pa_sink_attach(pa_sink *s);
diff --git a/src/pulsecore/source.c b/src/pulsecore/source.c
index 2190250..a772dc6 100644
--- a/src/pulsecore/source.c
+++ b/src/pulsecore/source.c
@@ -1276,6 +1276,21 @@ void pa_source_set_latency_range_within_thread(pa_source *s, pa_usec_t min_laten
     pa_source_invalidate_requested_latency(s);
 }
 
+/* Called from main thread, before the source is put */
+void pa_source_set_fixed_latency(pa_source *s, pa_usec_t latency) {
+    pa_source_assert_ref(s);
+
+    pa_assert(pa_source_get_state(s) == PA_SOURCE_INIT);
+
+    if (latency < ABSOLUTE_MIN_LATENCY)
+        latency = ABSOLUTE_MIN_LATENCY;
+
+    if (latency > ABSOLUTE_MAX_LATENCY)
+        latency = ABSOLUTE_MAX_LATENCY;
+
+    s->fixed_latency = latency;
+}
+
 /* Called from main thread */
 size_t pa_source_get_max_rewind(pa_source *s) {
     size_t r;
diff --git a/src/pulsecore/source.h b/src/pulsecore/source.h
index b502c22..2978f57 100644
--- a/src/pulsecore/source.h
+++ b/src/pulsecore/source.h
@@ -210,6 +210,7 @@ void pa_source_set_rtpoll(pa_source *s, pa_rtpoll *p);
 
 void pa_source_set_max_rewind(pa_source *s, size_t max_rewind);
 void pa_source_set_latency_range(pa_source *s, pa_usec_t min_latency, pa_usec_t max_latency);
+void pa_source_set_fixed_latency(pa_source *s, pa_usec_t latency);
 
 void pa_source_detach(pa_source *s);
 void pa_source_attach(pa_source *s);
-- 
1.6.2.2


0001-core-make-sure-soft-mute-status-stays-in-sync-with.patch:

--- NEW FILE 0001-core-make-sure-soft-mute-status-stays-in-sync-with.patch ---
>From 587fc2ab1c7b53ddd28f35e19aad55caa804de1f Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart at poettering.net>
Date: Mon, 8 Jun 2009 00:02:15 +0200
Subject: [PATCH] core: make sure soft mute status stays in sync with hw mute status

This should close rhbz #494851, mandriva bz #51234.

Probably the same as our own #572, launchpad #352732.
---
 src/modules/alsa/alsa-sink.c   |    2 +-
 src/modules/alsa/alsa-source.c |    2 +-
 src/pulsecore/sink.c           |    6 +++++-
 src/pulsecore/source.c         |    6 +++++-
 4 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/src/modules/alsa/alsa-sink.c b/src/modules/alsa/alsa-sink.c
index 98ebac3..59a5ca7 100644
--- a/src/modules/alsa/alsa-sink.c
+++ b/src/modules/alsa/alsa-sink.c
@@ -1199,7 +1199,7 @@ fail:
 
 static void sink_get_mute_cb(pa_sink *s) {
     struct userdata *u = s->userdata;
-    int err, sw;
+    int err, sw = 0;
 
     pa_assert(u);
     pa_assert(u->mixer_elem);
diff --git a/src/modules/alsa/alsa-source.c b/src/modules/alsa/alsa-source.c
index 277b110..c176309 100644
--- a/src/modules/alsa/alsa-source.c
+++ b/src/modules/alsa/alsa-source.c
@@ -1158,7 +1158,7 @@ fail:
 
 static void source_get_mute_cb(pa_source *s) {
     struct userdata *u = s->userdata;
-    int err, sw;
+    int err, sw = 0;
 
     pa_assert(u);
     pa_assert(u->mixer_elem);
diff --git a/src/pulsecore/sink.c b/src/pulsecore/sink.c
index db9b4f3..5d54d83 100644
--- a/src/pulsecore/sink.c
+++ b/src/pulsecore/sink.c
@@ -1365,8 +1365,12 @@ pa_bool_t pa_sink_get_mute(pa_sink *s, pa_bool_t force_refresh) {
 
         pa_assert_se(pa_asyncmsgq_send(s->asyncmsgq, PA_MSGOBJECT(s), PA_SINK_MESSAGE_GET_MUTE, NULL, 0, NULL) == 0);
 
-        if (old_muted != s->muted)
+        if (old_muted != s->muted) {
             pa_subscription_post(s->core, PA_SUBSCRIPTION_EVENT_SINK|PA_SUBSCRIPTION_EVENT_CHANGE, s->index);
+
+            /* Make sure the soft mute status stays in sync */
+            pa_assert_se(pa_asyncmsgq_send(s->asyncmsgq, PA_MSGOBJECT(s), PA_SINK_MESSAGE_SET_MUTE, NULL, 0, NULL) == 0);
+        }
     }
 
     return s->muted;
diff --git a/src/pulsecore/source.c b/src/pulsecore/source.c
index abb5f4d..53697c5 100644
--- a/src/pulsecore/source.c
+++ b/src/pulsecore/source.c
@@ -768,8 +768,12 @@ pa_bool_t pa_source_get_mute(pa_source *s, pa_bool_t force_refresh) {
 
         pa_assert_se(pa_asyncmsgq_send(s->asyncmsgq, PA_MSGOBJECT(s), PA_SOURCE_MESSAGE_GET_MUTE, NULL, 0, NULL) == 0);
 
-        if (old_muted != s->muted)
+        if (old_muted != s->muted) {
             pa_subscription_post(s->core, PA_SUBSCRIPTION_EVENT_SOURCE|PA_SUBSCRIPTION_EVENT_CHANGE, s->index);
+
+            /* Make sure the soft mute status stays in sync */
+            pa_assert_se(pa_asyncmsgq_send(s->asyncmsgq, PA_MSGOBJECT(s), PA_SOURCE_MESSAGE_SET_MUTE, NULL, 0, NULL) == 0);
+        }
     }
 
     return s->muted;
-- 
1.6.2.2


0001-endian-fix-LE-BE-order-for-24-bit-accessor-function.patch:

--- NEW FILE 0001-endian-fix-LE-BE-order-for-24-bit-accessor-function.patch ---
>From 076830af191306e0f6e5c6c783042345fcbca2be Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart at poettering.net>
Date: Fri, 1 May 2009 04:13:15 +0200
Subject: [PATCH] endian: fix LE/BE order for 24 bit accessor functions

---
 src/pulsecore/endianmacros.h |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/pulsecore/endianmacros.h b/src/pulsecore/endianmacros.h
index 2257937..2b18cf8 100644
--- a/src/pulsecore/endianmacros.h
+++ b/src/pulsecore/endianmacros.h
@@ -45,27 +45,27 @@
 #define PA_UINT32_SWAP(x) ( (uint32_t) ( ((uint32_t) (x) >> 24) | ((uint32_t) (x) << 24) | (((uint32_t) (x) & 0xFF00) << 8) | ((((uint32_t) (x)) >> 8) & 0xFF00) ) )
 #endif
 
-static inline uint32_t PA_READ24LE(const uint8_t *p) {
+static inline uint32_t PA_READ24BE(const uint8_t *p) {
     return
         ((uint32_t) p[0] << 16) |
         ((uint32_t) p[1] << 8) |
         ((uint32_t) p[2]);
 }
 
-static inline uint32_t PA_READ24BE(const uint8_t *p) {
+static inline uint32_t PA_READ24LE(const uint8_t *p) {
     return
         ((uint32_t) p[2] << 16) |
         ((uint32_t) p[1] << 8) |
         ((uint32_t) p[0]);
 }
 
-static inline void PA_WRITE24LE(uint8_t *p, uint32_t u) {
+static inline void PA_WRITE24BE(uint8_t *p, uint32_t u) {
     p[0] = (uint8_t) (u >> 16);
     p[1] = (uint8_t) (u >> 8);
     p[2] = (uint8_t) u;
 }
 
-static inline void PA_WRITE24BE(uint8_t *p, uint32_t u) {
+static inline void PA_WRITE24LE(uint8_t *p, uint32_t u) {
     p[2] = (uint8_t) (u >> 16);
     p[1] = (uint8_t) (u >> 8);
     p[0] = (uint8_t) u;
-- 
1.6.2.2


0001-idxset-add-enumeration-macro-PA_IDXSET_FOREACH.patch:

--- NEW FILE 0001-idxset-add-enumeration-macro-PA_IDXSET_FOREACH.patch ---
>From 5d39b8d22d4cce197778d8ef554a88c4be116f92 Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart at poettering.net>
Date: Wed, 29 Apr 2009 01:46:12 +0200
Subject: [PATCH] idxset: add enumeration macro PA_IDXSET_FOREACH

---
 src/pulsecore/idxset.h |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/src/pulsecore/idxset.h b/src/pulsecore/idxset.h
index 7531ea3..6b9ff47 100644
--- a/src/pulsecore/idxset.h
+++ b/src/pulsecore/idxset.h
@@ -103,4 +103,8 @@ unsigned pa_idxset_size(pa_idxset*s);
 /* Return TRUE of the idxset is empty */
 pa_bool_t pa_idxset_isempty(pa_idxset *s);
 
+
+#define PA_IDXSET_FOREACH(e, s, idx) \
+    for ((e) = pa_idxset_first((s), &(idx)); (e); (e) = pa_idxset_next((s), &(idx)))
+
 #endif
-- 
1.6.2.2


0001-log-print-file-name-only-when-we-have-it.patch:

--- NEW FILE 0001-log-print-file-name-only-when-we-have-it.patch ---
>From b9f1af48d2402c197f640bfaed0ca169d2d38cbd Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart at poettering.net>
Date: Sun, 19 Apr 2009 19:04:50 +0200
Subject: [PATCH] log: print file name only when we have it

---
 src/pulsecore/log.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/pulsecore/log.c b/src/pulsecore/log.c
index 60ea9c5..919ebe1 100644
--- a/src/pulsecore/log.c
+++ b/src/pulsecore/log.c
@@ -285,7 +285,7 @@ void pa_log_levelv_meta(
 
     if ((_flags & PA_LOG_PRINT_META) && file && line > 0 && func)
         pa_snprintf(location, sizeof(location), "[%s:%i %s()] ", file, line, func);
-    else if (_flags & (PA_LOG_PRINT_META|PA_LOG_PRINT_FILE))
+    else if ((_flags & (PA_LOG_PRINT_META|PA_LOG_PRINT_FILE)) && file)
         pa_snprintf(location, sizeof(location), "%s: ", pa_path_get_filename(file));
     else
         location[0] = 0;
-- 
1.6.2.2


0001-man-document-24bit-sample-types-in-man-page.patch:

--- NEW FILE 0001-man-document-24bit-sample-types-in-man-page.patch ---
>From 3aefc458839a8d72c9de95550339b049c2b7e730 Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart at poettering.net>
Date: Sun, 7 Jun 2009 00:45:05 +0200
Subject: [PATCH] man: document 24bit sample types in man page

---
 man/pulse-daemon.conf.5.xml.in |   10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/man/pulse-daemon.conf.5.xml.in b/man/pulse-daemon.conf.5.xml.in
index fe30016..c23d8a7 100644
--- a/man/pulse-daemon.conf.5.xml.in
+++ b/man/pulse-daemon.conf.5.xml.in
@@ -389,11 +389,13 @@ USA.
     <option>
       <p><opt>default-sample-format=</opt> The default sampling
       format. Specify one of <opt>u8</opt>, <opt>s16le</opt>,
-      <opt>s16be</opt>, <opt>s32le</opt>,
-      <opt>s32be</opt>, <opt>float32le</opt>, <opt>float32be</opt>,
+      <opt>s16be</opt>, <opt>s24le</opt>, <opt>s24be</opt>,
+      <opt>s24-32le</opt>, <opt>s24-32be</opt>, <opt>s32le</opt>,
+      <opt>s32be</opt> <opt>float32le</opt>, <opt>float32be</opt>,
       <opt>ulaw</opt>, <opt>alaw</opt>. Depending on the endianess of
-      the CPU the
-      formats <opt>s16ne</opt>, <opt>s16re</opt>, <opt>s32ne</opt>, <opt>s32re</opt>,
+      the CPU the formats <opt>s16ne</opt>, <opt>s16re</opt>,
+      <opt>s24ne</opt>, <opt>s24re</opt>, <opt>s24-32ne</opt>,
+      <opt>s24-32re</opt>, <opt>s32ne</opt>, <opt>s32re</opt>,
       <opt>float32ne</opt>, <opt>float32re</opt> (for native,
       resp. reverse endian) are available as aliases.</p>
     </option>
-- 
1.6.2.2


0001-man-document-log-related-daemon.conf-options.patch:

--- NEW FILE 0001-man-document-log-related-daemon.conf-options.patch ---
>From 5be1cc52ffcc01c655f897fd7fdead4484bfd86b Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart at poettering.net>
Date: Sun, 7 Jun 2009 00:44:49 +0200
Subject: [PATCH] man: document log related daemon.conf options

---
 man/pulse-daemon.conf.5.xml.in |   21 +++++++++++++++++++--
 1 files changed, 19 insertions(+), 2 deletions(-)

diff --git a/man/pulse-daemon.conf.5.xml.in b/man/pulse-daemon.conf.5.xml.in
index a7c49a4..fe30016 100644
--- a/man/pulse-daemon.conf.5.xml.in
+++ b/man/pulse-daemon.conf.5.xml.in
@@ -268,9 +268,9 @@ USA.
     </option>
 
     <option>
-      <p><opt>default-script-file=</opt> Load the default
+      <p><opt>load-default-script-file=</opt> Load the default
       configuration script file as specified
-      in <opt>default-script-file=</opt>. Defaults to "yes".</p>
+      in <opt>default-script-file=</opt>. Defaults to <opt>yes</opt>.</p>
     </option>
 
   </section>
@@ -297,6 +297,23 @@ USA.
       might alter this setting.</p>
     </option>
 
+    <option>
+      <p><opt>log-meta=</opt> With each logged message log the code
+      location the message was generated from. Defaults to
+      <opt>no</opt>.</p>
+    </option>
+
+    <option>
+      <p><opt>log-time=</opt> With each logged messages log the
+      relative time since startup. Defaults to <opt>no</opt>.</p>
+    </option>
+
+    <option>
+      <p><opt>log-backtrace=</opt> When greater than 0, with each
+      logged message log a code stack trace up the the specified
+      number of stack frames. Defaults to <opt>0</opt>.</p>
+    </option>
+
   </section>
 
   <section name="Resource Limits">
-- 
1.6.2.2


0001-man-document-that-tsched-doesn-t-use-fragment-setti.patch:

--- NEW FILE 0001-man-document-that-tsched-doesn-t-use-fragment-setti.patch ---
>From 8adf1d5eea0750cea52a5ce8fb75d4331bf8a7cc Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart at poettering.net>
Date: Sun, 7 Jun 2009 00:45:21 +0200
Subject: [PATCH] man: document that tsched doesn't use fragment settings

---
 man/pulse-daemon.conf.5.xml.in |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/man/pulse-daemon.conf.5.xml.in b/man/pulse-daemon.conf.5.xml.in
index c23d8a7..68bcb77 100644
--- a/man/pulse-daemon.conf.5.xml.in
+++ b/man/pulse-daemon.conf.5.xml.in
@@ -421,7 +421,8 @@ USA.
     these buffer metrics for machines with high scheduling
     latencies. Not all possible values that may be configured here are
     available in all hardware. The driver will to find the nearest
-    setting supported.</p>
+    setting supported. Modern drivers that support timer-based
+    scheduling ignore these options.</p>
 
     <option>
       <p><opt>default-fragments=</opt> The default number of
-- 
1.6.2.2


0001-mutex-when-we-fail-to-fill-in-mutex-into-static-mut.patch:

--- NEW FILE 0001-mutex-when-we-fail-to-fill-in-mutex-into-static-mut.patch ---
>From b304a98854697b9287f24027d55decbd0d2e296b Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart at poettering.net>
Date: Tue, 21 Apr 2009 21:24:33 +0200
Subject: [PATCH] mutex: when we fail to fill in mutex into static mutex ptr free it again

---
 src/pulsecore/mutex-posix.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/src/pulsecore/mutex-posix.c b/src/pulsecore/mutex-posix.c
index b3e5256..0ff4bee 100644
--- a/src/pulsecore/mutex-posix.c
+++ b/src/pulsecore/mutex-posix.c
@@ -153,6 +153,8 @@ pa_mutex* pa_static_mutex_get(pa_static_mutex *s, pa_bool_t recursive, pa_bool_t
     if ((pa_atomic_ptr_cmpxchg(&s->ptr, NULL, m)))
         return m;
 
+    pa_mutex_free(m);
+
     /* Him, filling in failed, so someone else must have filled in
      * already */
     pa_assert_se(m = pa_atomic_ptr_load(&s->ptr));
-- 
1.6.2.2


0001-oss-don-t-deadlock-when-we-try-to-resume-an-OSS-dev.patch:

--- NEW FILE 0001-oss-don-t-deadlock-when-we-try-to-resume-an-OSS-dev.patch ---
>From e8f7eb616a40dbb66c201509e459e3a8bd5f3e02 Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart at poettering.net>
Date: Tue, 26 May 2009 22:30:36 +0200
Subject: [PATCH] oss: don't deadlock when we try to resume an OSS device that lacks a mixer

---
 src/modules/oss/module-oss.c |   11 +++++++----
 1 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/src/modules/oss/module-oss.c b/src/modules/oss/module-oss.c
index ab26137..d6f549c 100644
--- a/src/modules/oss/module-oss.c
+++ b/src/modules/oss/module-oss.c
@@ -477,6 +477,7 @@ static void build_pollfd(struct userdata *u) {
     pollfd->revents = 0;
 }
 
+/* Called from IO context */
 static int suspend(struct userdata *u) {
     pa_assert(u);
     pa_assert(u->fd >= 0);
@@ -526,6 +527,7 @@ static int suspend(struct userdata *u) {
     return 0;
 }
 
+/* Called from IO context */
 static int unsuspend(struct userdata *u) {
     int m;
     pa_sample_spec ss, *ss_original;
@@ -616,10 +618,10 @@ static int unsuspend(struct userdata *u) {
 
     build_pollfd(u);
 
-    if (u->sink)
-        pa_sink_get_volume(u->sink, TRUE, FALSE);
-    if (u->source)
-        pa_source_get_volume(u->source, TRUE);
+    if (u->sink && u->sink->get_volume)
+        u->sink->get_volume(u->sink);
+    if (u->source && u->source->get_volume)
+        u->source->get_volume(u->source);
 
     pa_log_info("Resumed successfully...");
 
@@ -631,6 +633,7 @@ fail:
     return -1;
 }
 
+/* Called from IO context */
 static int sink_process_msg(pa_msgobject *o, int code, void *data, int64_t offset, pa_memchunk *chunk) {
     struct userdata *u = PA_SINK(o)->userdata;
     int ret;
-- 
1.6.2.2


0001-rescue-make-we-don-t-end-up-in-an-endless-loop-when.patch:

--- NEW FILE 0001-rescue-make-we-don-t-end-up-in-an-endless-loop-when.patch ---
>From 1a39acce41e1725867458b69ca7844e75b62431c Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart at poettering.net>
Date: Thu, 14 May 2009 03:52:13 +0200
Subject: [PATCH] rescue: make we don't end up in an endless loop when we can't move a sink input

---
 src/modules/module-rescue-streams.c |   38 +++++++++++++++++++---------------
 1 files changed, 21 insertions(+), 17 deletions(-)

diff --git a/src/modules/module-rescue-streams.c b/src/modules/module-rescue-streams.c
index 7c99a9b..c22711a 100644
--- a/src/modules/module-rescue-streams.c
+++ b/src/modules/module-rescue-streams.c
@@ -31,6 +31,7 @@
 #include <pulsecore/modargs.h>
 #include <pulsecore/log.h>
 #include <pulsecore/namereg.h>
+#include <pulsecore/core-util.h>
 
 #include "module-rescue-streams-symdef.h"
 
@@ -49,6 +50,7 @@ struct userdata {
 
 static pa_hook_result_t sink_hook_callback(pa_core *c, pa_sink *sink, void* userdata) {
     pa_sink_input *i;
+    uint32_t idx;
     pa_sink *target;
 
     pa_assert(c);
@@ -58,15 +60,14 @@ static pa_hook_result_t sink_hook_callback(pa_core *c, pa_sink *sink, void* user
     if (c->state == PA_CORE_SHUTDOWN)
         return PA_HOOK_OK;
 
-    if (!pa_idxset_size(sink->inputs)) {
+    if (pa_idxset_size(sink->inputs) <= 0) {
         pa_log_debug("No sink inputs to move away.");
         return PA_HOOK_OK;
     }
 
     if (!(target = pa_namereg_get(c, NULL, PA_NAMEREG_SINK)) || target == sink) {
-        uint32_t idx;
 
-        for (target = pa_idxset_first(c->sinks, &idx); target; target = pa_idxset_next(c->sinks, &idx))
+        PA_IDXSET_FOREACH(target, c->sinks, idx)
             if (target != sink)
                 break;
 
@@ -76,20 +77,24 @@ static pa_hook_result_t sink_hook_callback(pa_core *c, pa_sink *sink, void* user
         }
     }
 
-    while ((i = pa_idxset_first(sink->inputs, NULL))) {
+    pa_assert(target != sink);
+
+    PA_IDXSET_FOREACH(i, sink->inputs, idx) {
         if (pa_sink_input_move_to(i, target, FALSE) < 0)
-            pa_log_warn("Failed to move sink input %u \"%s\" to %s.", i->index, pa_proplist_gets(i->proplist, PA_PROP_APPLICATION_NAME), target->name);
+            pa_log_info("Failed to move sink input %u \"%s\" to %s.", i->index,
+                        pa_strnull(pa_proplist_gets(i->proplist, PA_PROP_APPLICATION_NAME)), target->name);
         else
-            pa_log_info("Sucessfully moved sink input %u \"%s\" to %s.", i->index, pa_proplist_gets(i->proplist, PA_PROP_APPLICATION_NAME), target->name);
+            pa_log_info("Sucessfully moved sink input %u \"%s\" to %s.", i->index,
+                        pa_strnull(pa_proplist_gets(i->proplist, PA_PROP_APPLICATION_NAME)), target->name);
     }
 
-
     return PA_HOOK_OK;
 }
 
 static pa_hook_result_t source_hook_callback(pa_core *c, pa_source *source, void* userdata) {
     pa_source_output *o;
     pa_source *target;
+    uint32_t idx;
 
     pa_assert(c);
     pa_assert(source);
@@ -98,15 +103,14 @@ static pa_hook_result_t source_hook_callback(pa_core *c, pa_source *source, void
     if (c->state == PA_CORE_SHUTDOWN)
         return PA_HOOK_OK;
 
-    if (!pa_idxset_size(source->outputs)) {
+    if (pa_idxset_size(source->outputs) <= 0) {
         pa_log_debug("No source outputs to move away.");
         return PA_HOOK_OK;
     }
 
     if (!(target = pa_namereg_get(c, NULL, PA_NAMEREG_SOURCE)) || target == source) {
-        uint32_t idx;
 
-        for (target = pa_idxset_first(c->sources, &idx); target; target = pa_idxset_next(c->sources, &idx))
+        PA_IDXSET_FOREACH(target, c->sources, idx)
             if (target != source && !target->monitor_of == !source->monitor_of)
                 break;
 
@@ -118,19 +122,20 @@ static pa_hook_result_t source_hook_callback(pa_core *c, pa_source *source, void
 
     pa_assert(target != source);
 
-    while ((o = pa_idxset_first(source->outputs, NULL))) {
+    PA_IDXSET_FOREACH(o, source->outputs, idx) {
         if (pa_source_output_move_to(o, target, FALSE) < 0)
-            pa_log_warn("Failed to move source output %u \"%s\" to %s.", o->index, pa_proplist_gets(o->proplist, PA_PROP_APPLICATION_NAME), target->name);
+            pa_log_info("Failed to move source output %u \"%s\" to %s.", o->index,
+                        pa_strnull(pa_proplist_gets(o->proplist, PA_PROP_APPLICATION_NAME)), target->name);
         else
-            pa_log_info("Sucessfully moved source output %u \"%s\" to %s.", o->index, pa_proplist_gets(o->proplist, PA_PROP_APPLICATION_NAME), target->name);
+            pa_log_info("Sucessfully moved source output %u \"%s\" to %s.", o->index,
+                        pa_strnull(pa_proplist_gets(o->proplist, PA_PROP_APPLICATION_NAME)), target->name);
     }
 
-
     return PA_HOOK_OK;
 }
 
 int pa__init(pa_module*m) {
-    pa_modargs *ma = NULL;
+    pa_modargs *ma;
     struct userdata *u;
 
     pa_assert(m);
@@ -153,10 +158,9 @@ void pa__done(pa_module*m) {
 
     pa_assert(m);
 
-    if (!m->userdata)
+    if (!(u = m->userdata))
         return;
 
-    u = m->userdata;
     if (u->sink_slot)
         pa_hook_slot_free(u->sink_slot);
     if (u->source_slot)
-- 
1.6.2.2


0001-rescue-streams-when-one-stream-move-fails-try-to-co.patch:

--- NEW FILE 0001-rescue-streams-when-one-stream-move-fails-try-to-co.patch ---
>From d775cf6fd4e68d765333adc61bd9af2b18355a8e Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart at poettering.net>
Date: Fri, 17 Apr 2009 20:30:09 +0200
Subject: [PATCH] rescue-streams: when one stream move fails try to continue with the remaining ones

---
 src/modules/module-rescue-streams.c |   16 ++++++----------
 1 files changed, 6 insertions(+), 10 deletions(-)

diff --git a/src/modules/module-rescue-streams.c b/src/modules/module-rescue-streams.c
index 4f616e0..7c99a9b 100644
--- a/src/modules/module-rescue-streams.c
+++ b/src/modules/module-rescue-streams.c
@@ -77,12 +77,10 @@ static pa_hook_result_t sink_hook_callback(pa_core *c, pa_sink *sink, void* user
     }
 
     while ((i = pa_idxset_first(sink->inputs, NULL))) {
-        if (pa_sink_input_move_to(i, target, FALSE) < 0) {
+        if (pa_sink_input_move_to(i, target, FALSE) < 0)
             pa_log_warn("Failed to move sink input %u \"%s\" to %s.", i->index, pa_proplist_gets(i->proplist, PA_PROP_APPLICATION_NAME), target->name);
-            return PA_HOOK_OK;
-        }
-
-        pa_log_info("Sucessfully moved sink input %u \"%s\" to %s.", i->index, pa_proplist_gets(i->proplist, PA_PROP_APPLICATION_NAME), target->name);
+        else
+            pa_log_info("Sucessfully moved sink input %u \"%s\" to %s.", i->index, pa_proplist_gets(i->proplist, PA_PROP_APPLICATION_NAME), target->name);
     }
 
 
@@ -121,12 +119,10 @@ static pa_hook_result_t source_hook_callback(pa_core *c, pa_source *source, void
     pa_assert(target != source);
 
     while ((o = pa_idxset_first(source->outputs, NULL))) {
-        if (pa_source_output_move_to(o, target, FALSE) < 0) {
+        if (pa_source_output_move_to(o, target, FALSE) < 0)
             pa_log_warn("Failed to move source output %u \"%s\" to %s.", o->index, pa_proplist_gets(o->proplist, PA_PROP_APPLICATION_NAME), target->name);
-            return PA_HOOK_OK;
-        }
-
-        pa_log_info("Sucessfully moved source output %u \"%s\" to %s.", o->index, pa_proplist_gets(o->proplist, PA_PROP_APPLICATION_NAME), target->name);
+        else
+            pa_log_info("Sucessfully moved source output %u \"%s\" to %s.", o->index, pa_proplist_gets(o->proplist, PA_PROP_APPLICATION_NAME), target->name);
     }
 
 
-- 
1.6.2.2


0001-sample-correctly-pass-s24-32-formats.patch:

--- NEW FILE 0001-sample-correctly-pass-s24-32-formats.patch ---
>From d4b10d838a79a46f18876dbb4a3206b5e1c7bc09 Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart at poettering.net>
Date: Fri, 1 May 2009 04:12:24 +0200
Subject: [PATCH] sample: correctly pass s24-32 formats

---
 src/pulse/sample.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/pulse/sample.c b/src/pulse/sample.c
index 1e67b03..ed7b1b0 100644
--- a/src/pulse/sample.c
+++ b/src/pulse/sample.c
@@ -231,13 +231,13 @@ pa_sample_format_t pa_parse_sample_format(const char *format) {
     else if (strcasecmp(format, "s24re") == 0)
         return PA_SAMPLE_S24RE;
     else if (strcasecmp(format, "s24-32le") == 0)
-        return PA_SAMPLE_S24LE;
+        return PA_SAMPLE_S24_32LE;
     else if (strcasecmp(format, "s24-32be") == 0)
-        return PA_SAMPLE_S24BE;
+        return PA_SAMPLE_S24_32BE;
     else if (strcasecmp(format, "s24-32ne") == 0 || strcasecmp(format, "s24-32") == 0)
-        return PA_SAMPLE_S24NE;
+        return PA_SAMPLE_S24_32NE;
     else if (strcasecmp(format, "s24-32re") == 0)
-        return PA_SAMPLE_S24RE;
+        return PA_SAMPLE_S24_32RE;
 
     return -1;
 }
-- 
1.6.2.2


0001-sample-util-fix-iteration-loop-when-adjusting-volum.patch:

--- NEW FILE 0001-sample-util-fix-iteration-loop-when-adjusting-volum.patch ---
>From d2b5ae5525e9036c4f91b1615879a5a07aac5bf2 Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart at poettering.net>
Date: Fri, 1 May 2009 04:14:40 +0200
Subject: [PATCH] sample-util: fix iteration loop when adjusting volume of s24 samples

---
 src/pulsecore/sample-util.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/pulsecore/sample-util.c b/src/pulsecore/sample-util.c
index 007a2f0..dda3883 100644
--- a/src/pulsecore/sample-util.c
+++ b/src/pulsecore/sample-util.c
@@ -831,9 +831,9 @@ void pa_volume_memchunk(
 
             calc_linear_integer_volume(linear, volume);
 
-            e = (uint8_t*) ptr + c->length/3;
+            e = (uint8_t*) ptr + c->length;
 
-            for (channel = 0, d = ptr; d < e; d++) {
+            for (channel = 0, d = ptr; d < e; d += 3) {
                 int64_t t;
 
                 t = (int64_t)((int32_t) (PA_READ24NE(d) << 8));
@@ -854,9 +854,9 @@ void pa_volume_memchunk(
 
             calc_linear_integer_volume(linear, volume);
 
-            e = (uint8_t*) ptr + c->length/3;
+            e = (uint8_t*) ptr + c->length;
 
-            for (channel = 0, d = ptr; d < e; d++) {
+            for (channel = 0, d = ptr; d < e; d += 3) {
                 int64_t t;
 
                 t = (int64_t)((int32_t) (PA_READ24RE(d) << 8));
-- 
1.6.2.2


0001-sample-util-properly-allocate-silence-block-for-s24.patch:

--- NEW FILE 0001-sample-util-properly-allocate-silence-block-for-s24.patch ---
>From 3a7b287c7ebd4e1b23ab076700201d0acb5a00c2 Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart at poettering.net>
Date: Fri, 1 May 2009 04:14:02 +0200
Subject: [PATCH] sample-util: properly allocate silence block for s24-32 formats

---
 src/pulsecore/sample-util.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/src/pulsecore/sample-util.c b/src/pulsecore/sample-util.c
index 3a9b384..007a2f0 100644
--- a/src/pulsecore/sample-util.c
+++ b/src/pulsecore/sample-util.c
@@ -1181,6 +1181,8 @@ pa_memchunk* pa_silence_memchunk_get(pa_silence_cache *cache, pa_mempool *pool,
             case PA_SAMPLE_S32BE:
             case PA_SAMPLE_S24LE:
             case PA_SAMPLE_S24BE:
+            case PA_SAMPLE_S24_32LE:
+            case PA_SAMPLE_S24_32RE:
             case PA_SAMPLE_FLOAT32LE:
             case PA_SAMPLE_FLOAT32BE:
                 cache->blocks[PA_SAMPLE_S16LE] = b = silence_memblock_new(pool, 0);
@@ -1189,6 +1191,8 @@ pa_memchunk* pa_silence_memchunk_get(pa_silence_cache *cache, pa_mempool *pool,
                 cache->blocks[PA_SAMPLE_S32BE] = pa_memblock_ref(b);
                 cache->blocks[PA_SAMPLE_S24LE] = pa_memblock_ref(b);
                 cache->blocks[PA_SAMPLE_S24BE] = pa_memblock_ref(b);
+                cache->blocks[PA_SAMPLE_S24_32LE] = pa_memblock_ref(b);
+                cache->blocks[PA_SAMPLE_S24_32BE] = pa_memblock_ref(b);
                 cache->blocks[PA_SAMPLE_FLOAT32LE] = pa_memblock_ref(b);
                 cache->blocks[PA_SAMPLE_FLOAT32BE] = pa_memblock_ref(b);
                 break;
-- 
1.6.2.2


0001-sconv-fix-a-few-minor-conversion-issues.patch:

--- NEW FILE 0001-sconv-fix-a-few-minor-conversion-issues.patch ---
>From e0f08219bb6b5ed9fd92623997074410051ed671 Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart at poettering.net>
Date: Fri, 1 May 2009 04:22:08 +0200
Subject: [PATCH] sconv: fix a few minor conversion issues

---
 src/pulsecore/sconv-s16le.c |   10 +++++-----
 src/pulsecore/sconv.c       |    2 +-
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/src/pulsecore/sconv-s16le.c b/src/pulsecore/sconv-s16le.c
index 307ce7b..43b8cb3 100644
--- a/src/pulsecore/sconv-s16le.c
+++ b/src/pulsecore/sconv-s16le.c
@@ -370,7 +370,7 @@ void pa_sconv_s24_32le_to_s16ne(unsigned n, const uint32_t *a, int16_t *b) {
     pa_assert(b);
 
     for (; n > 0; n--) {
-        *b = (int16_t) ((int32_t) (UINT32_FROM(*a) << 8) >> 16);
+        *b = (int16_t) (((int32_t) (UINT32_FROM(*a) << 8)) >> 16);
         a++;
         b++;
     }
@@ -416,8 +416,8 @@ void pa_sconv_s24_32le_to_float32ne(unsigned n, const uint32_t *a, float *b) {
     pa_assert(b);
 
     for (; n > 0; n--) {
-        int32_t s = (int16_t) ((int32_t) (UINT32_FROM(*a) << 8));
-        *b = ((float) s) / 0x7FFFFFFF;
+        int32_t s = (int32_t) (UINT32_FROM(*a) << 8);
+        *b = (float) s / (float) 0x7FFFFFFF;
         a ++;
         b ++;
     }
@@ -428,8 +428,8 @@ void pa_sconv_s24_32le_to_float32re(unsigned n, const uint32_t *a, float *b) {
     pa_assert(b);
 
     for (; n > 0; n--) {
-        int32_t s = (int16_t) ((int32_t) (UINT32_FROM(*a) << 8));
-        float k = ((float) s) / 0x7FFFFFFF;
+        int32_t s = (int32_t) (UINT32_FROM(*a) << 8);
+        float k = (float) s / (float) 0x7FFFFFFF;
         *b = PA_FLOAT32_SWAP(k);
         a ++;
         b ++;
diff --git a/src/pulsecore/sconv.c b/src/pulsecore/sconv.c
index 29a9a45..d89f428 100644
--- a/src/pulsecore/sconv.c
+++ b/src/pulsecore/sconv.c
@@ -75,7 +75,7 @@ static void u8_from_s16ne(unsigned n, const int16_t *a, uint8_t *b) {
     pa_assert(b);
 
     for (; n > 0; n--, a++, b++)
-        *b = (uint8_t) (*a / 0x100 + 0x80);
+        *b = (uint8_t) ((uint16_t) *a >> 8) + (uint8_t) 0x80U;
 }
 
 /* float32 */
-- 
1.6.2.2


0001-shm-page-align-shm-size-when-mmap-ing-it.patch:

--- NEW FILE 0001-shm-page-align-shm-size-when-mmap-ing-it.patch ---
>From 595c22a3ad2ac55e141959ada634d4cd0aa86aad Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart at poettering.net>
Date: Wed, 29 Apr 2009 01:49:02 +0200
Subject: [PATCH] shm: page align shm size when mmap()ing it

---
 src/pulsecore/shm.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/pulsecore/shm.c b/src/pulsecore/shm.c
index b8c5f78..fe556da 100644
--- a/src/pulsecore/shm.c
+++ b/src/pulsecore/shm.c
@@ -105,7 +105,7 @@ int pa_shm_create_rw(pa_shm *m, size_t size, pa_bool_t shared, mode_t mode) {
         m->size = size;
 
 #ifdef MAP_ANONYMOUS
-        if ((m->ptr = mmap(NULL, m->size, PROT_READ|PROT_WRITE, MAP_ANONYMOUS|MAP_PRIVATE, -1, (off_t) 0)) == MAP_FAILED) {
+        if ((m->ptr = mmap(NULL, PA_PAGE_ALIGN(m->size), PROT_READ|PROT_WRITE, MAP_ANONYMOUS|MAP_PRIVATE, -1, (off_t) 0)) == MAP_FAILED) {
             pa_log("mmap() failed: %s", pa_cstrerror(errno));
             goto fail;
         }
@@ -143,7 +143,7 @@ int pa_shm_create_rw(pa_shm *m, size_t size, pa_bool_t shared, mode_t mode) {
             goto fail;
         }
 
-        if ((m->ptr = mmap(NULL, m->size, PROT_READ|PROT_WRITE, MAP_SHARED, fd, (off_t) 0)) == MAP_FAILED) {
+        if ((m->ptr = mmap(NULL, PA_PAGE_ALIGN(m->size), PROT_READ|PROT_WRITE, MAP_SHARED, fd, (off_t) 0)) == MAP_FAILED) {
             pa_log("mmap() failed: %s", pa_cstrerror(errno));
             goto fail;
         }
@@ -291,7 +291,7 @@ int pa_shm_attach_ro(pa_shm *m, unsigned id) {
 
     m->size = (size_t) st.st_size;
 
-    if ((m->ptr = mmap(NULL, m->size, PROT_READ, MAP_SHARED, fd, (off_t) 0)) == MAP_FAILED) {
+    if ((m->ptr = mmap(NULL, PA_PAGE_ALIGN(m->size), PROT_READ, MAP_SHARED, fd, (off_t) 0)) == MAP_FAILED) {
         pa_log("mmap() failed: %s", pa_cstrerror(errno));
         goto fail;
     }
-- 
1.6.2.2


0001-simple-protocol-don-t-hit-an-assert-when-we-call-co.patch:

--- NEW FILE 0001-simple-protocol-don-t-hit-an-assert-when-we-call-co.patch ---
>From 4cb6ea2d96d40aaebc2015957cef297315bcdec4 Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart at poettering.net>
Date: Wed, 29 Apr 2009 04:13:07 +0200
Subject: [PATCH] simple-protocol: don't hit an assert when we call connection_unlink() early

---
 src/pulsecore/protocol-simple.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/pulsecore/protocol-simple.c b/src/pulsecore/protocol-simple.c
index 44fe597..776d74b 100644
--- a/src/pulsecore/protocol-simple.c
+++ b/src/pulsecore/protocol-simple.c
@@ -130,7 +130,7 @@ static void connection_unlink(connection *c) {
         c->io = NULL;
     }
 
-    pa_assert_se(pa_idxset_remove_by_data(c->protocol->connections, c, NULL) == c);
+    pa_idxset_remove_by_data(c->protocol->connections, c, NULL);
     c->protocol = NULL;
     connection_unref(c);
 }
-- 
1.6.2.2


0001-util-if-NULL-is-passed-to-pa_path_get_filename-ju.patch:

--- NEW FILE 0001-util-if-NULL-is-passed-to-pa_path_get_filename-ju.patch ---
>From 6773d000e381651f00c8ffad74cf96e6d0647da9 Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart at poettering.net>
Date: Sun, 19 Apr 2009 19:02:16 +0200
Subject: [PATCH] util: if NULL is passed to pa_path_get_filename() just hand it through

---
 src/pulse/util.c |    3 ++-
 src/pulse/util.h |    2 +-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/pulse/util.c b/src/pulse/util.c
index 54a188d..6f1e40a 100644
--- a/src/pulse/util.c
+++ b/src/pulse/util.c
@@ -219,7 +219,8 @@ char *pa_get_binary_name(char *s, size_t l) {
 char *pa_path_get_filename(const char *p) {
     char *fn;
 
-    pa_assert(p);
+    if (!p)
+        return NULL;
 
     if ((fn = strrchr(p, PA_PATH_SEP_CHAR)))
         return fn+1;
diff --git a/src/pulse/util.h b/src/pulse/util.h
index f6dd40c..ad85653 100644
--- a/src/pulse/util.h
+++ b/src/pulse/util.h
@@ -51,7 +51,7 @@ char *pa_get_home_dir(char *s, size_t l);
 char *pa_get_binary_name(char *s, size_t l);
 
 /** Return a pointer to the filename inside a path (which is the last
- * component). */
+ * component). If passed NULL will return NULL. */
 char *pa_path_get_filename(const char *p);
 
 /** Wait t milliseconds */
-- 
1.6.2.2



Index: pulseaudio.spec
===================================================================
RCS file: /cvs/pkgs/rpms/pulseaudio/F-11/pulseaudio.spec,v
retrieving revision 1.81
retrieving revision 1.82
diff -u -p -r1.81 -r1.82
--- pulseaudio.spec	22 Apr 2009 20:56:18 -0000	1.81
+++ pulseaudio.spec	8 Jun 2009 16:10:27 -0000	1.82
@@ -3,11 +3,37 @@
 Name:		pulseaudio
 Summary: 	Improved Linux sound server
 Version:	0.9.15
-Release:	11%{?dist}
+Release:	12%{?dist}
 License:	GPLv2+
 Group:		System Environment/Daemons
 Source0:	http://0pointer.de/lennart/projects/pulseaudio/pulseaudio-%{version}.tar.gz
 Patch0:         pulseaudio-0.9.15-no-daemon-if-remote-desktop.patch
+Patch1: 0001-alsa-allow-configuration-of-fallback-device-strings.patch
+Patch2: 0001-util-if-NULL-is-passed-to-pa_path_get_filename-ju.patch
+Patch3: 0001-alsa-don-t-hit-an-assert-when-invalid-module-argume.patch
+Patch4: 0001-alsa-fix-wording-we-are-speaking-of-card-profiles.patch
+Patch5: 0001-alsa-initialize-buffer-size-before-number-of-period.patch
+Patch6: 0001-conf-remove-obsolete-module-idle-time-directive-fro.patch
+Patch7: 0001-core-make-sure-soft-mute-status-stays-in-sync-with.patch
+Patch8: 0001-endian-fix-LE-BE-order-for-24-bit-accessor-function.patch
+Patch9: 0001-log-print-file-name-only-when-we-have-it.patch
+Patch10: 0001-man-document-24bit-sample-types-in-man-page.patch
+Patch11: 0001-man-document-log-related-daemon.conf-options.patch
+Patch12: 0001-man-document-that-tsched-doesn-t-use-fragment-setti.patch
+Patch13: 0001-mutex-when-we-fail-to-fill-in-mutex-into-static-mut.patch
+Patch14: 0001-oss-don-t-deadlock-when-we-try-to-resume-an-OSS-dev.patch
+Patch15: 0001-simple-protocol-don-t-hit-an-assert-when-we-call-co.patch
+Patch16: 0001-idxset-add-enumeration-macro-PA_IDXSET_FOREACH.patch
+Patch17: 0001-rescue-streams-when-one-stream-move-fails-try-to-co.patch
+Patch18: 0001-sample-correctly-pass-s24-32-formats.patch
+Patch19: 0001-sample-util-fix-iteration-loop-when-adjusting-volum.patch
+Patch20: 0001-sample-util-properly-allocate-silence-block-for-s24.patch
+Patch21: 0001-sconv-fix-a-few-minor-conversion-issues.patch
+Patch22: 0001-shm-page-align-shm-size-when-mmap-ing-it.patch
+Patch23: 0001-alsa-be-a-bit-more-verbose-when-a-hwparam-call-fail.patch
+Patch24: 0001-rescue-make-we-don-t-end-up-in-an-endless-loop-when.patch
+Patch25: 0001-core-introduce-pa_-sink-source-_set_fixed_latency.patch
+Patch26: 0001-core-cache-requested-latency-only-when-we-are-runni.patch
 URL:		http://pulseaudio.org
 BuildRoot:	%{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 BuildRequires:  m4
@@ -189,6 +215,31 @@ This package contains command line utili
 %prep
 %setup -q -T -b0
 %patch0 -p1 
+%patch1 -p1 
+%patch2 -p1 
+%patch3 -p1 
+%patch4 -p1 
+%patch5 -p1 
+%patch6 -p1 
+%patch7 -p1 
+%patch8 -p1 
+%patch9 -p1 
+%patch10 -p1 
+%patch11 -p1 
+%patch12 -p1 
+%patch13 -p1 
+%patch14 -p1 
+%patch15 -p1 
+%patch16 -p1 
+%patch17 -p1 
+%patch18 -p1 
+%patch19 -p1 
+%patch20 -p1 
+%patch21 -p1 
+%patch22 -p1 
+%patch23 -p1 
+%patch25 -p1 
+%patch26 -p1 
 
 %build
 CFLAGS="-ggdb" %configure --disable-static --disable-rpath --with-system-user=pulse --with-system-group=pulse --with-realtime-group=pulse-rt --with-access-group=pulse-access
@@ -409,6 +460,9 @@ groupadd -r pulse-access &>/dev/null || 
 %{_mandir}/man1/pax11publish.1.gz
 
 %changelog
+* Mon Jun 8 2009 Lennart Poettering <lpoetter at redhat.com> 0.9.15-12
+- Fix a couple of issues, including #497742, #494851
+
 * Wed Apr 22 2009 Warren Togami <wtogami at redhat.com> 0.9.15-11
 - Bug #497214
   Do not start pulseaudio daemon if PULSE_SERVER directs pulse elsewhere.




More information about the fedora-extras-commits mailing list