[pulseaudio-commits] [SCM] PulseAudio Sound Server branch, stable-queue, updated. v0.9.21

Lennart Poettering gitmailer-noreply at 0pointer.de
Tue Jan 5 11:25:38 PST 2010


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 stable-queue branch has been updated
      from  3014081136b7d920940f085c0bc9b0e5c16fb398 (commit)

- Log -----------------------------------------------------------------
06327b1 bump soname
7ab8e83 alsa: fix minor sampling rate deviations before adjusting the buffer size
366e3eb alsa: fix log output when the audio device refuses to give us again the same period settings we had before
a281aad pulse: ask for timing updates both *before* and *after* triggering a stream state change so that in the STARTED/UNDERFLOW callbacks we accurate transport latency information
c13bf3d pulse: delay smoother update only when unpausing, not when pausing, since we don't want the timer to advance when we are supposedly already paused
d6a851c pulse: try to fix inaccuracy with uncork timing for streams that are created in corked state
5c90723 daemon: complain if user passes too many arguments
-----------------------------------------------------------------------

Summary of changes:
 configure.ac                   |    2 +-
 src/daemon/main.c              |   37 +++++++++++++++++++++++++
 src/modules/alsa/alsa-sink.c   |    2 +-
 src/modules/alsa/alsa-source.c |    2 +-
 src/modules/alsa/alsa-util.c   |   16 ++++++-----
 src/pulse/stream.c             |   59 +++++++++++++++++++++++++++++++++++++---
 6 files changed, 104 insertions(+), 14 deletions(-)

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

commit 5c90723d31afd47510f89c4dc218401486072020
Author: Lennart Poettering <lennart at poettering.net>
Date:   Fri Nov 20 17:48:04 2009 +0100

    daemon: complain if user passes too many arguments

