[pulseaudio-commits] [SCM] PulseAudio Sound Server branch, master-tx, updated. v0.9.12

Lennart Poettering gitmailer-noreply at 0pointer.de
Mon Sep 8 17:26:11 PDT 2008


This is an automated email from the git hooks/post-receive script. It was
generated because of a push to the "PulseAudio Sound Server" repository.

The master-tx branch has been updated
      from  c7a77657ffe00b6d52a0c7e3d29f4fcf8537af5f (commit)

- Log -----------------------------------------------------------------
5538c18... add src/pulsecore/lock-autospawn.c to POTFILES.in
8f604bf... bump revisions
17436b2... make sure peaks resampler also works for very short input buffers
0deb6a4... minor improvements in debug handling
4050447... unbreak pa_idxset_rrobin
3a46bbe... When returning from a suspend, pass exactly the same flags as originally when we opened the device.
25b200c... fix minor typo
f4c2f00... Work around presumable ALSA bug that treats the dir argument to snd_pcm_hw_params_set_periods_near() actually as > or < instead of >= and <=.
-----------------------------------------------------------------------

Summary of changes:
 configure.ac                        |    8 ++++----
 po/POTFILES.in                      |    1 +
 src/modules/alsa-util.c             |   15 +++++++++++----
 src/modules/module-alsa-sink.c      |   14 ++++++++++----
 src/modules/module-alsa-source.c    |   15 +++++++++++----
 src/modules/module-stream-restore.c |    2 +-
 src/pulsecore/idxset.c              |    3 +--
 src/pulsecore/resampler.c           |   31 ++++++++++++++++++++-----------
 8 files changed, 59 insertions(+), 30 deletions(-)

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

commit f4c2f00f78208057609293b189fd40d792b8a4e3
Author: Lennart Poettering <lennart at poettering.net>
Date:   Tue Sep 9 00:04:50 2008 +0300

    Work around presumable ALSA bug that treats the dir argument to
    snd_pcm_hw_params_set_periods_near() actually as > or < instead of >= and <=.

