[pulseaudio-commits] [SCM] PulseAudio Sound Server branch, master, updated. v1.0-dev-63-gd766b38

Colin Guthrie gitmailer-noreply at 0pointer.de
Mon Jan 31 05:01:15 PST 2011


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  a509f10f95448fbbd209f2b4903b7c5441886711 (commit)

- Log -----------------------------------------------------------------
d766b38 build: Remove unnecessary flags in AM_CFLAGS
974af43 build: Don't include empty Makefile.am in subdirs
d6cdd80 build: Generate module symdefs in src/modules directory
8534149 Merge remote branch 'mkbosmans/rate-adjustment'
74eb4d8 Fighting rewinds: Reduce calls to handle_seek
fe7b972 Fighting rewinds: Seek and write data in the same message
1250b5d ratelimit: fix log levels of log suppression messages
72b90ea module-rtp-recv: Request proper rewind after underrun
27db060 module-rtp-recv: Remove smoother from write index
e868638 module-rtp-recv: Average the estimated real sample rate
d053a25 module-rtp-recv: Use new algorithm for adjusting sample rate
8b4cb54 Limit rate adjustments to small, inaudible jumps
11dbe30 module-loopback: Add adjust_time to valid args
-----------------------------------------------------------------------

Summary of changes:
 configure.ac                                    |   19 --
 src/Makefile.am                                 |  216 ++++++++++-------------
 src/daemon/Makefile.am                          |   20 --
 src/modules/Makefile.am                         |   20 --
 src/modules/alsa/Makefile.am                    |   20 --
 src/modules/alsa/alsa-sink.c                    |    6 +-
 src/modules/alsa/alsa-source.c                  |    4 +-
 src/modules/alsa/mixer/Makefile.am              |   20 --
 src/modules/alsa/mixer/paths/Makefile.am        |   20 --
 src/modules/alsa/mixer/profile-sets/Makefile.am |   20 --
 src/modules/bluetooth/Makefile.am               |   20 --
 src/modules/dbus/Makefile.am                    |   20 --
 src/modules/gconf/Makefile.am                   |   20 --
 src/modules/jack/Makefile.am                    |   20 --
 src/modules/module-combine.c                    |   26 ++-
 src/modules/module-loopback.c                   |   19 ++-
 src/modules/module-udev-detect.c                |    2 +-
 src/modules/oss/Makefile.am                     |   20 --
 src/modules/raop/Makefile.am                    |   20 --
 src/modules/rtp/Makefile.am                     |   20 --
 src/modules/rtp/module-rtp-recv.c               |  118 ++++++++-----
 src/modules/x11/Makefile.am                     |   20 --
 src/pulse/Makefile.am                           |   20 --
 src/pulsecore/Makefile.am                       |   20 --
 src/pulsecore/asyncq.c                          |    2 +-
 src/pulsecore/ffmpeg/Makefile.am                |   20 --
 src/pulsecore/flist.c                           |    2 +-
 src/pulsecore/log.c                             |    4 +-
 src/pulsecore/log.h                             |    2 +-
 src/pulsecore/memblock.c                        |    2 +-
 src/pulsecore/protocol-native.c                 |   60 +++---
 src/pulsecore/pstream.c                         |    2 +-
 src/pulsecore/ratelimit.c                       |    4 +-
 src/pulsecore/ratelimit.h                       |    3 +-
 src/pulsecore/sink.c                            |    2 +-
 src/tests/Makefile.am                           |   20 --
 src/utils/Makefile.am                           |   20 --
 37 files changed, 247 insertions(+), 626 deletions(-)
 delete mode 100644 src/daemon/Makefile.am
 delete mode 100644 src/modules/Makefile.am
 delete mode 100644 src/modules/alsa/Makefile.am
 delete mode 100644 src/modules/alsa/mixer/Makefile.am
 delete mode 100644 src/modules/alsa/mixer/paths/Makefile.am
 delete mode 100644 src/modules/alsa/mixer/profile-sets/Makefile.am
 delete mode 100644 src/modules/bluetooth/Makefile.am
 delete mode 100644 src/modules/dbus/Makefile.am
 delete mode 100644 src/modules/gconf/Makefile.am
 delete mode 100644 src/modules/jack/Makefile.am
 delete mode 100644 src/modules/oss/Makefile.am
 delete mode 100644 src/modules/raop/Makefile.am
 delete mode 100644 src/modules/rtp/Makefile.am
 delete mode 100644 src/modules/x11/Makefile.am
 delete mode 100644 src/pulse/Makefile.am
 delete mode 100644 src/pulsecore/Makefile.am
 delete mode 100644 src/pulsecore/ffmpeg/Makefile.am
 delete mode 100644 src/tests/Makefile.am
 delete mode 100644 src/utils/Makefile.am

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

commit 11dbe30bfae09235307115f413fb6172df04a895
Author: Maarten Bosmans <mkbosmans at gmail.com>
Date:   Sun Jan 16 01:42:20 2011 +0100

    module-loopback: Add adjust_time to valid args