diff --git a/src/daemon/main.c b/src/daemon/main.c
index c006bad..eafd72a 100644
--- a/src/daemon/main.c
+++ b/src/daemon/main.c
@@ -509,6 +509,12 @@ int main(int argc, char *argv[]) {
             goto finish;
 
         case PA_CMD_DUMP_CONF: {
+
+            if (d < argc) {
+                pa_log("Too many arguments.\n");
+                goto finish;
+            }
+
             s = pa_daemon_conf_dump(conf);
             fputs(s, stdout);
             pa_xfree(s);
@@ -519,6 +525,11 @@ int main(int argc, char *argv[]) {
         case PA_CMD_DUMP_RESAMPLE_METHODS: {
             int i;
 
+            if (d < argc) {
+                pa_log("Too many arguments.\n");
+                goto finish;
+            }
+
             for (i = 0; i < PA_RESAMPLER_MAX; i++)
                 if (pa_resample_method_supported(i))
                     printf("%s\n", pa_resample_method_to_string(i));
@@ -533,6 +544,12 @@ int main(int argc, char *argv[]) {
             goto finish;
 
         case PA_CMD_VERSION :
+
+            if (d < argc) {
+                pa_log("Too many arguments.\n");
+                goto finish;
+            }
+
             printf(PACKAGE_NAME" "PACKAGE_VERSION"\n");
             retval = 0;
             goto finish;
@@ -540,6 +557,11 @@ int main(int argc, char *argv[]) {
         case PA_CMD_CHECK: {
             pid_t pid;
 
+            if (d < argc) {
+                pa_log("Too many arguments.\n");
+                goto finish;
+            }
+
             if (pa_pid_file_check_running(&pid, "pulseaudio") < 0)
                 pa_log_info(_("Daemon not running"));
             else {
@@ -552,6 +574,11 @@ int main(int argc, char *argv[]) {
         }
         case PA_CMD_KILL:
 
+            if (d < argc) {
+                pa_log("Too many arguments.\n");
+                goto finish;
+            }
+
             if (pa_pid_file_kill(SIGINT, NULL, "pulseaudio") < 0)
                 pa_log(_("Failed to kill daemon: %s"), pa_cstrerror(errno));
             else
@@ -561,6 +588,11 @@ int main(int argc, char *argv[]) {
 
         case PA_CMD_CLEANUP_SHM:
 
+            if (d < argc) {
+                pa_log("Too many arguments.\n");
+                goto finish;
+            }
+
             if (pa_shm_cleanup() >= 0)
                 retval = 0;
 
@@ -570,6 +602,11 @@ int main(int argc, char *argv[]) {
             pa_assert(conf->cmd == PA_CMD_DAEMON || conf->cmd == PA_CMD_START);
     }
 
+    if (d < argc) {
+        pa_log("Too many arguments.\n");
+        goto finish;
+    }
+
     if (getuid() == 0 && !conf->system_instance)
         pa_log_warn(_("This program is not intended to be run as root (unless --system is specified)."));
     else if (getuid() != 0 && conf->system_instance) {

commit d6a851cd1609a39053d5ef34c180b9d07d56bf86
Author: Lennart Poettering <lennart at poettering.net>
Date:   Fri Nov 20 17:49:30 2009 +0100

    pulse: try to fix inaccuracy with uncork timing for streams that are created in corked state

diff --git a/src/pulse/stream.c b/src/pulse/stream.c
index 2bc2b1e..5e53570 100644
--- a/src/pulse/stream.c
+++ b/src/pulse/stream.c
@@ -376,6 +376,22 @@ static void check_smoother_status(pa_stream *s, pa_bool_t aposteriori, pa_bool_t
     if (!s->smoother)
         return;
 
+    if (!s->timing_info_valid &&
+        !aposteriori &&
+        !force_start &&
+        !force_stop &&
+        s->context->version >= 13) {
+
+        /* If the server supports STARTED and UNDERFLOW events we take
+         * them as indications when audio really starts/stops playing,
+         * if we don't have any timing info yet -- instead of trying
+         * to be smart and guessing the server time. Otherwise the
+         * unknown transport delay we don't know might add too much
+         * noise to our time calculations. */
+
+        return;
+    }
+
     x = pa_rtclock_now();
 
     if (s->timing_info_valid) {
@@ -390,7 +406,6 @@ static void check_smoother_status(pa_stream *s, pa_bool_t aposteriori, pa_bool_t
     else if (force_start || s->buffer_attr.prebuf == 0)
         pa_smoother_resume(s->smoother, x, TRUE);
 
-
     /* Please note that we have no idea if playback actually started
      * if prebuf is non-zero! */
 }

commit c13bf3dd5514d3392f9106330b8bd30b345e5f07
Author: Lennart Poettering <lennart at poettering.net>
Date:   Fri Nov 20 19:48:08 2009 +0100

    pulse: delay smoother update only when unpausing, not when pausing, since we don't want the timer to advance when we are supposedly already paused

diff --git a/src/pulse/stream.c b/src/pulse/stream.c
index 5e53570..305e35b 100644
--- a/src/pulse/stream.c
+++ b/src/pulse/stream.c
@@ -376,22 +376,6 @@ static void check_smoother_status(pa_stream *s, pa_bool_t aposteriori, pa_bool_t
     if (!s->smoother)
         return;
 
-    if (!s->timing_info_valid &&
-        !aposteriori &&
-        !force_start &&
-        !force_stop &&
-        s->context->version >= 13) {
-
-        /* If the server supports STARTED and UNDERFLOW events we take
-         * them as indications when audio really starts/stops playing,
-         * if we don't have any timing info yet -- instead of trying
-         * to be smart and guessing the server time. Otherwise the
-         * unknown transport delay we don't know might add too much
-         * noise to our time calculations. */
-
-        return;
-    }
-
     x = pa_rtclock_now();
 
     if (s->timing_info_valid) {
@@ -403,8 +387,26 @@ static void check_smoother_status(pa_stream *s, pa_bool_t aposteriori, pa_bool_t
 
     if (s->suspended || s->corked || force_stop)
         pa_smoother_pause(s->smoother, x);
-    else if (force_start || s->buffer_attr.prebuf == 0)
+    else if (force_start || s->buffer_attr.prebuf == 0) {
+
+        if (!s->timing_info_valid &&
+            !aposteriori &&
+            !force_start &&
+            !force_stop &&
+            s->context->version >= 13) {
+
+            /* If the server supports STARTED events we take them as
+             * indications when audio really starts/stops playing, if
+             * we don't have any timing info yet -- instead of trying
+             * to be smart and guessing the server time. Otherwise the
+             * unknown transport delay add too much noise to our time
+             * calculations. */
+
+            return;
+        }
+
         pa_smoother_resume(s->smoother, x, TRUE);
+    }
 
     /* Please note that we have no idea if playback actually started
      * if prebuf is non-zero! */

commit a281aad784818c407fee20bff4945992b1878311
Author: Lennart Poettering <lennart at poettering.net>
Date:   Fri Nov 20 19:55:47 2009 +0100

    pulse: ask for timing updates both *before* and *after* triggering a stream state change so that in the STARTED/UNDERFLOW callbacks we accurate transport latency information

diff --git a/src/pulse/stream.c b/src/pulse/stream.c
index 305e35b..d01985b 100644
--- a/src/pulse/stream.c
+++ b/src/pulse/stream.c
@@ -1474,6 +1474,11 @@ pa_operation * pa_stream_drain(pa_stream *s, pa_stream_success_cb_t cb, void *us
     PA_CHECK_VALIDITY_RETURN_NULL(s->context, s->state == PA_STREAM_READY, PA_ERR_BADSTATE);
     PA_CHECK_VALIDITY_RETURN_NULL(s->context, s->direction == PA_STREAM_PLAYBACK, PA_ERR_BADSTATE);
 
+    /* Ask for a timing update before we cork/uncork to get the best
+     * accuracy for the transport latency suitable for the
+     * check_smoother_status() call in the started callback */
+    request_auto_timing_update(s, TRUE);
+
     o = pa_operation_new(s->context, s, (pa_operation_cb_t) cb, userdata);
 
     t = pa_tagstruct_command(s->context, PA_COMMAND_DRAIN_PLAYBACK_STREAM, &tag);
@@ -1481,6 +1486,10 @@ pa_operation * pa_stream_drain(pa_stream *s, pa_stream_success_cb_t cb, void *us
     pa_pstream_send_tagstruct(s->context->pstream, t);
     pa_pdispatch_register_reply(s->context->pdispatch, tag, DEFAULT_TIMEOUT, pa_stream_simple_ack_callback, pa_operation_ref(o), (pa_free_cb_t) pa_operation_unref);
 
+    /* This might cause the read index to conitnue again, hence
+     * let's request a timing update */
+    request_auto_timing_update(s, TRUE);
+
     return o;
 }
 
@@ -2029,6 +2038,11 @@ pa_operation* pa_stream_cork(pa_stream *s, int b, pa_stream_success_cb_t cb, voi
     PA_CHECK_VALIDITY_RETURN_NULL(s->context, s->state == PA_STREAM_READY, PA_ERR_BADSTATE);
     PA_CHECK_VALIDITY_RETURN_NULL(s->context, s->direction != PA_STREAM_UPLOAD, PA_ERR_BADSTATE);
 
+    /* Ask for a timing update before we cork/uncork to get the best
+     * accuracy for the transport latency suitable for the
+     * check_smoother_status() call in the started callback */
+    request_auto_timing_update(s, TRUE);
+
     s->corked = b;
 
     o = pa_operation_new(s->context, s, (pa_operation_cb_t) cb, userdata);
@@ -2044,8 +2058,8 @@ pa_operation* pa_stream_cork(pa_stream *s, int b, pa_stream_success_cb_t cb, voi
 
     check_smoother_status(s, FALSE, FALSE, FALSE);
 
-    /* This might cause the indexes to hang/start again, hence
-     * let's request a timing update */
+    /* This might cause the indexes to hang/start again, hence let's
+     * request a timing update, after the cork/uncork, too */
     request_auto_timing_update(s, TRUE);
 
     return o;
@@ -2082,6 +2096,11 @@ pa_operation* pa_stream_flush(pa_stream *s, pa_stream_success_cb_t cb, void *use
     PA_CHECK_VALIDITY_RETURN_NULL(s->context, s->state == PA_STREAM_READY, PA_ERR_BADSTATE);
     PA_CHECK_VALIDITY_RETURN_NULL(s->context, s->direction != PA_STREAM_UPLOAD, PA_ERR_BADSTATE);
 
+    /* Ask for a timing update *before* the flush, so that the
+     * transport usec is as up to date as possible when we get the
+     * underflow message and update the smoother status*/
+    request_auto_timing_update(s, TRUE);
+
     if (!(o = stream_send_simple_command(s, (uint32_t) (s->direction == PA_STREAM_PLAYBACK ? PA_COMMAND_FLUSH_PLAYBACK_STREAM : PA_COMMAND_FLUSH_RECORD_STREAM), cb, userdata)))
         return NULL;
 
@@ -2116,6 +2135,11 @@ pa_operation* pa_stream_prebuf(pa_stream *s, pa_stream_success_cb_t cb, void *us
     PA_CHECK_VALIDITY_RETURN_NULL(s->context, s->direction == PA_STREAM_PLAYBACK, PA_ERR_BADSTATE);
     PA_CHECK_VALIDITY_RETURN_NULL(s->context, s->buffer_attr.prebuf > 0, PA_ERR_BADSTATE);
 
+    /* Ask for a timing update before we cork/uncork to get the best
+     * accuracy for the transport latency suitable for the
+     * check_smoother_status() call in the started callback */
+    request_auto_timing_update(s, TRUE);
+
     if (!(o = stream_send_simple_command(s, PA_COMMAND_PREBUF_PLAYBACK_STREAM, cb, userdata)))
         return NULL;
 
@@ -2137,6 +2161,11 @@ pa_operation* pa_stream_trigger(pa_stream *s, pa_stream_success_cb_t cb, void *u
     PA_CHECK_VALIDITY_RETURN_NULL(s->context, s->direction == PA_STREAM_PLAYBACK, PA_ERR_BADSTATE);
     PA_CHECK_VALIDITY_RETURN_NULL(s->context, s->buffer_attr.prebuf > 0, PA_ERR_BADSTATE);
 
+    /* Ask for a timing update before we cork/uncork to get the best
+     * accuracy for the transport latency suitable for the
+     * check_smoother_status() call in the started callback */
+    request_auto_timing_update(s, TRUE);
+
     if (!(o = stream_send_simple_command(s, PA_COMMAND_TRIGGER_PLAYBACK_STREAM, cb, userdata)))
         return NULL;
 
@@ -2388,6 +2417,11 @@ pa_operation* pa_stream_set_buffer_attr(pa_stream *s, const pa_buffer_attr *attr
     PA_CHECK_VALIDITY_RETURN_NULL(s->context, s->direction != PA_STREAM_UPLOAD, PA_ERR_BADSTATE);
     PA_CHECK_VALIDITY_RETURN_NULL(s->context, s->context->version >= 12, PA_ERR_NOTSUPPORTED);
 
+    /* Ask for a timing update before we cork/uncork to get the best
+     * accuracy for the transport latency suitable for the
+     * check_smoother_status() call in the started callback */
+    request_auto_timing_update(s, TRUE);
+
     o = pa_operation_new(s->context, s, (pa_operation_cb_t) cb, userdata);
 
     t = pa_tagstruct_command(

commit 366e3ebe190b20a1f7585992056628b599bff4a6
Author: Lennart Poettering <lennart at poettering.net>
Date:   Fri Nov 20 20:00:26 2009 +0100

    alsa: fix log output when the audio device refuses to give us again the same period settings we had before

diff --git a/src/modules/alsa/alsa-sink.c b/src/modules/alsa/alsa-sink.c
index 856adb1..ed16c83 100644
--- a/src/modules/alsa/alsa-sink.c
+++ b/src/modules/alsa/alsa-sink.c
@@ -983,7 +983,7 @@ static int unsuspend(struct userdata *u) {
         buffer_size*u->frame_size != u->hwbuf_size) {
         pa_log_warn("Resume failed, couldn't restore original fragment settings. (Old: %lu/%lu, New %lu/%lu)",
                     (unsigned long) u->hwbuf_size, (unsigned long) u->fragment_size,
-                    (unsigned long) (buffer_size*u->fragment_size), (unsigned long) (period_size*u->frame_size));
+                    (unsigned long) (buffer_size*u->frame_size), (unsigned long) (period_size*u->frame_size));
         goto fail;
     }
 
diff --git a/src/modules/alsa/alsa-source.c b/src/modules/alsa/alsa-source.c
index e775b20..157698e 100644
--- a/src/modules/alsa/alsa-source.c
+++ b/src/modules/alsa/alsa-source.c
@@ -930,7 +930,7 @@ static int unsuspend(struct userdata *u) {
         buffer_size*u->frame_size != u->hwbuf_size) {
         pa_log_warn("Resume failed, couldn't restore original fragment settings. (Old: %lu/%lu, New %lu/%lu)",
                     (unsigned long) u->hwbuf_size, (unsigned long) u->fragment_size,
-                    (unsigned long) (buffer_size*u->fragment_size), (unsigned long) (period_size*u->frame_size));
+                    (unsigned long) (buffer_size*u->frame_size), (unsigned long) (period_size*u->frame_size));
         goto fail;
     }
 

commit 7ab8e83cb0d36edfe348690c73e22cb13fca0359
Author: Lennart Poettering <lennart at poettering.net>
Date:   Fri Nov 20 20:27:03 2009 +0100

    alsa: fix minor sampling rate deviations before adjusting the buffer size

diff --git a/src/modules/alsa/alsa-util.c b/src/modules/alsa/alsa-util.c
index b8d1357..52f1259 100644
--- a/src/modules/alsa/alsa-util.c
+++ b/src/modules/alsa/alsa-util.c
@@ -259,6 +259,10 @@ int pa_alsa_set_hw_params(
         goto finish;
     }
 
+    /* We ignore very small sampling rate deviations */
+    if (_ss.rate >= ss->rate*.95 && _ss.rate <= ss->rate*1.05)
+        _ss.rate = ss->rate;
+
     if (require_exact_channel_number) {
         if ((ret = snd_pcm_hw_params_set_channels(pcm_handle, hwparams, _ss.channels)) < 0) {
             pa_log_debug("snd_pcm_hw_params_set_channels(%u) failed: %s", _ss.channels, pa_alsa_strerror(ret));
@@ -303,7 +307,7 @@ int pa_alsa_set_hw_params(
             if (set_buffer_size(pcm_handle, hwparams_copy, _buffer_size) >= 0 &&
                 set_period_size(pcm_handle, hwparams_copy, _period_size) >= 0 &&
                 snd_pcm_hw_params(pcm_handle, hwparams_copy) >= 0) {
-                pa_log_debug("Set buffer size first, period size second.");
+                pa_log_debug("Set buffer size first (to %lu samples), period size second (to %lu samples).", (unsigned long) _buffer_size, (unsigned long) _period_size);
                 goto success;
             }
 
@@ -311,7 +315,7 @@ int pa_alsa_set_hw_params(
             if (set_period_size(pcm_handle, hwparams_copy, _period_size) >= 0 &&
                 set_buffer_size(pcm_handle, hwparams_copy, _buffer_size) >= 0 &&
                 snd_pcm_hw_params(pcm_handle, hwparams_copy) >= 0) {
-                pa_log_debug("Set period size first, buffer size second.");
+                pa_log_debug("Set period size first (to %lu samples), buffer size second (to %lu samples).", (unsigned long) _period_size, (unsigned long) _buffer_size);
                 goto success;
             }
         }
@@ -322,7 +326,7 @@ int pa_alsa_set_hw_params(
             /* Third try: set only buffer size */
             if (set_buffer_size(pcm_handle, hwparams_copy, _buffer_size) >= 0 &&
                 snd_pcm_hw_params(pcm_handle, hwparams_copy) >= 0) {
-                pa_log_debug("Set only buffer size second.");
+                pa_log_debug("Set only buffer size (to %lu samples).", (unsigned long) _buffer_size);
                 goto success;
             }
         }
@@ -333,7 +337,7 @@ int pa_alsa_set_hw_params(
             /* Fourth try: set only period size */
             if (set_period_size(pcm_handle, hwparams_copy, _period_size) >= 0 &&
                 snd_pcm_hw_params(pcm_handle, hwparams_copy) >= 0) {
-                pa_log_debug("Set only period size second.");
+                pa_log_debug("Set only period size (to %lu samples).", (unsigned long) _period_size);
                 goto success;
             }
         }
@@ -374,9 +378,7 @@ success:
         goto finish;
     }
 
-    /* If the sample rate deviates too much, we need to resample */
-    if (_ss.rate < ss->rate*.95 || _ss.rate > ss->rate*1.05)
-        ss->rate = _ss.rate;
+    ss->rate = _ss.rate;
     ss->channels = _ss.channels;
     ss->format = _ss.format;
 

commit 06327b1e67af661cb3d73598e6f5f51e475e7ce6
Author: Lennart Poettering <lennart at poettering.net>
Date:   Mon Nov 23 05:07:00 2009 +0100

    bump soname

diff --git a/configure.ac b/configure.ac
index 995f658..c9ec490 100644
--- a/configure.ac
+++ b/configure.ac
@@ -45,7 +45,7 @@ AC_SUBST(PA_PROTOCOL_VERSION, 16)
 
 # The stable ABI for client applications, for the version info x:y:z
 # always will hold y=z
-AC_SUBST(LIBPULSE_VERSION_INFO, [12:1:12])
+AC_SUBST(LIBPULSE_VERSION_INFO, [12:2:12])
 
 # A simplified, synchronous, ABI-stable interface for client
 # applications, for the version info x:y:z always will hold y=z

-- 
hooks/post-receive
PulseAudio Sound Server



More information about the pulseaudio-commits mailing list