[pulseaudio-commits] [SCM] PulseAudio Sound Server branch, master, updated. v0.9.15-test3-37-g8693417

Lennart Poettering gitmailer-noreply at 0pointer.de
Tue Mar 3 17:55:56 PST 2009


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

The master branch has been updated
      from  f3de61edf68c039abf3499463333ad920019f430 (commit)

- Log -----------------------------------------------------------------
8693417... various smaller cleanups
c8abe64... pa_xnew cannot fail -- that's what the x is in the name
946d072... document more closely from which context certain functions may be called
-----------------------------------------------------------------------

Summary of changes:
 src/modules/alsa/alsa-sink.c   |   23 ++++++-----------------
 src/modules/alsa/alsa-source.c |    2 +-
 src/modules/module-solaris.c   |    4 +---
 src/pulsecore/sink.c           |    8 +++++---
 4 files changed, 13 insertions(+), 24 deletions(-)

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

commit 946d07211ba3ab814183b2112b89e557edb12159
Author: Lennart Poettering <lennart at poettering.net>
Date:   Wed Mar 4 02:51:30 2009 +0100

    document more closely from which context certain functions may be called

diff --git a/src/pulsecore/sink.c b/src/pulsecore/sink.c
index 298cc88..1133403 100644
--- a/src/pulsecore/sink.c
+++ b/src/pulsecore/sink.c
@@ -1529,8 +1529,10 @@ int pa_sink_process_msg(pa_msgobject *o, int code, void *userdata, int64_t offse
 
             s->thread_info.state = PA_PTR_TO_UINT(userdata);
 
-            if (s->thread_info.state == PA_SINK_SUSPENDED)
+            if (s->thread_info.state == PA_SINK_SUSPENDED) {
+                s->thread_info.rewind_nbytes = 0;
                 s->thread_info.rewind_requested = FALSE;
+            }
 
             return 0;
 
@@ -1730,7 +1732,7 @@ pa_usec_t pa_sink_get_requested_latency(pa_sink *s) {
     return usec;
 }
 
-/* Called from IO thread */
+/* Called from IO as well as the main thread -- the latter only before the IO thread started up */
 void pa_sink_set_max_rewind(pa_sink *s, size_t max_rewind) {
     pa_sink_input *i;
     void *state = NULL;
@@ -1751,7 +1753,7 @@ void pa_sink_set_max_rewind(pa_sink *s, size_t max_rewind) {
         pa_source_set_max_rewind(s->monitor_source, s->thread_info.max_rewind);
 }
 
-/* Called from IO thread */
+/* Called from IO as well as the main thread -- the latter only before the IO thread started up */
 void pa_sink_set_max_request(pa_sink *s, size_t max_request) {
     void *state = NULL;
 

commit c8abe640406ab6dc28a9a478ab0090207ccfc273
Author: Lennart Poettering <lennart at poettering.net>
Date:   Wed Mar 4 02:52:11 2009 +0100

    pa_xnew cannot fail -- that's what the x is in the name

diff --git a/src/modules/module-solaris.c b/src/modules/module-solaris.c
index 783c244..995b3c6 100644
--- a/src/modules/module-solaris.c
+++ b/src/modules/module-solaris.c
@@ -821,9 +821,7 @@ int pa__init(pa_module *m) {
         goto fail;
     }
 
-    if (!(u = pa_xnew0(struct userdata, 1)))
-        goto fail;
-
+    u = pa_xnew0(struct userdata, 1);
     u->sample_counter_lock = pa_mutex_new(FALSE, FALSE);
     u->written_bytes_lock = pa_mutex_new(FALSE, FALSE);
 

commit 869341729f088f3ec19c39aae5565cfae7f7ea33
Author: Lennart Poettering <lennart at poettering.net>
Date:   Wed Mar 4 02:55:34 2009 +0100

    various smaller cleanups

diff --git a/src/modules/alsa/alsa-sink.c b/src/modules/alsa/alsa-sink.c
index bfe4f3b..7bf16c3 100644
--- a/src/modules/alsa/alsa-sink.c
+++ b/src/modules/alsa/alsa-sink.c
@@ -1190,17 +1190,11 @@ static int process_rewind(struct userdata *u) {
 
     /* Figure out how much we shall rewind and reset the counter */
     rewind_nbytes = u->sink->thread_info.rewind_nbytes;
-    u->sink->thread_info.rewind_nbytes = 0;
 
-    if (rewind_nbytes <= 0)
-        goto finish;
-
-    pa_assert(rewind_nbytes > 0);
     pa_log_debug("Requested to rewind %lu bytes.", (unsigned long) rewind_nbytes);
 
-    snd_pcm_hwsync(u->pcm_handle);
-    if ((unused = snd_pcm_avail_update(u->pcm_handle)) < 0) {
-        pa_log("snd_pcm_avail_update() failed: %s", snd_strerror((int) unused));
+    if (PA_UNLIKELY((unused = pa_alsa_safe_avail(u->pcm_handle, u->hwbuf_size, &u->sink->sample_spec)) < 0)) {
+        pa_log("snd_pcm_avail() failed: %s", snd_strerror((int) unused));
         return -1;
     }
 
@@ -1242,12 +1236,8 @@ static int process_rewind(struct userdata *u) {
     } else
         pa_log_debug("Mhmm, actually there is nothing to rewind.");
 
-finish:
-
     pa_sink_process_rewind(u->sink, 0);
-
     return 0;
-
 }
 
 static void thread_func(void *userdata) {
@@ -1276,7 +1266,7 @@ static void thread_func(void *userdata) {
             int work_done;
             pa_usec_t sleep_usec = 0;
 
-            if (u->sink->thread_info.rewind_requested)
+            if (PA_UNLIKELY(u->sink->thread_info.rewind_requested))
                 if (process_rewind(u) < 0)
                         goto fail;
 
@@ -1702,11 +1692,10 @@ pa_sink *pa_alsa_sink_new(pa_module *m, pa_modargs *ma, const char*driver, pa_ca
         u->watermark_step = pa_usec_to_bytes(TSCHED_WATERMARK_STEP_USEC, &u->sink->sample_spec);
     }
 
-    u->sink->thread_info.max_rewind = use_tsched ? u->hwbuf_size : 0;
-    u->sink->thread_info.max_request = u->hwbuf_size;
-
+    pa_sink_set_max_rewind(u->sink, use_tsched ? u->hwbuf_size : 0);
+    pa_sink_set_max_request(u->sink, u->hwbuf_size);
     pa_sink_set_latency_range(u->sink,
-                              !use_tsched ? pa_bytes_to_usec(u->hwbuf_size, &ss) : (pa_usec_t) -1,
+                              use_tsched ? (pa_usec_t) -1 : pa_bytes_to_usec(u->hwbuf_size, &ss),
                               pa_bytes_to_usec(u->hwbuf_size, &ss));
 
     pa_log_info("Using %u fragments of size %lu bytes, buffer time is %0.2fms",
diff --git a/src/modules/alsa/alsa-source.c b/src/modules/alsa/alsa-source.c
index 04cb262..f4acad8 100644
--- a/src/modules/alsa/alsa-source.c
+++ b/src/modules/alsa/alsa-source.c
@@ -1545,7 +1545,7 @@ pa_source *pa_alsa_source_new(pa_module *m, pa_modargs *ma, const char*driver, p
     }
 
     pa_source_set_latency_range(u->source,
-                                !use_tsched ? pa_bytes_to_usec(u->hwbuf_size, &ss) : (pa_usec_t) -1,
+                                use_tsched ? (pa_usec_t) -1 : pa_bytes_to_usec(u->hwbuf_size, &ss),
                                 pa_bytes_to_usec(u->hwbuf_size, &ss));
 
     pa_log_info("Using %u fragments of size %lu bytes, buffer time is %0.2fms",

-- 
hooks/post-receive
PulseAudio Sound Server



More information about the pulseaudio-commits mailing list