diff --git a/src/modules/module-loopback.c b/src/modules/module-loopback.c
index 55716b2..dfd5e76 100644
--- a/src/modules/module-loopback.c
+++ b/src/modules/module-loopback.c
@@ -106,6 +106,7 @@ struct userdata {
 static const char* const valid_modargs[] = {
     "source",
     "sink",
+    "adjust_time",
     "latency_msec",
     "format",
     "rate",

commit 8b4cb54595baeeb1d9b7d11a842ef7946e43a55a
Author: Maarten Bosmans <mkbosmans at gmail.com>
Date:   Fri Jan 7 01:25:55 2011 +0100

    Limit rate adjustments to small, inaudible jumps
    
    The same logic is applied to the sample rate adjustments in module-rtp-recv,
    module-loopback and module-combine:
     - Each time an adjustment is made, the new rate can differ at most 2‰ from the
       old rate.  Such a step is equal to 3.5 cents (a cent is 1/100th of a
       semitone) and as 5 cents is generally considered the smallest observable
       difference in pitch, this results in inaudible adjustments.
     - The sample rate of the stream can only differ from the rate of the
       corresponding sink by 25%.  As these adjustments are meant to account for
       very small clock drifts, any large deviation from the base rate suggests
       something is seriously wrong.
     - If the calculated rate is within 20Hz of the base rate, set it to the base
       rate.  This saves CPU because no resampling is necessary.

diff --git a/src/modules/module-combine.c b/src/modules/module-combine.c
index bcea229..3104ed6 100644
--- a/src/modules/module-combine.c
+++ b/src/modules/module-combine.c
@@ -217,23 +217,29 @@ static void adjust_rates(struct userdata *u) {
     base_rate = u->sink->sample_spec.rate;
 
     PA_IDXSET_FOREACH(o, u->outputs, idx) {
-        uint32_t r = base_rate;
+        uint32_t new_rate = base_rate;
+        uint32_t current_rate = o->sink_input->sample_spec.rate;
 
         if (!o->sink_input || !PA_SINK_IS_OPENED(pa_sink_get_state(o->sink)))
             continue;
 
-        if (o->total_latency < target_latency)
-            r -= (uint32_t) ((((double) (target_latency - o->total_latency))/(double)u->adjust_time)*(double)r);
-        else if (o->total_latency > target_latency)
-            r += (uint32_t) ((((double) (o->total_latency - target_latency))/(double)u->adjust_time)*(double)r);
+        if (o->total_latency != target_latency)
+            new_rate += (uint32_t) (((double) o->total_latency - (double) target_latency) / (double) u->adjust_time * (double) new_rate);
 
-        if (r < (uint32_t) (base_rate*0.9) || r > (uint32_t) (base_rate*1.1)) {
-            pa_log_warn("[%s] sample rates too different, not adjusting (%u vs. %u).", o->sink_input->sink->name, base_rate, r);
-            pa_sink_input_set_rate(o->sink_input, base_rate);
+        if (new_rate < (uint32_t) (base_rate*0.8) || new_rate > (uint32_t) (base_rate*1.25)) {
+            pa_log_warn("[%s] sample rates too different, not adjusting (%u vs. %u).", o->sink_input->sink->name, base_rate, new_rate);
+            new_rate = base_rate;
         } else {
-            pa_log_info("[%s] new rate is %u Hz; ratio is %0.3f; latency is %0.0f usec.", o->sink_input->sink->name, r, (double) r / base_rate, (float) o->total_latency);
-            pa_sink_input_set_rate(o->sink_input, r);
+            if (base_rate < new_rate + 20 && new_rate < base_rate + 20)
+              new_rate = base_rate;
+            /* Do the adjustment in small steps; 2‰ can be considered inaudible */
+            if (new_rate < (uint32_t) (current_rate*0.998) || new_rate > (uint32_t) (current_rate*1.002)) {
+                pa_log_info("[%s] new rate of %u Hz not within 2‰ of %u Hz, forcing smaller adjustment", o->sink_input->sink->name, new_rate, current_rate);
+                new_rate = PA_CLAMP(new_rate, (uint32_t) (current_rate*0.998), (uint32_t) (current_rate*1.002));
+            }
+            pa_log_info("[%s] new rate is %u Hz; ratio is %0.3f; latency is %0.2f msec.", o->sink_input->sink->name, new_rate, (double) new_rate / base_rate, (double) o->total_latency / PA_USEC_PER_MSEC);
         }
+        pa_sink_input_set_rate(o->sink_input, new_rate);
     }
 
     pa_asyncmsgq_send(u->sink->asyncmsgq, PA_MSGOBJECT(u->sink), SINK_MESSAGE_UPDATE_LATENCY, NULL, (int64_t) avg_total_latency, NULL);
diff --git a/src/modules/module-loopback.c b/src/modules/module-loopback.c
index dfd5e76..2b1f505 100644
--- a/src/modules/module-loopback.c
+++ b/src/modules/module-loopback.c
@@ -175,13 +175,13 @@ static void adjust_rates(struct userdata *u) {
 
     buffer_latency = pa_bytes_to_usec(buffer, &u->sink_input->sample_spec);
 
-    pa_log_info("Loopback overall latency is %0.2f ms + %0.2f ms + %0.2f ms = %0.2f ms",
+    pa_log_debug("Loopback overall latency is %0.2f ms + %0.2f ms + %0.2f ms = %0.2f ms",
                 (double) u->latency_snapshot.sink_latency / PA_USEC_PER_MSEC,
                 (double) buffer_latency / PA_USEC_PER_MSEC,
                 (double) u->latency_snapshot.source_latency / PA_USEC_PER_MSEC,
                 ((double) u->latency_snapshot.sink_latency + buffer_latency + u->latency_snapshot.source_latency) / PA_USEC_PER_MSEC);
 
-    pa_log_info("Should buffer %zu bytes, buffered at minimum %zu bytes",
+    pa_log_debug("Should buffer %zu bytes, buffered at minimum %zu bytes",
                 u->latency_snapshot.max_request*2,
                 u->latency_snapshot.min_memblockq_length);
 
@@ -194,9 +194,21 @@ static void adjust_rates(struct userdata *u) {
     else
         new_rate = base_rate + (((u->latency_snapshot.min_memblockq_length - u->latency_snapshot.max_request*2) / fs) *PA_USEC_PER_SEC)/u->adjust_time;
 
-    pa_log_info("Old rate %lu Hz, new rate %lu Hz", (unsigned long) old_rate, (unsigned long) new_rate);
+    if (new_rate < (uint32_t) (base_rate*0.8) || new_rate > (uint32_t) (base_rate*1.25)) {
+        pa_log_warn("Sample rates too different, not adjusting (%u vs. %u).", base_rate, new_rate);
+        new_rate = base_rate;
+    } else {
+        if (base_rate < new_rate + 20 && new_rate < base_rate + 20)
+          new_rate = base_rate;
+        /* Do the adjustment in small steps; 2‰ can be considered inaudible */
+        if (new_rate < (uint32_t) (old_rate*0.998) || new_rate > (uint32_t) (old_rate*1.002)) {
+            pa_log_info("New rate of %u Hz not within 2‰ of %u Hz, forcing smaller adjustment", new_rate, old_rate);
+            new_rate = PA_CLAMP(new_rate, (uint32_t) (old_rate*0.998), (uint32_t) (old_rate*1.002));
+        }
+    }
 
     pa_sink_input_set_rate(u->sink_input, new_rate);
+    pa_log_debug("[%s] Updated sampling rate to %lu Hz.", u->sink_input->sink->name, (unsigned long) new_rate);
 
     pa_core_rttime_restart(u->core, u->time_event, pa_rtclock_now() + u->adjust_time);
 }
diff --git a/src/modules/rtp/module-rtp-recv.c b/src/modules/rtp/module-rtp-recv.c
index 7dbb1ef..3bbeb1f 100644
--- a/src/modules/rtp/module-rtp-recv.c
+++ b/src/modules/rtp/module-rtp-recv.c
@@ -288,6 +288,9 @@ static int rtpoll_work_cb(pa_rtpoll_item *i) {
     if (s->last_rate_update + RATE_UPDATE_INTERVAL < pa_timeval_load(&now)) {
         pa_usec_t wi, ri, render_delay, sink_delay = 0, latency, fix;
         unsigned fix_samples;
+        uint32_t base_rate = s->sink_input->sink->sample_spec.rate;
+        uint32_t current_rate = s->sink_input->sample_spec.rate;
+        uint32_t new_rate;
 
         pa_log_debug("Updating sample rate");
 
@@ -309,7 +312,7 @@ static int rtpoll_work_cb(pa_rtpoll_item *i) {
         else
             latency = wi - ri;
 
-        pa_log_debug("Write index deviates by %0.2f ms, expected %0.2f ms", (double) latency/PA_USEC_PER_MSEC, (double)  s->intended_latency/PA_USEC_PER_MSEC);
+        pa_log_debug("Write index deviates by %0.2f ms, expected %0.2f ms", (double) latency/PA_USEC_PER_MSEC, (double) s->intended_latency/PA_USEC_PER_MSEC);
 
         /* Calculate deviation */
         if (latency < s->intended_latency)
@@ -320,19 +323,24 @@ static int rtpoll_work_cb(pa_rtpoll_item *i) {
         /* How many samples is this per second? */
         fix_samples = (unsigned) (fix * (pa_usec_t) s->sink_input->thread_info.sample_spec.rate / (pa_usec_t) RATE_UPDATE_INTERVAL);
 
-        /* Check if deviation is in bounds */
-        if (fix_samples > s->sink_input->sample_spec.rate*.50)
-            pa_log_debug("Hmmm, rate fix is too large (%lu Hz), not applying.", (unsigned long) fix_samples);
-        else {
-            /* Fix up rate */
-            if (latency < s->intended_latency)
-                s->sink_input->sample_spec.rate -= fix_samples;
-            else
-                s->sink_input->sample_spec.rate += fix_samples;
-
-            if (s->sink_input->sample_spec.rate > PA_RATE_MAX)
-                s->sink_input->sample_spec.rate = PA_RATE_MAX;
+        if (latency < s->intended_latency)
+            new_rate = current_rate - fix_samples;
+        else
+            new_rate = current_rate + fix_samples;
+
+        if (new_rate < (uint32_t) (base_rate*0.8) || new_rate > (uint32_t) (base_rate*1.25)) {
+            pa_log_warn("Sample rates too different, not adjusting (%u vs. %u).", base_rate, new_rate);
+            new_rate = base_rate;
+        } else {
+            if (base_rate < new_rate + 20 && new_rate < base_rate + 20)
+              new_rate = base_rate;
+            /* Do the adjustment in small steps; 2‰ can be considered inaudible */
+            if (new_rate < (uint32_t) (current_rate*0.998) || new_rate > (uint32_t) (current_rate*1.002)) {
+                pa_log_info("New rate of %u Hz not within 2‰ of %u Hz, forcing smaller adjustment", new_rate, current_rate);
+                new_rate = PA_CLAMP(new_rate, (uint32_t) (current_rate*0.998), (uint32_t) (current_rate*1.002));
+            }
         }
+        s->sink_input->sample_spec.rate = new_rate;
 
         pa_assert(pa_sample_spec_valid(&s->sink_input->sample_spec));
 

commit d053a25b67c5e70c83ed4dcfba1032b293d2cce9
Author: Maarten Bosmans <mkbosmans at gmail.com>
Date:   Wed Jan 12 07:24:58 2011 +0100

    module-rtp-recv: Use new algorithm for adjusting sample rate

diff --git a/src/modules/rtp/module-rtp-recv.c b/src/modules/rtp/module-rtp-recv.c
index 3bbeb1f..4125d28 100644
--- a/src/modules/rtp/module-rtp-recv.c
+++ b/src/modules/rtp/module-rtp-recv.c
@@ -109,6 +109,7 @@ struct session {
     pa_usec_t sink_latency;
 
     pa_usec_t last_rate_update;
+    pa_usec_t last_latency;
 };
 
 struct userdata {
@@ -286,11 +287,11 @@ static int rtpoll_work_cb(pa_rtpoll_item *i) {
     pa_atomic_store(&s->timestamp, (int) now.tv_sec);
 
     if (s->last_rate_update + RATE_UPDATE_INTERVAL < pa_timeval_load(&now)) {
-        pa_usec_t wi, ri, render_delay, sink_delay = 0, latency, fix;
-        unsigned fix_samples;
+        pa_usec_t wi, ri, render_delay, sink_delay = 0, latency;
         uint32_t base_rate = s->sink_input->sink->sample_spec.rate;
         uint32_t current_rate = s->sink_input->sample_spec.rate;
         uint32_t new_rate;
+        double estimated_rate;
 
         pa_log_debug("Updating sample rate");
 
@@ -314,19 +315,31 @@ static int rtpoll_work_cb(pa_rtpoll_item *i) {
 
         pa_log_debug("Write index deviates by %0.2f ms, expected %0.2f ms", (double) latency/PA_USEC_PER_MSEC, (double) s->intended_latency/PA_USEC_PER_MSEC);
 
-        /* Calculate deviation */
-        if (latency < s->intended_latency)
-            fix = s->intended_latency - latency;
-        else
-            fix = latency - s->intended_latency;
-
-        /* How many samples is this per second? */
-        fix_samples = (unsigned) (fix * (pa_usec_t) s->sink_input->thread_info.sample_spec.rate / (pa_usec_t) RATE_UPDATE_INTERVAL);
-
-        if (latency < s->intended_latency)
-            new_rate = current_rate - fix_samples;
-        else
-            new_rate = current_rate + fix_samples;
+        /* The buffer is filling with some unknown rate RÌ‚ samples/second. If the rate of reading in
+         * the last T seconds was Rⁿ, then the increase in buffer latency ΔLⁿ = Lⁿ - Lⁿ⁻ⁱ in that
+         * same period is ΔLⁿ = (TR̂ - TRⁿ) / R̂, giving the estimated target rate
+         *                                           T
+         *                                 R̂ = ─────────────── Rⁿ .                             (1)
+         *                                     T - (Lⁿ - Lⁿ⁻ⁱ)
+         *
+         * Setting the sample rate to RÌ‚ results in the latency being constant (if the estimate of RÌ‚
+         * is correct).  But there is also the requirement to keep the buffer at a predefined target
+         * latency L̂.  So instead of setting Rⁿ⁺ⁱ to R̂ immediately, the strategy will be to reduce R
+         * from Rⁿ⁺ⁱ to R̂ in a steps of T seconds, where Rⁿ⁺ⁱ is chosen such that in the total time
+         * aT the latency is reduced from Lⁿ to L̂.  This strategy translates to the requirements
+         *            ₐ      R̂ - Rⁿ⁺ʲ                            a-j+1         j-1
+         *            Σ  T ────────── = L̂ - Lⁿ    with    Rⁿ⁺ʲ = ───── Rⁿ⁺ⁱ + ───── R̂ .
+         *           ʲ⁼ⁱ        R̂                                  a            a
+         * Solving for Rⁿ⁺ⁱ gives
+         *                                     T - ²∕ₐ₊₁(L̂ - Lⁿ)
+         *                              Rⁿ⁺ⁱ = ───────────────── R̂ .                            (2)
+         *                                            T
+         * Together Equations (1) and (2) specify the algorithm used below, where a = 7 is used.
+         */
+        estimated_rate = (double) current_rate * (double) RATE_UPDATE_INTERVAL / (double) (RATE_UPDATE_INTERVAL + s->last_latency - latency);
+        pa_log_debug("Estimated target rate: %.0f Hz", estimated_rate);
+        new_rate = (uint32_t) ((double) (RATE_UPDATE_INTERVAL + latency/4 - s->intended_latency/4) / (double) RATE_UPDATE_INTERVAL * estimated_rate);
+        s->last_latency = latency;
 
         if (new_rate < (uint32_t) (base_rate*0.8) || new_rate > (uint32_t) (base_rate*1.25)) {
             pa_log_warn("Sample rates too different, not adjusting (%u vs. %u).", base_rate, new_rate);
@@ -488,6 +501,7 @@ static struct session *session_new(struct userdata *u, const pa_sdp_info *sdp_in
             pa_timeval_load(&now),
             TRUE);
     s->last_rate_update = pa_timeval_load(&now);
+    s->last_latency = LATENCY_USEC;
     pa_atomic_store(&s->timestamp, (int) now.tv_sec);
 
     if ((fd = mcast_socket((const struct sockaddr*) &sdp_info->sa, sdp_info->salen)) < 0)

commit e868638768fc492ff5906a6e38b8223808608976
Author: Maarten Bosmans <mkbosmans at gmail.com>
Date:   Sun Jan 16 01:27:29 2011 +0100

    module-rtp-recv: Average the estimated real sample rate

diff --git a/src/modules/rtp/module-rtp-recv.c b/src/modules/rtp/module-rtp-recv.c
index 4125d28..3cf5d89 100644
--- a/src/modules/rtp/module-rtp-recv.c
+++ b/src/modules/rtp/module-rtp-recv.c
@@ -110,6 +110,8 @@ struct session {
 
     pa_usec_t last_rate_update;
     pa_usec_t last_latency;
+    double estimated_rate;
+    double avg_estimated_rate;
 };
 
 struct userdata {
@@ -291,7 +293,7 @@ static int rtpoll_work_cb(pa_rtpoll_item *i) {
         uint32_t base_rate = s->sink_input->sink->sample_spec.rate;
         uint32_t current_rate = s->sink_input->sample_spec.rate;
         uint32_t new_rate;
-        double estimated_rate;
+        double estimated_rate, alpha = 0.02;
 
         pa_log_debug("Updating sample rate");
 
@@ -334,11 +336,25 @@ static int rtpoll_work_cb(pa_rtpoll_item *i) {
          *                                     T - ²∕ₐ₊₁(L̂ - Lⁿ)
          *                              Rⁿ⁺ⁱ = ───────────────── R̂ .                            (2)
          *                                            T
-         * Together Equations (1) and (2) specify the algorithm used below, where a = 7 is used.
+         * In the code below a = 7 is used.
+         *
+         * Equation (1) is not directly used in (2), but instead an exponentially weighted average
+         * of the estimated rate RÌ‚ is used.  This average RÌ… is defined as
+         *                                R̅ⁿ = α R̂ⁿ + (1-α) R̅ⁿ⁻ⁱ .
+         * Because it is difficult to find a fixed value for the coefficient α such that the
+         * averaging is without significant lag but oscillations are filtered out, a heuristic is
+         * used.  When the successive estimates R̂ⁿ do not change much then α→1, but when there is a
+         * sudden spike in the estimated rate α→0, such that the deviation is given little weight.
          */
         estimated_rate = (double) current_rate * (double) RATE_UPDATE_INTERVAL / (double) (RATE_UPDATE_INTERVAL + s->last_latency - latency);
-        pa_log_debug("Estimated target rate: %.0f Hz", estimated_rate);
-        new_rate = (uint32_t) ((double) (RATE_UPDATE_INTERVAL + latency/4 - s->intended_latency/4) / (double) RATE_UPDATE_INTERVAL * estimated_rate);
+        if (fabs(s->estimated_rate - s->avg_estimated_rate) > 1) {
+          double ratio = (estimated_rate + s->estimated_rate - 2*s->avg_estimated_rate) / (s->estimated_rate - s->avg_estimated_rate);
+          alpha = PA_CLAMP(2 * (ratio + fabs(ratio)) / (4 + ratio*ratio), 0.02, 0.8);
+        }
+        s->avg_estimated_rate = alpha * estimated_rate + (1-alpha) * s->avg_estimated_rate;
+        s->estimated_rate = estimated_rate;
+        pa_log_debug("Estimated target rate: %.0f Hz, using average of %.0f Hz  (α=%.3f)", estimated_rate, s->avg_estimated_rate, alpha);
+        new_rate = (uint32_t) ((double) (RATE_UPDATE_INTERVAL + latency/4 - s->intended_latency/4) / (double) RATE_UPDATE_INTERVAL * s->avg_estimated_rate);
         s->last_latency = latency;
 
         if (new_rate < (uint32_t) (base_rate*0.8) || new_rate > (uint32_t) (base_rate*1.25)) {
@@ -502,6 +518,8 @@ static struct session *session_new(struct userdata *u, const pa_sdp_info *sdp_in
             TRUE);
     s->last_rate_update = pa_timeval_load(&now);
     s->last_latency = LATENCY_USEC;
+    s->estimated_rate = (double) sink->sample_spec.rate;
+    s->avg_estimated_rate = (double) sink->sample_spec.rate;
     pa_atomic_store(&s->timestamp, (int) now.tv_sec);
 
     if ((fd = mcast_socket((const struct sockaddr*) &sdp_info->sa, sdp_info->salen)) < 0)

commit 27db0603d6af7d25558af38ed525fc50330a9c32
Author: Maarten Bosmans <mkbosmans at gmail.com>
Date:   Wed Jan 12 07:31:26 2011 +0100

    module-rtp-recv: Remove smoother from write index
    
    It isn't necessary anymore with the new algorithm.  The slow adjust of the
    smoother was even detrimental to the accuracy of the rate estimate.

diff --git a/src/modules/rtp/module-rtp-recv.c b/src/modules/rtp/module-rtp-recv.c
index 3cf5d89..49fdf9b 100644
--- a/src/modules/rtp/module-rtp-recv.c
+++ b/src/modules/rtp/module-rtp-recv.c
@@ -52,7 +52,6 @@
 #include <pulsecore/macro.h>
 #include <pulsecore/atomic.h>
 #include <pulsecore/atomic.h>
-#include <pulsecore/time-smoother.h>
 #include <pulsecore/socket-util.h>
 #include <pulsecore/once.h>
 
@@ -104,7 +103,6 @@ struct session {
 
     pa_atomic_t timestamp;
 
-    pa_smoother *smoother;
     pa_usec_t intended_latency;
     pa_usec_t sink_latency;
 
@@ -197,10 +195,9 @@ static void sink_input_suspend_within_thread(pa_sink_input* i, pa_bool_t b) {
     pa_sink_input_assert_ref(i);
     pa_assert_se(s = i->userdata);
 
-    if (b) {
-        pa_smoother_pause(s->smoother, pa_rtclock_now());
+    if (b)
         pa_memblockq_flush_read(s->memblockq);
-    } else
+    else
         s->first_packet = FALSE;
 }
 
@@ -269,11 +266,6 @@ static int rtpoll_work_cb(pa_rtpoll_item *i) {
     } else
         pa_rtclock_from_wallclock(&now);
 
-    pa_smoother_put(s->smoother, pa_timeval_load(&now), pa_bytes_to_usec((uint64_t) pa_memblockq_get_write_index(s->memblockq), &s->sink_input->sample_spec));
-
-    /* Tell the smoother that we are rolling now, in case it is still paused */
-    pa_smoother_resume(s->smoother, pa_timeval_load(&now), TRUE);
-
     if (pa_memblockq_push(s->memblockq, &chunk) < 0) {
         pa_log_warn("Queue overrun");
         pa_memblockq_seek(s->memblockq, (int64_t) chunk.length, PA_SEEK_RELATIVE, TRUE);
@@ -297,7 +289,7 @@ static int rtpoll_work_cb(pa_rtpoll_item *i) {
 
         pa_log_debug("Updating sample rate");
 
-        wi = pa_smoother_get(s->smoother, pa_timeval_load(&now));
+        wi = pa_bytes_to_usec((uint64_t) pa_memblockq_get_write_index(s->memblockq), &s->sink_input->sample_spec);
         ri = pa_bytes_to_usec((uint64_t) pa_memblockq_get_read_index(s->memblockq), &s->sink_input->sample_spec);
 
         pa_log_debug("wi=%lu ri=%lu", (unsigned long) wi, (unsigned long) ri);
@@ -508,14 +500,6 @@ static struct session *session_new(struct userdata *u, const pa_sdp_info *sdp_in
     s->sdp_info = *sdp_info;
     s->rtpoll_item = NULL;
     s->intended_latency = LATENCY_USEC;
-    s->smoother = pa_smoother_new(
-            PA_USEC_PER_SEC*5,
-            PA_USEC_PER_SEC*2,
-            TRUE,
-            TRUE,
-            10,
-            pa_timeval_load(&now),
-            TRUE);
     s->last_rate_update = pa_timeval_load(&now);
     s->last_latency = LATENCY_USEC;
     s->estimated_rate = (double) sink->sample_spec.rate;
@@ -619,8 +603,6 @@ static void session_free(struct session *s) {
     pa_sdp_info_destroy(&s->sdp_info);
     pa_rtp_context_destroy(&s->rtp_context);
 
-    pa_smoother_free(s->smoother);
-
     pa_xfree(s);
 }
 

commit 72b90ea8ac53e23862284991a2ce355de250f585
Author: Maarten Bosmans <mkbosmans at gmail.com>
Date:   Wed Jan 12 07:34:28 2011 +0100

    module-rtp-recv: Request proper rewind after underrun

diff --git a/src/modules/rtp/module-rtp-recv.c b/src/modules/rtp/module-rtp-recv.c
index 49fdf9b..b59519f 100644
--- a/src/modules/rtp/module-rtp-recv.c
+++ b/src/modules/rtp/module-rtp-recv.c
@@ -375,7 +375,9 @@ static int rtpoll_work_cb(pa_rtpoll_item *i) {
     if (pa_memblockq_is_readable(s->memblockq) &&
         s->sink_input->thread_info.underrun_for > 0) {
         pa_log_debug("Requesting rewind due to end of underrun");
-        pa_sink_input_request_rewind(s->sink_input, 0, FALSE, TRUE, FALSE);
+        pa_sink_input_request_rewind(s->sink_input,
+                                     (size_t) (s->sink_input->thread_info.underrun_for == (uint64_t) -1 ? 0 : s->sink_input->thread_info.underrun_for),
+                                     FALSE, TRUE, FALSE);
     }
 
     return 1;

commit 1250b5d735129c3e04c45484f80f99cdb12f39a1
Author: Lennart Poettering <lennart at poettering.net>
Date:   Sat Jan 22 01:08:36 2011 +0100

    ratelimit: fix log levels of log suppression messages
    
    When logging a suppression message do so on the same log level as the
    suppressed messages.
    
    Cherry picked by Colin Guthrie from ec5a7857127a1b3b9c5517c4a70a9b2c8aab35ca
    with a couple of additional changes due to extra limiting in master
    that was not present in stable-queue.

diff --git a/src/modules/alsa/alsa-sink.c b/src/modules/alsa/alsa-sink.c
index f861904..9ed4d4d 100644
--- a/src/modules/alsa/alsa-sink.c
+++ b/src/modules/alsa/alsa-sink.c
@@ -440,7 +440,7 @@ static size_t check_left_to_play(struct userdata *u, size_t n_bytes, pa_bool_t o
 #endif
 
         if (!u->first && !u->after_rewind)
-            if (pa_log_ratelimit())
+            if (pa_log_ratelimit(PA_LOG_INFO))
                 pa_log_info("Underrun!");
     }
 
@@ -1511,7 +1511,7 @@ static void thread_func(void *userdata) {
                      * we have filled the buffer at least once
                      * completely.*/
 
-                    if (pa_log_ratelimit())
+                    if (pa_log_ratelimit(PA_LOG_DEBUG))
                         pa_log_debug("Cutting sleep time for the initial iterations by half.");
                     sleep_usec /= 2;
                 }
@@ -1575,7 +1575,7 @@ static void thread_func(void *userdata) {
 
                 u->first = TRUE;
                 u->since_start = 0;
-            } else if (revents && u->use_tsched && pa_log_ratelimit())
+            } else if (revents && u->use_tsched && pa_log_ratelimit(PA_LOG_DEBUG))
                 pa_log_debug("Wakeup from ALSA!");
 
         } else
diff --git a/src/modules/alsa/alsa-source.c b/src/modules/alsa/alsa-source.c
index d214749..45a7af3 100644
--- a/src/modules/alsa/alsa-source.c
+++ b/src/modules/alsa/alsa-source.c
@@ -428,7 +428,7 @@ static size_t check_left_to_record(struct userdata *u, size_t n_bytes, pa_bool_t
         PA_DEBUG_TRAP;
 #endif
 
-        if (pa_log_ratelimit())
+        if (pa_log_ratelimit(PA_LOG_INFO))
             pa_log_info("Overrun!");
     }
 
@@ -1323,7 +1323,7 @@ static void thread_func(void *userdata) {
                     goto fail;
 
                 u->first = TRUE;
-            } else if (revents && u->use_tsched && pa_log_ratelimit())
+            } else if (revents && u->use_tsched && pa_log_ratelimit(PA_LOG_DEBUG))
                 pa_log_debug("Wakeup from ALSA!");
 
         } else
diff --git a/src/modules/module-udev-detect.c b/src/modules/module-udev-detect.c
index 2eecc25..1eaa84f 100644
--- a/src/modules/module-udev-detect.c
+++ b/src/modules/module-udev-detect.c
@@ -324,7 +324,7 @@ static void verify_access(struct userdata *u, struct device *d) {
                  * during opening was canceled by a "try again"
                  * failure or a "fatal" failure. */
 
-                if (pa_ratelimit_test(&d->ratelimit)) {
+                if (pa_ratelimit_test(&d->ratelimit, PA_LOG_DEBUG)) {
                     pa_log_debug("Loading module-alsa-card with arguments '%s'", d->args);
                     m = pa_module_load(u->core, "module-alsa-card", d->args);
 
diff --git a/src/pulsecore/asyncq.c b/src/pulsecore/asyncq.c
index 072ef02..e62d0c1 100644
--- a/src/pulsecore/asyncq.c
+++ b/src/pulsecore/asyncq.c
@@ -206,7 +206,7 @@ void pa_asyncq_post(pa_asyncq*l, void *p) {
     /* OK, we couldn't push anything in the queue. So let's queue it
      * locally and push it later */
 
-    if (pa_log_ratelimit())
+    if (pa_log_ratelimit(PA_LOG_WARN))
         pa_log_warn("q overrun, queuing locally");
 
     if (!(q = pa_flist_pop(PA_STATIC_FLIST_GET(localq))))
diff --git a/src/pulsecore/flist.c b/src/pulsecore/flist.c
index 23af5dd..e342a57 100644
--- a/src/pulsecore/flist.c
+++ b/src/pulsecore/flist.c
@@ -124,7 +124,7 @@ int pa_flist_push(pa_flist *l, void *p) {
 
     elem = stack_pop(&l->empty);
     if (elem == NULL) {
-        if (pa_log_ratelimit())
+        if (pa_log_ratelimit(PA_LOG_DEBUG))
             pa_log_debug("%s flist is full (don't worry)", l->name);
         return -1;
     }
diff --git a/src/pulsecore/log.c b/src/pulsecore/log.c
index 0c5a317..7ba41ee 100644
--- a/src/pulsecore/log.c
+++ b/src/pulsecore/log.c
@@ -431,7 +431,7 @@ void pa_log_level(pa_log_level_t level, const char *format, ...) {
     va_end(ap);
 }
 
-pa_bool_t pa_log_ratelimit(void) {
+pa_bool_t pa_log_ratelimit(pa_log_level_t level) {
     /* Not more than 10 messages every 5s */
     static PA_DEFINE_RATELIMIT(ratelimit, 5 * PA_USEC_PER_SEC, 10);
 
@@ -440,5 +440,5 @@ pa_bool_t pa_log_ratelimit(void) {
     if (no_rate_limit)
         return TRUE;
 
-    return pa_ratelimit_test(&ratelimit);
+    return pa_ratelimit_test(&ratelimit, level);
 }
diff --git a/src/pulsecore/log.h b/src/pulsecore/log.h
index 2f379f6..1fd38d4 100644
--- a/src/pulsecore/log.h
+++ b/src/pulsecore/log.h
@@ -135,6 +135,6 @@ LOG_FUNC(error, PA_LOG_ERROR)
 
 #define pa_log pa_log_error
 
-pa_bool_t pa_log_ratelimit(void);
+pa_bool_t pa_log_ratelimit(pa_log_level_t level);
 
 #endif
diff --git a/src/pulsecore/memblock.c b/src/pulsecore/memblock.c
index f38b17c..454900d 100644
--- a/src/pulsecore/memblock.c
+++ b/src/pulsecore/memblock.c
@@ -258,7 +258,7 @@ static struct mempool_slot* mempool_allocate_slot(pa_mempool *p) {
             slot = (struct mempool_slot*) ((uint8_t*) p->memory.ptr + (p->block_size * (size_t) idx));
 
         if (!slot) {
-            if (pa_log_ratelimit())
+            if (pa_log_ratelimit(PA_LOG_DEBUG))
                 pa_log_debug("Pool full");
             pa_atomic_inc(&p->stat.n_pool_full);
             return NULL;
diff --git a/src/pulsecore/protocol-native.c b/src/pulsecore/protocol-native.c
index 85245a9..3943e83 100644
--- a/src/pulsecore/protocol-native.c
+++ b/src/pulsecore/protocol-native.c
@@ -1385,7 +1385,7 @@ static int sink_input_process_msg(pa_msgobject *o, int code, void *userdata, int
 
             if (pa_memblockq_push_align(s->memblockq, chunk) < 0) {
 
-                if (pa_log_ratelimit())
+                if (pa_log_ratelimit(PA_LOG_WARN))
                     pa_log_warn("Failed to push data into queue");
                 pa_asyncmsgq_post(pa_thread_mq_get()->outq, PA_MSGOBJECT(s), PLAYBACK_STREAM_MESSAGE_OVERFLOW, NULL, 0, NULL, NULL);
                 pa_memblockq_seek(s->memblockq, (int64_t) chunk->length, PA_SEEK_RELATIVE, TRUE);
diff --git a/src/pulsecore/pstream.c b/src/pulsecore/pstream.c
index 1d4ac17..3e0bfa3 100644
--- a/src/pulsecore/pstream.c
+++ b/src/pulsecore/pstream.c
@@ -832,7 +832,7 @@ static int do_read(pa_pstream *p) {
                                           ntohl(p->read.shm_info[PA_PSTREAM_SHM_INDEX]),
                                           ntohl(p->read.shm_info[PA_PSTREAM_SHM_LENGTH])))) {
 
-                    if (pa_log_ratelimit())
+                    if (pa_log_ratelimit(PA_LOG_DEBUG))
                         pa_log_debug("Failed to import memory block.");
                 }
 
diff --git a/src/pulsecore/ratelimit.c b/src/pulsecore/ratelimit.c
index 844dd77..a274d2c 100644
--- a/src/pulsecore/ratelimit.c
+++ b/src/pulsecore/ratelimit.c
@@ -35,7 +35,7 @@ static pa_static_mutex mutex = PA_STATIC_MUTEX_INIT;
 /* Modelled after Linux' lib/ratelimit.c by Dave Young
  * <hidave.darkstar at gmail.com>, which is licensed GPLv2. */
 
-pa_bool_t pa_ratelimit_test(pa_ratelimit *r) {
+pa_bool_t pa_ratelimit_test(pa_ratelimit *r, pa_log_level_t t) {
     pa_usec_t now;
     pa_mutex *m;
 
@@ -52,7 +52,7 @@ pa_bool_t pa_ratelimit_test(pa_ratelimit *r) {
         r->begin + r->interval < now) {
 
         if (r->n_missed > 0)
-            pa_log_warn("%u events suppressed", r->n_missed);
+            pa_logl(t, "%u events suppressed", r->n_missed);
 
         r->begin = now;
 
diff --git a/src/pulsecore/ratelimit.h b/src/pulsecore/ratelimit.h
index 9857a29..9a36195 100644
--- a/src/pulsecore/ratelimit.h
+++ b/src/pulsecore/ratelimit.h
@@ -23,6 +23,7 @@
 ***/
 
 #include <pulse/sample.h>
+#include <pulsecore/log.h>
 #include <pulsecore/macro.h>
 
 typedef struct pa_ratelimit {
@@ -51,6 +52,6 @@ typedef struct pa_ratelimit {
         r->begin = 0;                                   \
     } while (FALSE);
 
-pa_bool_t pa_ratelimit_test(pa_ratelimit *r);
+pa_bool_t pa_ratelimit_test(pa_ratelimit *r, pa_log_level_t t);
 
 #endif
diff --git a/src/pulsecore/sink.c b/src/pulsecore/sink.c
index 3cadbff..62000e0 100644
--- a/src/pulsecore/sink.c
+++ b/src/pulsecore/sink.c
@@ -2989,7 +2989,7 @@ pa_bool_t pa_sink_volume_change_apply(pa_sink *s, pa_usec_t *usec_to_next) {
     if (s->thread_info.volume_changes) {
         if (usec_to_next)
             *usec_to_next = s->thread_info.volume_changes->at - now;
-        if (pa_log_ratelimit())
+        if (pa_log_ratelimit(PA_LOG_DEBUG))
             pa_log_debug("Next volume change in %lld usec", s->thread_info.volume_changes->at - now);
     }
     else {

commit fe7b972487bfc85940d2d427096fd9189af3bd7a
Author: David Henningsson <david.henningsson at canonical.com>
Date:   Mon Dec 6 16:25:25 2010 +0100

    Fighting rewinds: Seek and write data in the same message
    
    Allow a message in the queue to perform both a seek and a post data.
    For clients that do not use PA_SEEK_RELATIVE (e g gstreamer), this
    cuts the message count - and sometimes even the rewinds - in half.
    
    Signed-off-by: David Henningsson <david.henningsson at canonical.com>

diff --git a/src/pulsecore/protocol-native.c b/src/pulsecore/protocol-native.c
index 3943e83..adadbff 100644
--- a/src/pulsecore/protocol-native.c
+++ b/src/pulsecore/protocol-native.c
@@ -1352,6 +1352,7 @@ static void flush_write_no_account(pa_memblockq *q) {
 static int sink_input_process_msg(pa_msgobject *o, int code, void *userdata, int64_t offset, pa_memchunk *chunk) {
     pa_sink_input *i = PA_SINK_INPUT(o);
     playback_stream *s;
+    int64_t windex_seek = 0;
 
     pa_sink_input_assert_ref(i);
     s = PLAYBACK_STREAM(i->userdata);
@@ -1360,18 +1361,19 @@ static int sink_input_process_msg(pa_msgobject *o, int code, void *userdata, int
     switch (code) {
 
         case SINK_INPUT_MESSAGE_SEEK: {
-            int64_t windex;
 
-            windex = pa_memblockq_get_write_index(s->memblockq);
+            windex_seek = pa_memblockq_get_write_index(s->memblockq);
 
             /* The client side is incapable of accounting correctly
              * for seeks of a type != PA_SEEK_RELATIVE. We need to be
              * able to deal with that. */
 
             pa_memblockq_seek(s->memblockq, offset, PA_PTR_TO_UINT(userdata), PA_PTR_TO_UINT(userdata) == PA_SEEK_RELATIVE);
-
-            handle_seek(s, windex);
-            return 0;
+            if (!chunk) {
+                handle_seek(s, windex_seek);
+                return 0;
+            }
+            /* else fall through and write some data */
         }
 
         case SINK_INPUT_MESSAGE_POST_DATA: {
@@ -1380,6 +1382,8 @@ static int sink_input_process_msg(pa_msgobject *o, int code, void *userdata, int
             pa_assert(chunk);
 
             windex = pa_memblockq_get_write_index(s->memblockq);
+            if (code == SINK_INPUT_MESSAGE_SEEK)
+                windex = PA_MIN(windex, windex_seek);
 
 /*             pa_log("sink input post: %lu %lli", (unsigned long) chunk->length, (long long) windex); */
 
@@ -4466,9 +4470,9 @@ static void pstream_memblock_callback(pa_pstream *p, uint32_t channel, int64_t o
 
         if (chunk->memblock) {
             if (seek != PA_SEEK_RELATIVE || offset != 0)
-                pa_asyncmsgq_post(ps->sink_input->sink->asyncmsgq, PA_MSGOBJECT(ps->sink_input), SINK_INPUT_MESSAGE_SEEK, PA_UINT_TO_PTR(seek), offset, NULL, NULL);
-
-            pa_asyncmsgq_post(ps->sink_input->sink->asyncmsgq, PA_MSGOBJECT(ps->sink_input), SINK_INPUT_MESSAGE_POST_DATA, NULL, 0, chunk, NULL);
+                pa_asyncmsgq_post(ps->sink_input->sink->asyncmsgq, PA_MSGOBJECT(ps->sink_input), SINK_INPUT_MESSAGE_SEEK, PA_UINT_TO_PTR(seek), offset, chunk, NULL);
+            else
+                pa_asyncmsgq_post(ps->sink_input->sink->asyncmsgq, PA_MSGOBJECT(ps->sink_input), SINK_INPUT_MESSAGE_POST_DATA, NULL, 0, chunk, NULL);
         } else
             pa_asyncmsgq_post(ps->sink_input->sink->asyncmsgq, PA_MSGOBJECT(ps->sink_input), SINK_INPUT_MESSAGE_SEEK, PA_UINT_TO_PTR(seek), offset+chunk->length, NULL, NULL);
 

commit 74eb4d892137f6ba4d87b011e46118668187307b
Author: David Henningsson <david.henningsson at canonical.com>
Date:   Thu Dec 9 11:08:37 2010 +0100

    Fighting rewinds: Reduce calls to handle_seek
    
    If many small blocks are in queue, handle_seek is being called
    for every one of them, sometimes causing a rewind. Delay the
    call until all blocks are handled, then call handle_seek only
    once.
    
    Signed-off-by: David Henningsson <david.henningsson at canonical.com>

diff --git a/src/pulsecore/protocol-native.c b/src/pulsecore/protocol-native.c
index adadbff..cc6a6b1 100644
--- a/src/pulsecore/protocol-native.c
+++ b/src/pulsecore/protocol-native.c
@@ -125,6 +125,10 @@ typedef struct playback_stream {
     uint32_t drain_tag;
     uint32_t syncid;
 
+    /* Optimization to avoid too many rewinds with a lot of small blocks */
+    pa_atomic_t seek_or_post_in_queue;
+    int64_t seek_windex;
+
     pa_atomic_t missing;
     pa_usec_t configured_sink_latency;
     pa_buffer_attr buffer_attr;
@@ -1100,6 +1104,8 @@ static playback_stream* playback_stream_new(
     s->buffer_attr = *a;
     s->adjust_latency = adjust_latency;
     s->early_requests = early_requests;
+    pa_atomic_store(&s->seek_or_post_in_queue, 0);
+    s->seek_windex = -1;
 
     s->sink_input->parent.process_msg = sink_input_process_msg;
     s->sink_input->pop = sink_input_pop_cb;
@@ -1352,7 +1358,6 @@ static void flush_write_no_account(pa_memblockq *q) {
 static int sink_input_process_msg(pa_msgobject *o, int code, void *userdata, int64_t offset, pa_memchunk *chunk) {
     pa_sink_input *i = PA_SINK_INPUT(o);
     playback_stream *s;
-    int64_t windex_seek = 0;
 
     pa_sink_input_assert_ref(i);
     s = PLAYBACK_STREAM(i->userdata);
@@ -1360,45 +1365,35 @@ static int sink_input_process_msg(pa_msgobject *o, int code, void *userdata, int
 
     switch (code) {
 
-        case SINK_INPUT_MESSAGE_SEEK: {
-
-            windex_seek = pa_memblockq_get_write_index(s->memblockq);
-
-            /* The client side is incapable of accounting correctly
-             * for seeks of a type != PA_SEEK_RELATIVE. We need to be
-             * able to deal with that. */
-
-            pa_memblockq_seek(s->memblockq, offset, PA_PTR_TO_UINT(userdata), PA_PTR_TO_UINT(userdata) == PA_SEEK_RELATIVE);
-            if (!chunk) {
-                handle_seek(s, windex_seek);
-                return 0;
-            }
-            /* else fall through and write some data */
-        }
-
+        case SINK_INPUT_MESSAGE_SEEK:
         case SINK_INPUT_MESSAGE_POST_DATA: {
-            int64_t windex;
-
-            pa_assert(chunk);
+            int64_t windex = pa_memblockq_get_write_index(s->memblockq);
 
-            windex = pa_memblockq_get_write_index(s->memblockq);
-            if (code == SINK_INPUT_MESSAGE_SEEK)
-                windex = PA_MIN(windex, windex_seek);
-
-/*             pa_log("sink input post: %lu %lli", (unsigned long) chunk->length, (long long) windex); */
+            if (code == SINK_INPUT_MESSAGE_SEEK) {
+                /* The client side is incapable of accounting correctly
+                 * for seeks of a type != PA_SEEK_RELATIVE. We need to be
+                 * able to deal with that. */
 
-            if (pa_memblockq_push_align(s->memblockq, chunk) < 0) {
+                pa_memblockq_seek(s->memblockq, offset, PA_PTR_TO_UINT(userdata), PA_PTR_TO_UINT(userdata) == PA_SEEK_RELATIVE);
+                windex = PA_MIN(windex, pa_memblockq_get_write_index(s->memblockq));
+            }
 
+            if (chunk && pa_memblockq_push_align(s->memblockq, chunk) < 0) {
                 if (pa_log_ratelimit(PA_LOG_WARN))
                     pa_log_warn("Failed to push data into queue");
                 pa_asyncmsgq_post(pa_thread_mq_get()->outq, PA_MSGOBJECT(s), PLAYBACK_STREAM_MESSAGE_OVERFLOW, NULL, 0, NULL, NULL);
                 pa_memblockq_seek(s->memblockq, (int64_t) chunk->length, PA_SEEK_RELATIVE, TRUE);
             }
 
-            handle_seek(s, windex);
-
-/*             pa_log("sink input post2: %lu", (unsigned long) pa_memblockq_get_length(s->memblockq)); */
-
+            /* If more data is in queue, we rewind later instead. */
+            if (s->seek_windex != -1)
+                 windex = PA_MIN(windex, s->seek_windex);
+            if (pa_atomic_dec(&s->seek_or_post_in_queue) > 1)
+                s->seek_windex = windex;
+            else {
+                s->seek_windex = -1;
+                handle_seek(s, windex);
+            }
             return 0;
         }
 
@@ -4468,6 +4463,7 @@ static void pstream_memblock_callback(pa_pstream *p, uint32_t channel, int64_t o
     if (playback_stream_isinstance(stream)) {
         playback_stream *ps = PLAYBACK_STREAM(stream);
 
+        pa_atomic_inc(&ps->seek_or_post_in_queue);
         if (chunk->memblock) {
             if (seek != PA_SEEK_RELATIVE || offset != 0)
                 pa_asyncmsgq_post(ps->sink_input->sink->asyncmsgq, PA_MSGOBJECT(ps->sink_input), SINK_INPUT_MESSAGE_SEEK, PA_UINT_TO_PTR(seek), offset, chunk, NULL);

commit 8534149fbe87c63a5af85f5610c0f62b45500d90
Merge: 74eb4d8 72b90ea
Author: Colin Guthrie <cguthrie at mandriva.org>
Date:   Mon Jan 31 11:45:50 2011 +0000

    Merge remote branch 'mkbosmans/rate-adjustment'


commit d6cdd80b0dce599df95ce3dba032bf074b75e1da
Author: Maarten Bosmans <mkbosmans at gmail.com>
Date:   Tue Jan 25 11:01:46 2011 +0100

    build: Generate module symdefs in src/modules directory
    
    This will make it possible to remove the empty Makefile.am files.
     - module-...-symdef.h files are all generated in src/modules, instead of in the subdir of the module.
     - The default inclusion of src/modules subdirs in AM_CFLAGS can be removed, where necessary (raop) the subdir is
       included in the specific CFLAGS.
     - The src/daemon and src/modules directories are always created on make, to facilitate out of tree builds.
     - AM silent rules are used for the generation of symdef files by m4.
     - For echo-cancel, keep the build dir include for now (and mkdir it) although limit it to just the echo-cancel
       module's CFLAGS (Colin Guthrie)

diff --git a/src/Makefile.am b/src/Makefile.am
index f67b2f6..ae9b149 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -51,29 +51,8 @@ endif
 
 AM_CFLAGS = \
 	-I$(top_srcdir)/src \
-	-I$(top_builddir)/src \
 	-I$(top_srcdir)/src/modules \
 	-I$(top_builddir)/src/modules \
-	-I$(top_srcdir)/src/modules/rtp \
-	-I$(top_builddir)/src/modules/rtp \
-	-I$(top_srcdir)/src/modules/gconf \
-	-I$(top_builddir)/src/modules/gconf \
-	-I$(top_srcdir)/src/modules/bluetooth \
-	-I$(top_builddir)/src/modules/bluetooth \
-	-I$(top_srcdir)/src/modules/oss \
-	-I$(top_builddir)/src/modules/oss \
-	-I$(top_srcdir)/src/modules/alsa \
-	-I$(top_builddir)/src/modules/alsa \
-	-I$(top_srcdir)/src/modules/raop \
-	-I$(top_builddir)/src/modules/raop \
-	-I$(top_srcdir)/src/modules/x11 \
-	-I$(top_builddir)/src/modules/x11 \
-	-I$(top_srcdir)/src/modules/jack \
-	-I$(top_builddir)/src/modules/jack \
-	-I$(top_srcdir)/src/modules/dbus \
-	-I$(top_builddir)/src/modules/dbus \
-	-I$(top_srcdir)/src/modules/echo-cancel \
-	-I$(top_builddir)/src/modules/echo-cancel \
 	$(PTHREAD_CFLAGS) -D_POSIX_PTHREAD_SEMANTICS \
 	$(LIBSAMPLERATE_CFLAGS) \
 	$(LIBSNDFILE_CFLAGS) \
@@ -983,7 +962,7 @@ librtp_la_LIBADD = $(AM_LIBADD) libpulsecore- at PA_MAJORMINOR@.la libpulsecommon-@
 libraop_la_SOURCES = \
         modules/raop/raop_client.c modules/raop/raop_client.h \
         modules/raop/base64.c modules/raop/base64.h
-libraop_la_CFLAGS = $(AM_CFLAGS) $(OPENSSL_CFLAGS)
+libraop_la_CFLAGS = $(AM_CFLAGS) $(OPENSSL_CFLAGS) -I$(top_srcdir)/src/modules/rtp
 libraop_la_LDFLAGS = -avoid-version
 libraop_la_LIBADD = $(AM_LIBADD) $(OPENSSL_LIBS) libpulsecore- at PA_MAJORMINOR@.la librtp.la libpulsecommon- at PA_MAJORMINOR@.la libpulse.la
 
@@ -1242,91 +1221,95 @@ endif
 
 # These are generated by an M4 script
 SYMDEF_FILES = \
-		modules/module-cli-symdef.h \
-		modules/module-cli-protocol-tcp-symdef.h \
-		modules/module-cli-protocol-unix-symdef.h \
-		modules/module-pipe-sink-symdef.h \
-		modules/module-pipe-source-symdef.h \
-		modules/module-simple-protocol-tcp-symdef.h \
-		modules/module-simple-protocol-unix-symdef.h \
-		modules/module-esound-protocol-tcp-symdef.h \
-		modules/module-esound-protocol-unix-symdef.h \
-		modules/module-native-protocol-tcp-symdef.h \
-		modules/module-native-protocol-unix-symdef.h \
-		modules/module-native-protocol-fd-symdef.h \
-		modules/module-sine-symdef.h \
-		modules/module-combine-symdef.h \
-		modules/module-remap-sink-symdef.h \
-		modules/module-ladspa-sink-symdef.h \
-		modules/module-equalizer-sink-symdef.h \
-		modules/module-esound-compat-spawnfd-symdef.h \
-		modules/module-esound-compat-spawnpid-symdef.h \
-		modules/module-match-symdef.h \
-		modules/module-tunnel-sink-symdef.h \
-		modules/module-tunnel-source-symdef.h \
-		modules/module-null-sink-symdef.h \
-		modules/module-sine-source-symdef.h \
-		modules/module-esound-sink-symdef.h \
-		modules/module-zeroconf-publish-symdef.h \
-		modules/module-zeroconf-discover-symdef.h \
-		modules/module-bonjour-publish-symdef.h \
-		modules/module-lirc-symdef.h \
-		modules/module-mmkbd-evdev-symdef.h \
-		modules/module-http-protocol-tcp-symdef.h \
-		modules/module-http-protocol-unix-symdef.h \
-		modules/module-rygel-media-server-symdef.h \
-		modules/x11/module-x11-bell-symdef.h \
-		modules/x11/module-x11-publish-symdef.h \
-		modules/x11/module-x11-xsmp-symdef.h \
-		modules/x11/module-x11-cork-request-symdef.h \
-		modules/oss/module-oss-symdef.h \
-		modules/alsa/module-alsa-sink-symdef.h \
-		modules/alsa/module-alsa-source-symdef.h \
-		modules/alsa/module-alsa-card-symdef.h \
-		modules/coreaudio/module-coreaudio-detect-symdef.h \
-		modules/coreaudio/module-coreaudio-device-symdef.h \
-		modules/module-solaris-symdef.h \
-		modules/module-waveout-symdef.h \
-		modules/module-detect-symdef.h \
-		modules/rtp/module-rtp-send-symdef.h \
-		modules/rtp/module-rtp-recv-symdef.h \
-		modules/jack/module-jackdbus-detect-symdef.h \
-		modules/jack/module-jack-sink-symdef.h \
-		modules/jack/module-jack-source-symdef.h \
-		modules/module-volume-restore-symdef.h \
-		modules/module-device-manager-symdef.h \
-		modules/module-device-restore-symdef.h \
-		modules/module-stream-restore-symdef.h \
-		modules/module-card-restore-symdef.h \
-		modules/module-default-device-restore-symdef.h \
-		modules/module-always-sink-symdef.h \
-		modules/module-rescue-streams-symdef.h \
-		modules/module-intended-roles-symdef.h \
-		modules/module-suspend-on-idle-symdef.h \
-		modules/echo-cancel/module-echo-cancel-symdef.h \
-		modules/module-hal-detect-symdef.h \
-		modules/module-udev-detect-symdef.h \
-		modules/bluetooth/module-bluetooth-proximity-symdef.h \
-		modules/bluetooth/module-bluetooth-discover-symdef.h \
-		modules/bluetooth/module-bluetooth-device-symdef.h \
-		modules/raop/module-raop-sink-symdef.h \
-		modules/raop/module-raop-discover-symdef.h \
-		modules/gconf/module-gconf-symdef.h \
-		modules/module-position-event-sounds-symdef.h \
-		modules/module-augment-properties-symdef.h \
-		modules/module-cork-music-on-phone-symdef.h \
-		modules/module-console-kit-symdef.h \
-		modules/dbus/module-dbus-protocol-symdef.h \
-		modules/module-loopback-symdef.h \
-		modules/module-virtual-sink-symdef.h \
-		modules/module-virtual-source-symdef.h
+		module-cli-symdef.h \
+		module-cli-protocol-tcp-symdef.h \
+		module-cli-protocol-unix-symdef.h \
+		module-pipe-sink-symdef.h \
+		module-pipe-source-symdef.h \
+		module-simple-protocol-tcp-symdef.h \
+		module-simple-protocol-unix-symdef.h \
+		module-esound-protocol-tcp-symdef.h \
+		module-esound-protocol-unix-symdef.h \
+		module-native-protocol-tcp-symdef.h \
+		module-native-protocol-unix-symdef.h \
+		module-native-protocol-fd-symdef.h \
+		module-sine-symdef.h \
+		module-combine-symdef.h \
+		module-remap-sink-symdef.h \
+		module-ladspa-sink-symdef.h \
+		module-equalizer-sink-symdef.h \
+		module-esound-compat-spawnfd-symdef.h \
+		module-esound-compat-spawnpid-symdef.h \
+		module-match-symdef.h \
+		module-tunnel-sink-symdef.h \
+		module-tunnel-source-symdef.h \
+		module-null-sink-symdef.h \
+		module-sine-source-symdef.h \
+		module-esound-sink-symdef.h \
+		module-zeroconf-publish-symdef.h \
+		module-zeroconf-discover-symdef.h \
+		module-bonjour-publish-symdef.h \
+		module-lirc-symdef.h \
+		module-mmkbd-evdev-symdef.h \
+		module-http-protocol-tcp-symdef.h \
+		module-http-protocol-unix-symdef.h \
+		module-rygel-media-server-symdef.h \
+		module-x11-bell-symdef.h \
+		module-x11-publish-symdef.h \
+		module-x11-xsmp-symdef.h \
+		module-x11-cork-request-symdef.h \
+		module-oss-symdef.h \
+		module-alsa-sink-symdef.h \
+		module-alsa-source-symdef.h \
+		module-alsa-card-symdef.h \
+		module-coreaudio-detect-symdef.h \
+		module-coreaudio-device-symdef.h \
+		module-solaris-symdef.h \
+		module-waveout-symdef.h \
+		module-detect-symdef.h \
+		module-rtp-send-symdef.h \
+		module-rtp-recv-symdef.h \
+		module-jackdbus-detect-symdef.h \
+		module-jack-sink-symdef.h \
+		module-jack-source-symdef.h \
+		module-volume-restore-symdef.h \
+		module-device-manager-symdef.h \
+		module-device-restore-symdef.h \
+		module-stream-restore-symdef.h \
+		module-card-restore-symdef.h \
+		module-default-device-restore-symdef.h \
+		module-always-sink-symdef.h \
+		module-rescue-streams-symdef.h \
+		module-intended-roles-symdef.h \
+		module-suspend-on-idle-symdef.h \
+		module-echo-cancel-symdef.h \
+		module-hal-detect-symdef.h \
+		module-udev-detect-symdef.h \
+		module-bluetooth-proximity-symdef.h \
+		module-bluetooth-discover-symdef.h \
+		module-bluetooth-device-symdef.h \
+		module-raop-sink-symdef.h \
+		module-raop-discover-symdef.h \
+		module-gconf-symdef.h \
+		module-position-event-sounds-symdef.h \
+		module-augment-properties-symdef.h \
+		module-cork-music-on-phone-symdef.h \
+		module-console-kit-symdef.h \
+		module-dbus-protocol-symdef.h \
+		module-loopback-symdef.h \
+		module-virtual-sink-symdef.h \
+		module-virtual-source-symdef.h
 
 EXTRA_DIST += $(SYMDEF_FILES)
-BUILT_SOURCES += $(SYMDEF_FILES)
+BUILT_SOURCES += $(SYMDEF_FILES) builddirs
 
 $(SYMDEF_FILES): modules/module-defs.h.m4
-	$(MKDIR_P) $(dir $@)
-	$(M4) -Dfname="$@" $< > $@
+	$(AM_V_at)$(MKDIR_P) modules
+	$(AM_V_GEN)$(M4) -Dfname="$@" $< > $@
+
+.PHONY: builddirs
+builddirs:
+	$(AM_V_at)$(MKDIR_P) daemon modules src/modules/echo-cancel
 
 # Simple protocol
 
@@ -1729,7 +1712,7 @@ module_echo_cancel_la_SOURCES = modules/echo-cancel/module-echo-cancel.c modules
 nodist_module_echo_cancel_la_SOURCES = $(ORC_NODIST_SOURCES)
 module_echo_cancel_la_LDFLAGS = $(MODULE_LDFLAGS)
 module_echo_cancel_la_LIBADD = $(MODULE_LIBADD) $(LIBSPEEX_LIBS) $(ORC_LIBS)
-module_echo_cancel_la_CFLAGS = $(AM_CFLAGS) $(LIBSPEEX_CFLAGS) $(ORC_CFLAGS)
+module_echo_cancel_la_CFLAGS = $(AM_CFLAGS) $(LIBSPEEX_CFLAGS) $(ORC_CFLAGS) -I$(top_builddir)/src/modules/echo-cancel
 
 # RTP modules
 module_rtp_send_la_SOURCES = modules/rtp/module-rtp-send.c
@@ -1834,6 +1817,7 @@ module_bluetooth_device_la_CFLAGS = $(AM_CFLAGS) $(DBUS_CFLAGS)
 module_raop_sink_la_SOURCES = modules/raop/module-raop-sink.c
 module_raop_sink_la_LDFLAGS = $(MODULE_LDFLAGS)
 module_raop_sink_la_LIBADD = $(MODULE_LIBADD) librtp.la libraop.la
+module_raop_sink_la_CFLAGS = $(AM_CFLAGS) -I$(top_srcdir)/src/modules/rtp
 
 module_raop_discover_la_SOURCES = modules/raop/module-raop-discover.c
 module_raop_discover_la_LDFLAGS = $(MODULE_LDFLAGS)

commit 974af435076ed451dfae65b191625dfc7f582c4c
Author: Maarten Bosmans <mkbosmans at gmail.com>
Date:   Wed Jan 19 13:35:38 2011 +0100

    build: Don't include empty Makefile.am in subdirs

diff --git a/configure.ac b/configure.ac
index 0cffdc1..08c947a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1489,25 +1489,6 @@ doxygen/Makefile
 doxygen/doxygen.conf
 src/pulse/version.h
 po/Makefile.in
-src/daemon/Makefile
-src/modules/Makefile
-src/modules/alsa/Makefile
-src/modules/alsa/mixer/Makefile
-src/modules/alsa/mixer/paths/Makefile
-src/modules/alsa/mixer/profile-sets/Makefile
-src/modules/bluetooth/Makefile
-src/modules/dbus/Makefile
-src/modules/gconf/Makefile
-src/modules/jack/Makefile
-src/modules/oss/Makefile
-src/modules/raop/Makefile
-src/modules/rtp/Makefile
-src/modules/x11/Makefile
-src/pulse/Makefile
-src/pulsecore/Makefile
-src/pulsecore/ffmpeg/Makefile
-src/tests/Makefile
-src/utils/Makefile
 ])
 
 AC_OUTPUT
diff --git a/src/Makefile.am b/src/Makefile.am
index ae9b149..83bc69a 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -19,8 +19,6 @@
 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
 # USA.
 
-SUBDIRS = pulsecore pulse daemon modules utils tests
-
 ###################################
 #       Extra directories         #
 ###################################
diff --git a/src/daemon/Makefile.am b/src/daemon/Makefile.am
deleted file mode 100644
index d04a413..0000000
--- a/src/daemon/Makefile.am
+++ /dev/null
@@ -1,20 +0,0 @@
-# This file is part of PulseAudio.
-#
-# Copyright 2010 Colin Guthrie
-#
-# PulseAudio is free software; you can redistribute it and/or modify
-# it under the terms of the GNU Lesser General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# PulseAudio is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public License
-# along with PulseAudio; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-# USA.
-
-# This Automake file is intentionally blank.
diff --git a/src/modules/Makefile.am b/src/modules/Makefile.am
deleted file mode 100644
index d8dc152..0000000
--- a/src/modules/Makefile.am
+++ /dev/null
@@ -1,20 +0,0 @@
-# This file is part of PulseAudio.
-#
-# Copyright 2010 Colin Guthrie
-#
-# PulseAudio is free software; you can redistribute it and/or modify
-# it under the terms of the GNU Lesser General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# PulseAudio is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public License
-# along with PulseAudio; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-# USA.
-
-SUBDIRS = alsa bluetooth dbus gconf jack oss raop rtp x11
diff --git a/src/modules/alsa/Makefile.am b/src/modules/alsa/Makefile.am
deleted file mode 100644
index 3d8bb5a..0000000
--- a/src/modules/alsa/Makefile.am
+++ /dev/null
@@ -1,20 +0,0 @@
-# This file is part of PulseAudio.
-#
-# Copyright 2010 Colin Guthrie
-#
-# PulseAudio is free software; you can redistribute it and/or modify
-# it under the terms of the GNU Lesser General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# PulseAudio is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public License
-# along with PulseAudio; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-# USA.
-
-SUBDIRS = mixer
diff --git a/src/modules/alsa/mixer/Makefile.am b/src/modules/alsa/mixer/Makefile.am
deleted file mode 100644
index ee2c6ef..0000000
--- a/src/modules/alsa/mixer/Makefile.am
+++ /dev/null
@@ -1,20 +0,0 @@
-# This file is part of PulseAudio.
-#
-# Copyright 2010 Colin Guthrie
-#
-# PulseAudio is free software; you can redistribute it and/or modify
-# it under the terms of the GNU Lesser General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# PulseAudio is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public License
-# along with PulseAudio; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-# USA.
-
-SUBDIRS = paths profile-sets
diff --git a/src/modules/alsa/mixer/paths/Makefile.am b/src/modules/alsa/mixer/paths/Makefile.am
deleted file mode 100644
index d04a413..0000000
--- a/src/modules/alsa/mixer/paths/Makefile.am
+++ /dev/null
@@ -1,20 +0,0 @@
-# This file is part of PulseAudio.
-#
-# Copyright 2010 Colin Guthrie
-#
-# PulseAudio is free software; you can redistribute it and/or modify
-# it under the terms of the GNU Lesser General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# PulseAudio is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public License
-# along with PulseAudio; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-# USA.
-
-# This Automake file is intentionally blank.
diff --git a/src/modules/alsa/mixer/profile-sets/Makefile.am b/src/modules/alsa/mixer/profile-sets/Makefile.am
deleted file mode 100644
index d04a413..0000000
--- a/src/modules/alsa/mixer/profile-sets/Makefile.am
+++ /dev/null
@@ -1,20 +0,0 @@
-# This file is part of PulseAudio.
-#
-# Copyright 2010 Colin Guthrie
-#
-# PulseAudio is free software; you can redistribute it and/or modify
-# it under the terms of the GNU Lesser General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# PulseAudio is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public License
-# along with PulseAudio; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-# USA.
-
-# This Automake file is intentionally blank.
diff --git a/src/modules/bluetooth/Makefile.am b/src/modules/bluetooth/Makefile.am
deleted file mode 100644
index d04a413..0000000
--- a/src/modules/bluetooth/Makefile.am
+++ /dev/null
@@ -1,20 +0,0 @@
-# This file is part of PulseAudio.
-#
-# Copyright 2010 Colin Guthrie
-#
-# PulseAudio is free software; you can redistribute it and/or modify
-# it under the terms of the GNU Lesser General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# PulseAudio is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public License
-# along with PulseAudio; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-# USA.
-
-# This Automake file is intentionally blank.
diff --git a/src/modules/dbus/Makefile.am b/src/modules/dbus/Makefile.am
deleted file mode 100644
index d04a413..0000000
--- a/src/modules/dbus/Makefile.am
+++ /dev/null
@@ -1,20 +0,0 @@
-# This file is part of PulseAudio.
-#
-# Copyright 2010 Colin Guthrie
-#
-# PulseAudio is free software; you can redistribute it and/or modify
-# it under the terms of the GNU Lesser General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# PulseAudio is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public License
-# along with PulseAudio; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-# USA.
-
-# This Automake file is intentionally blank.
diff --git a/src/modules/gconf/Makefile.am b/src/modules/gconf/Makefile.am
deleted file mode 100644
index d04a413..0000000
--- a/src/modules/gconf/Makefile.am
+++ /dev/null
@@ -1,20 +0,0 @@
-# This file is part of PulseAudio.
-#
-# Copyright 2010 Colin Guthrie
-#
-# PulseAudio is free software; you can redistribute it and/or modify
-# it under the terms of the GNU Lesser General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# PulseAudio is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public License
-# along with PulseAudio; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-# USA.
-
-# This Automake file is intentionally blank.
diff --git a/src/modules/jack/Makefile.am b/src/modules/jack/Makefile.am
deleted file mode 100644
index d04a413..0000000
--- a/src/modules/jack/Makefile.am
+++ /dev/null
@@ -1,20 +0,0 @@
-# This file is part of PulseAudio.
-#
-# Copyright 2010 Colin Guthrie
-#
-# PulseAudio is free software; you can redistribute it and/or modify
-# it under the terms of the GNU Lesser General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# PulseAudio is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public License
-# along with PulseAudio; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-# USA.
-
-# This Automake file is intentionally blank.
diff --git a/src/modules/oss/Makefile.am b/src/modules/oss/Makefile.am
deleted file mode 100644
index d04a413..0000000
--- a/src/modules/oss/Makefile.am
+++ /dev/null
@@ -1,20 +0,0 @@
-# This file is part of PulseAudio.
-#
-# Copyright 2010 Colin Guthrie
-#
-# PulseAudio is free software; you can redistribute it and/or modify
-# it under the terms of the GNU Lesser General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# PulseAudio is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public License
-# along with PulseAudio; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-# USA.
-
-# This Automake file is intentionally blank.
diff --git a/src/modules/raop/Makefile.am b/src/modules/raop/Makefile.am
deleted file mode 100644
index d04a413..0000000
--- a/src/modules/raop/Makefile.am
+++ /dev/null
@@ -1,20 +0,0 @@
-# This file is part of PulseAudio.
-#
-# Copyright 2010 Colin Guthrie
-#
-# PulseAudio is free software; you can redistribute it and/or modify
-# it under the terms of the GNU Lesser General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# PulseAudio is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public License
-# along with PulseAudio; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-# USA.
-
-# This Automake file is intentionally blank.
diff --git a/src/modules/rtp/Makefile.am b/src/modules/rtp/Makefile.am
deleted file mode 100644
index d04a413..0000000
--- a/src/modules/rtp/Makefile.am
+++ /dev/null
@@ -1,20 +0,0 @@
-# This file is part of PulseAudio.
-#
-# Copyright 2010 Colin Guthrie
-#
-# PulseAudio is free software; you can redistribute it and/or modify
-# it under the terms of the GNU Lesser General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# PulseAudio is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public License
-# along with PulseAudio; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-# USA.
-
-# This Automake file is intentionally blank.
diff --git a/src/modules/x11/Makefile.am b/src/modules/x11/Makefile.am
deleted file mode 100644
index d04a413..0000000
--- a/src/modules/x11/Makefile.am
+++ /dev/null
@@ -1,20 +0,0 @@
-# This file is part of PulseAudio.
-#
-# Copyright 2010 Colin Guthrie
-#
-# PulseAudio is free software; you can redistribute it and/or modify
-# it under the terms of the GNU Lesser General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# PulseAudio is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public License
-# along with PulseAudio; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-# USA.
-
-# This Automake file is intentionally blank.
diff --git a/src/pulse/Makefile.am b/src/pulse/Makefile.am
deleted file mode 100644
index d04a413..0000000
--- a/src/pulse/Makefile.am
+++ /dev/null
@@ -1,20 +0,0 @@
-# This file is part of PulseAudio.
-#
-# Copyright 2010 Colin Guthrie
-#
-# PulseAudio is free software; you can redistribute it and/or modify
-# it under the terms of the GNU Lesser General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# PulseAudio is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public License
-# along with PulseAudio; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-# USA.
-
-# This Automake file is intentionally blank.
diff --git a/src/pulsecore/Makefile.am b/src/pulsecore/Makefile.am
deleted file mode 100644
index 55c6845..0000000
--- a/src/pulsecore/Makefile.am
+++ /dev/null
@@ -1,20 +0,0 @@
-# This file is part of PulseAudio.
-#
-# Copyright 2010 Colin Guthrie
-#
-# PulseAudio is free software; you can redistribute it and/or modify
-# it under the terms of the GNU Lesser General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# PulseAudio is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public License
-# along with PulseAudio; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-# USA.
-
-SUBDIRS = ffmpeg
diff --git a/src/pulsecore/ffmpeg/Makefile.am b/src/pulsecore/ffmpeg/Makefile.am
deleted file mode 100644
index d04a413..0000000
--- a/src/pulsecore/ffmpeg/Makefile.am
+++ /dev/null
@@ -1,20 +0,0 @@
-# This file is part of PulseAudio.
-#
-# Copyright 2010 Colin Guthrie
-#
-# PulseAudio is free software; you can redistribute it and/or modify
-# it under the terms of the GNU Lesser General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# PulseAudio is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public License
-# along with PulseAudio; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-# USA.
-
-# This Automake file is intentionally blank.
diff --git a/src/tests/Makefile.am b/src/tests/Makefile.am
deleted file mode 100644
index d04a413..0000000
--- a/src/tests/Makefile.am
+++ /dev/null
@@ -1,20 +0,0 @@
-# This file is part of PulseAudio.
-#
-# Copyright 2010 Colin Guthrie
-#
-# PulseAudio is free software; you can redistribute it and/or modify
-# it under the terms of the GNU Lesser General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# PulseAudio is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public License
-# along with PulseAudio; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-# USA.
-
-# This Automake file is intentionally blank.
diff --git a/src/utils/Makefile.am b/src/utils/Makefile.am
deleted file mode 100644
index d04a413..0000000
--- a/src/utils/Makefile.am
+++ /dev/null
@@ -1,20 +0,0 @@
-# This file is part of PulseAudio.
-#
-# Copyright 2010 Colin Guthrie
-#
-# PulseAudio is free software; you can redistribute it and/or modify
-# it under the terms of the GNU Lesser General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# PulseAudio is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public License
-# along with PulseAudio; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-# USA.
-
-# This Automake file is intentionally blank.

commit d766b38e1ba5d483ad7eec105860e9b9f7f55702
Author: Maarten Bosmans <mkbosmans at gmail.com>
Date:   Tue Jan 25 11:57:30 2011 +0100

    build: Remove unnecessary flags in AM_CFLAGS
    
    The CFLAGS and LIBS of libsamplerate, libspeex and libsndfile are added to the pulse libraries depending on those libraries.
    
    Also src/pulse/version.h is generated by configure, so it does not need to go in BUILT_SOURCES.
    
    (Slightly tweaked by Colin Guthrie to fix a merge problem relating to BUILT_SOURCES)

diff --git a/src/Makefile.am b/src/Makefile.am
index 83bc69a..18199e4 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -52,9 +52,6 @@ AM_CFLAGS = \
 	-I$(top_srcdir)/src/modules \
 	-I$(top_builddir)/src/modules \
 	$(PTHREAD_CFLAGS) -D_POSIX_PTHREAD_SEMANTICS \
-	$(LIBSAMPLERATE_CFLAGS) \
-	$(LIBSNDFILE_CFLAGS) \
-	$(LIBSPEEX_CFLAGS) \
 	-DPA_BUILDDIR=\"$(abs_builddir)\" \
 	-DPA_DLSEARCHPATH=\"$(modlibexecdir)\" \
 	-DPA_DEFAULT_CONFIG_DIR=\"$(PA_DEFAULT_CONFIG_DIR)\" \
@@ -65,8 +62,8 @@ AM_CFLAGS = \
 	-DAO_REQUIRE_CAS \
 	-DPULSE_LOCALEDIR=\"$(pulselocaledir)\" \
 	-DPA_MACHINE_ID=\"$(localstatedir)/lib/dbus/machine-id\" \
-        -DPA_ALSA_PATHS_DIR=\"$(alsapathsdir)\" \
-        -DPA_ALSA_PROFILE_SETS_DIR=\"$(alsaprofilesetsdir)\"
+	-DPA_ALSA_PATHS_DIR=\"$(alsapathsdir)\" \
+	-DPA_ALSA_PROFILE_SETS_DIR=\"$(alsaprofilesetsdir)\"
 
 AM_LIBADD = $(PTHREAD_LIBS) $(INTLLIBS)
 AM_LDADD = $(PTHREAD_LIBS) $(INTLLIBS)
@@ -127,9 +124,6 @@ xdgautostart_DATA = $(xdgautostart_in_files:.desktop.in=.desktop)
 @INTLTOOL_DESKTOP_RULE@
 
 
-BUILT_SOURCES = \
-		pulse/version.h
-
 ###################################
 #          Main daemon            #
 ###################################
@@ -145,8 +139,8 @@ pulseaudio_SOURCES = \
 		daemon/ltdl-bind-now.c daemon/ltdl-bind-now.h \
 		daemon/main.c
 
-pulseaudio_CFLAGS = $(AM_CFLAGS) $(LIBSAMPLERATE_CFLAGS) $(LIBSPEEX_CFLAGS) $(LIBSNDFILE_CFLAGS) $(CAP_CFLAGS)
-pulseaudio_LDADD = $(AM_LDADD) libpulsecore- at PA_MAJORMINOR@.la libpulsecommon- at PA_MAJORMINOR@.la libpulse.la $(LIBLTDL) $(LIBSAMPLERATE_LIBS) $(LIBSPEEX_LIBS) $(LIBSNDFILE_LIBS) $(CAP_LIBS)
+pulseaudio_CFLAGS = $(AM_CFLAGS) $(CAP_CFLAGS)
+pulseaudio_LDADD = $(AM_LDADD) libpulsecore- at PA_MAJORMINOR@.la libpulsecommon- at PA_MAJORMINOR@.la libpulse.la $(LIBLTDL) $(CAP_LIBS)
 # This is needed because automake doesn't properly expand the foreach below
 pulseaudio_DEPENDENCIES = libpulsecore- at PA_MAJORMINOR@.la libpulsecommon- at PA_MAJORMINOR@.la libpulse.la $(PREOPEN_LIBS)
 
@@ -616,9 +610,9 @@ libpulsecommon_ at PA_MAJORMINOR@_la_SOURCES = \
 		pulsecore/sndfile-util.c pulsecore/sndfile-util.h \
 		pulsecore/winsock.h
 
-libpulsecommon_ at PA_MAJORMINOR@_la_CFLAGS = $(AM_CFLAGS)
+libpulsecommon_ at PA_MAJORMINOR@_la_CFLAGS = $(AM_CFLAGS) $(LIBSAMPLERATE_CFLAGS) $(LIBSNDFILE_CFLAGS)
 libpulsecommon_ at PA_MAJORMINOR@_la_LDFLAGS = $(AM_LDFLAGS) -avoid-version
-libpulsecommon_ at PA_MAJORMINOR@_la_LIBADD = $(AM_LIBADD) $(LIBWRAP_LIBS) $(WINSOCK_LIBS) $(LTLIBICONV) $(LIBSNDFILE_LIBS)
+libpulsecommon_ at PA_MAJORMINOR@_la_LIBADD = $(AM_LIBADD) $(LIBWRAP_LIBS) $(WINSOCK_LIBS) $(LTLIBICONV) $(LIBSAMPLERATE_LIBS) $(LIBSNDFILE_LIBS)
 
 if HAVE_X11
 libpulsecommon_ at PA_MAJORMINOR@_la_SOURCES += pulse/client-conf-x11.c pulse/client-conf-x11.h
@@ -854,9 +848,9 @@ libpulsecore_ at PA_MAJORMINOR@_la_SOURCES = \
 		pulsecore/time-smoother.c pulsecore/time-smoother.h \
 		pulsecore/database.h
 
-libpulsecore_ at PA_MAJORMINOR@_la_CFLAGS = $(AM_CFLAGS) $(LIBSAMPLERATE_CFLAGS) $(LIBSPEEX_CFLAGS) $(WINSOCK_CFLAGS)
+libpulsecore_ at PA_MAJORMINOR@_la_CFLAGS = $(AM_CFLAGS) $(LIBSAMPLERATE_CFLAGS) $(LIBSPEEX_CFLAGS) $(LIBSNDFILE_CFLAGS) $(WINSOCK_CFLAGS)
 libpulsecore_ at PA_MAJORMINOR@_la_LDFLAGS = -avoid-version
-libpulsecore_ at PA_MAJORMINOR@_la_LIBADD = $(AM_LIBADD) $(LIBLTDL) $(LIBSAMPLERATE_LIBS) $(LIBSPEEX_LIBS) $(WINSOCK_LIBS) $(LTLIBICONV) libpulsecommon- at PA_MAJORMINOR@.la libpulse.la libpulsecore-foreign.la
+libpulsecore_ at PA_MAJORMINOR@_la_LIBADD = $(AM_LIBADD) $(LIBLTDL) $(LIBSAMPLERATE_LIBS) $(LIBSPEEX_LIBS) $(LIBSNDFILE_LIBS) $(WINSOCK_LIBS) $(LTLIBICONV) libpulsecommon- at PA_MAJORMINOR@.la libpulse.la libpulsecore-foreign.la
 
 if HAVE_X11
 libpulsecore_ at PA_MAJORMINOR@_la_SOURCES += pulsecore/x11wrap.c pulsecore/x11wrap.h
@@ -1299,7 +1293,7 @@ SYMDEF_FILES = \
 		module-virtual-source-symdef.h
 
 EXTRA_DIST += $(SYMDEF_FILES)
-BUILT_SOURCES += $(SYMDEF_FILES) builddirs
+BUILT_SOURCES = $(SYMDEF_FILES) builddirs
 
 $(SYMDEF_FILES): modules/module-defs.h.m4
 	$(AM_V_at)$(MKDIR_P) modules

-- 
hooks/post-receive
PulseAudio Sound Server



More information about the pulseaudio-commits mailing list