diff --git a/src/modules/alsa-util.c b/src/modules/alsa-util.c
index 8fa405d..c3eb72f 100644
--- a/src/modules/alsa-util.c
+++ b/src/modules/alsa-util.c
@@ -370,11 +370,18 @@ int pa_alsa_set_hw_params(
         goto finish;
 
     if (_periods > 0) {
-        dir = 1;
+
+        /* First we pass 0 as direction to get exactly what we asked
+         * for. That this is necessary is presumably a bug in ALSA */
+
+        dir = 0;
         if ((ret = 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;
+            dir = 1;
+            if ((ret = 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;
+            }
         }
     }
 

commit 25b200c08797b19fb3eb05d6259abee231650196
Author: Lennart Poettering <lennart at poettering.net>
Date:   Tue Sep 9 00:06:12 2008 +0300

    fix minor typo

diff --git a/src/modules/module-stream-restore.c b/src/modules/module-stream-restore.c
index 47f5d83..fe79291 100644
--- a/src/modules/module-stream-restore.c
+++ b/src/modules/module-stream-restore.c
@@ -377,7 +377,7 @@ static pa_hook_result_t source_output_new_hook_callback(pa_core *c, pa_source_ou
                 pa_log_info("Restoring device for stream %s.", name);
                 new_data->source = s;
             } else
-                pa_log_info("Not restroing device for stream %s, because already set", name);
+                pa_log_info("Not restoring device for stream %s, because already set", name);
         }
 
         pa_xfree(e);

commit 3a46bbeba509ed68dfaf28d94be3efac88a2613b
Author: Lennart Poettering <lennart at poettering.net>
Date:   Tue Sep 9 00:10:54 2008 +0300

    When returning from a suspend, pass exactly the same flags as originally when
    we opened the device.

diff --git a/src/modules/module-alsa-sink.c b/src/modules/module-alsa-sink.c
index 6f0d783..24ae723 100644
--- a/src/modules/module-alsa-sink.c
+++ b/src/modules/module-alsa-sink.c
@@ -623,7 +623,11 @@ static int unsuspend(struct userdata *u) {
     pa_log_info("Trying resume...");
 
     snd_config_update_free_global();
-    if ((err = snd_pcm_open(&u->pcm_handle, u->device_name, SND_PCM_STREAM_PLAYBACK, SND_PCM_NONBLOCK)) < 0) {
+    if ((err = snd_pcm_open(&u->pcm_handle, u->device_name, SND_PCM_STREAM_PLAYBACK,
+                            /*SND_PCM_NONBLOCK|*/
+                            SND_PCM_NO_AUTO_RESAMPLE|
+                            SND_PCM_NO_AUTO_CHANNELS|
+                            SND_PCM_NO_AUTO_FORMAT)) < 0) {
         pa_log("Error opening PCM device %s: %s", u->device_name, snd_strerror(err));
         goto fail;
     }
diff --git a/src/modules/module-alsa-source.c b/src/modules/module-alsa-source.c
index fca0500..86e08f7 100644
--- a/src/modules/module-alsa-source.c
+++ b/src/modules/module-alsa-source.c
@@ -565,7 +565,12 @@ static int unsuspend(struct userdata *u) {
     pa_log_info("Trying resume...");
 
     snd_config_update_free_global();
-    if ((err = snd_pcm_open(&u->pcm_handle, u->device_name, SND_PCM_STREAM_CAPTURE, SND_PCM_NONBLOCK)) < 0) {
+
+    if ((err = snd_pcm_open(&u->pcm_handle, u->device_name, SND_PCM_STREAM_CAPTURE,
+                            /*SND_PCM_NONBLOCK|*/
+                            SND_PCM_NO_AUTO_RESAMPLE|
+                            SND_PCM_NO_AUTO_CHANNELS|
+                            SND_PCM_NO_AUTO_FORMAT)) < 0) {
         pa_log("Error opening PCM device %s: %s", u->device_name, snd_strerror(err));
         goto fail;
     }

commit 4050447230040983fdc07f665cf4ec3f23dde217
Author: Lennart Poettering <lennart at poettering.net>
Date:   Tue Sep 9 02:14:27 2008 +0300

    unbreak pa_idxset_rrobin

diff --git a/src/pulsecore/idxset.c b/src/pulsecore/idxset.c
index b6423ef..2de6406 100644
--- a/src/pulsecore/idxset.c
+++ b/src/pulsecore/idxset.c
@@ -318,8 +318,7 @@ void* pa_idxset_rrobin(pa_idxset *s, uint32_t *idx) {
 
     hash = *idx % NBUCKETS;
 
-    if (!(e = index_scan(s, hash, *idx)))
-        return NULL;
+    e = index_scan(s, hash, *idx);
 
     if (e && e->iterate_next)
         e = e->iterate_next;

commit 0deb6a4b13efd852de6c9ce08e587149368c3b0e
Author: Lennart Poettering <lennart at poettering.net>
Date:   Tue Sep 9 02:17:01 2008 +0300

    minor improvements in debug handling

diff --git a/src/modules/module-alsa-sink.c b/src/modules/module-alsa-sink.c
index 24ae723..b8bef93 100644
--- a/src/modules/module-alsa-sink.c
+++ b/src/modules/module-alsa-sink.c
@@ -654,7 +654,9 @@ static int unsuspend(struct userdata *u) {
     }
 
     if (nfrags != u->nfragments || period_size*u->frame_size != u->fragment_size) {
-        pa_log_warn("Resume failed, couldn't restore original fragment settings.");
+        pa_log_warn("Resume failed, couldn't restore original fragment settings. (Old: %lu*%lu, New %lu*%lu)",
+                    (unsigned long) u->nfragments, (unsigned long) u->fragment_size,
+                    (unsigned long) nfrags, period_size * u->frame_size);
         goto fail;
     }
 
@@ -1154,7 +1156,7 @@ static void thread_func(void *userdata) {
                 goto fail;
             }
 
-            if (revents & (POLLERR|POLLNVAL|POLLHUP)) {
+            if (revents & (POLLERR|POLLNVAL|POLLHUP|POLLPRI)) {
                 if (pa_alsa_recover_from_poll(u->pcm_handle, revents) < 0)
                     goto fail;
 
@@ -1163,7 +1165,7 @@ static void thread_func(void *userdata) {
             }
 
             if (revents && u->use_tsched)
-                pa_log_debug("Wakeup from ALSA! (%i)", revents);
+                pa_log_debug("Wakeup from ALSA!%s%s", (revents & POLLIN) ? " INPUT" : "", (revents & POLLOUT) ? " OUTPUT" : "");
         }
     }
 
diff --git a/src/modules/module-alsa-source.c b/src/modules/module-alsa-source.c
index 86e08f7..cb77767 100644
--- a/src/modules/module-alsa-source.c
+++ b/src/modules/module-alsa-source.c
@@ -597,7 +597,9 @@ static int unsuspend(struct userdata *u) {
     }
 
     if (nfrags != u->nfragments || period_size*u->frame_size != u->fragment_size) {
-        pa_log_warn("Resume failed, couldn't restore original fragment settings.");
+        pa_log_warn("Resume failed, couldn't restore original fragment settings. (Old: %lu*%lu, New %lu*%lu)",
+                    (unsigned long) u->nfragments, (unsigned long) u->fragment_size,
+                    (unsigned long) nfrags, period_size * u->frame_size);
         goto fail;
     }
 
@@ -989,7 +991,7 @@ static void thread_func(void *userdata) {
                 goto fail;
             }
 
-            if (revents & (POLLERR|POLLNVAL|POLLHUP)) {
+            if (revents & (POLLERR|POLLNVAL|POLLHUP|POLLPRI)) {
                 if (pa_alsa_recover_from_poll(u->pcm_handle, revents) < 0)
                     goto fail;
 
@@ -997,7 +999,7 @@ static void thread_func(void *userdata) {
             }
 
             if (revents && u->use_tsched)
-                pa_log_debug("Wakeup from ALSA! (%i)", revents);
+                pa_log_debug("Wakeup from ALSA!%s%s", (revents & POLLIN) ? " INPUT" : "", (revents & POLLOUT) ? " OUTPUT" : "");
         }
     }
 

commit 17436b21d3960386cb0fa81d7438ed7f3eface2d
Author: Lennart Poettering <lennart at poettering.net>
Date:   Tue Sep 9 02:18:21 2008 +0300

    make sure peaks resampler also works for very short input buffers

diff --git a/src/pulsecore/resampler.c b/src/pulsecore/resampler.c
index 0ae029b..b2d512c 100644
--- a/src/pulsecore/resampler.c
+++ b/src/pulsecore/resampler.c
@@ -1418,40 +1418,46 @@ static void peaks_resample(pa_resampler *r, const pa_memchunk *input, unsigned i
         unsigned j;
 
         j = ((r->peaks.o_counter * r->i_ss.rate) / r->o_ss.rate);
-        j = j > r->peaks.i_counter ? j - r->peaks.i_counter : 0;
 
-        if (j >= in_n_frames)
-            break;
+        if (j > r->peaks.i_counter)
+            j -= r->peaks.i_counter;
+        else
+            j = 0;
 
         pa_assert(o_index * fz < pa_memblock_get_length(output->memblock));
 
         if (r->work_format == PA_SAMPLE_S16NE) {
             unsigned i, c;
-            int16_t *s = (int16_t*) ((uint8_t*) src + fz * j);
+            int16_t *s = (int16_t*) ((uint8_t*) src + fz * start);
             int16_t *d = (int16_t*) ((uint8_t*) dst + fz * o_index);
 
-            for (i = start; i <= j; i++)
+            for (i = start; i <= j && i < in_n_frames; i++)
+
                 for (c = 0; c < r->o_ss.channels; c++, s++) {
                     int16_t n;
 
                     n = (int16_t) (*s < 0 ? -*s : *s);
 
-                    if (n > r->peaks.max_i[c])
+                    if (PA_UNLIKELY(n > r->peaks.max_i[c]))
                         r->peaks.max_i[c] = n;
                 }
 
+            if (i >= in_n_frames)
+                break;
+
             for (c = 0; c < r->o_ss.channels; c++, d++) {
-                 *d = r->peaks.max_i[c];
-                 r->peaks.max_i[c] = 0;
+                *d = r->peaks.max_i[c];
+                r->peaks.max_i[c] = 0;
             }
+
         } else {
             unsigned i, c;
-            float *s = (float*) ((uint8_t*) src + fz * j);
+            float *s = (float*) ((uint8_t*) src + fz * start);
             float *d = (float*) ((uint8_t*) dst + fz * o_index);
 
             pa_assert(r->work_format == PA_SAMPLE_FLOAT32NE);
 
-            for (i = start; i <= j; i++)
+            for (i = start; i <= j && i < in_n_frames; i++)
                 for (c = 0; c < r->o_ss.channels; c++, s++) {
                     float n = fabsf(*s);
 
@@ -1459,13 +1465,16 @@ static void peaks_resample(pa_resampler *r, const pa_memchunk *input, unsigned i
                         r->peaks.max_f[c] = n;
                 }
 
+            if (i >= in_n_frames)
+                break;
+
             for (c = 0; c < r->o_ss.channels; c++, d++) {
                 *d = r->peaks.max_f[c];
                 r->peaks.max_f[c] = 0;
             }
         }
 
-        start = j+1;
+        start = j;
     }
 
     pa_memblock_release(input->memblock);

commit 8f604bfb6199656c68a90aa978f93c99d46a2eba
Author: Lennart Poettering <lennart at poettering.net>
Date:   Tue Sep 9 02:28:22 2008 +0300

    bump revisions

diff --git a/configure.ac b/configure.ac
index 4a560b1..3c3550f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -40,11 +40,11 @@ AC_SUBST(PA_PROTOCOL_VERSION, 14)
 
 # The stable ABI for client applications, for the version info x:y:z
 # always will hold y=z
-AC_SUBST(LIBPULSE_VERSION_INFO, [5:0:5])
+AC_SUBST(LIBPULSE_VERSION_INFO, [6:0:6])
 
 # A simplified, synchronous, ABI-stable interface for client
 # applications, for the version info x:y:z always will hold y=z
-AC_SUBST(LIBPULSE_SIMPLE_VERSION_INFO, [0:1:0])
+AC_SUBST(LIBPULSE_SIMPLE_VERSION_INFO, [0:2:0])
 
 # The ABI-stable network browsing interface for client applications,
 # for the version info x:y:z always will hold y=z
@@ -52,12 +52,12 @@ AC_SUBST(LIBPULSE_BROWSE_VERSION_INFO, [1:1:1])
 
 # The ABI-stable GLib adapter for client applications, for the version
 # info x:y:z always will hold y=z
-AC_SUBST(LIBPULSE_MAINLOOP_GLIB_VERSION_INFO, [0:3:0])
+AC_SUBST(LIBPULSE_MAINLOOP_GLIB_VERSION_INFO, [0:4:0])
 
 # An internally used, ABI-unstable library that contains the
 # PulseAudio core, SONAMEs are bumped on every release, version info
 # suffix will always be 0:0
-AC_SUBST(LIBPULSECORE_VERSION_INFO, [6:0:0])
+AC_SUBST(LIBPULSECORE_VERSION_INFO, [7:0:0])
 
 AC_CANONICAL_HOST
 AC_DEFINE_UNQUOTED([CANONICAL_HOST], "$host", [Canonical host string.])

commit 5538c184167865754287e6fe30b4eef257dbe695
Author: Lennart Poettering <lennart at poettering.net>
Date:   Tue Sep 9 01:42:38 2008 +0200

    add src/pulsecore/lock-autospawn.c to POTFILES.in

diff --git a/po/POTFILES.in b/po/POTFILES.in
index fa28b6a..6efb1d0 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -190,3 +190,4 @@ src/utils/padsp.c
 src/utils/pax11publish.c
 src/utils/pacmd.c
 src/utils/paplay.c
+src/pulsecore/lock-autospawn.c

-- 
hooks/post-receive
PulseAudio Sound Server



More information about the pulseaudio-commits mailing list