[pulseaudio-commits] [SCM] PulseAudio Sound Server branch, master, updated. v0.9.19-535-gd18cae4

Colin Guthrie gitmailer-noreply at 0pointer.de
Thu Sep 2 08:40:28 PDT 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 master branch has been updated
      from  a543af539caa2e0214fe595addf75825806190aa (commit)

- Log -----------------------------------------------------------------
d18cae4 echo-cancel: keep frame_size a power of 2
1983337 echo-cancel: improve debug
c3cc461 echo-cancel: tweak the resync code a little
95bdf67 echo-cancel: use the phone media role
-----------------------------------------------------------------------

Summary of changes:
 src/modules/module-echo-cancel.c |   42 ++++++++++++++++++++++---------------
 1 files changed, 25 insertions(+), 17 deletions(-)

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

commit 95bdf675006dbd60eda7a88f17c5684c4f964f50
Author: Wim Taymans <wim.taymans at collabora.co.uk>
Date:   Tue Aug 24 11:22:20 2010 +0200

    echo-cancel: use the phone media role
    
    Tag the source and sink with the phone media roles so that they automatially
    connect to phone streams such as Empathy when using the intended-rols module.

diff --git a/src/modules/module-echo-cancel.c b/src/modules/module-echo-cancel.c
index a03481f..7213e36 100644
--- a/src/modules/module-echo-cancel.c
+++ b/src/modules/module-echo-cancel.c
@@ -1360,6 +1360,7 @@ int pa__init(pa_module*m) {
     pa_source_new_data_set_channel_map(&source_data, &map);
     pa_proplist_sets(source_data.proplist, PA_PROP_DEVICE_MASTER_DEVICE, source_master->name);
     pa_proplist_sets(source_data.proplist, PA_PROP_DEVICE_CLASS, "filter");
+    pa_proplist_sets(source_data.proplist, PA_PROP_DEVICE_INTENDED_ROLES, "phone");
     pa_proplist_sets(source_data.proplist, "device.echo-cancel.name", source_data.name);
 
     if (pa_modargs_get_proplist(ma, "source_properties", source_data.proplist, PA_UPDATE_REPLACE) < 0) {
@@ -1406,6 +1407,7 @@ int pa__init(pa_module*m) {
     pa_sink_new_data_set_channel_map(&sink_data, &map);
     pa_proplist_sets(sink_data.proplist, PA_PROP_DEVICE_MASTER_DEVICE, sink_master->name);
     pa_proplist_sets(sink_data.proplist, PA_PROP_DEVICE_CLASS, "filter");
+    pa_proplist_sets(sink_data.proplist, PA_PROP_DEVICE_INTENDED_ROLES, "phone");
     pa_proplist_sets(sink_data.proplist, "device.echo-cancel.name", sink_data.name);
 
     if (pa_modargs_get_proplist(ma, "sink_properties", sink_data.proplist, PA_UPDATE_REPLACE) < 0) {

commit c3cc461bf5b2f65f257c4017226c6693c1570885
Author: Wim Taymans <wim.taymans at collabora.co.uk>
Date:   Tue Aug 24 11:46:18 2010 +0200

    echo-cancel: tweak the resync code a little
    
    Try to keep the drift between source and sink within 4ms now that we have more
    accurate timings.
    Don't force a resync on latency changes but let the drift code handle it.

diff --git a/src/modules/module-echo-cancel.c b/src/modules/module-echo-cancel.c
index 7213e36..0abee55 100644
--- a/src/modules/module-echo-cancel.c
+++ b/src/modules/module-echo-cancel.c
@@ -276,7 +276,7 @@ static void time_callback(pa_mainloop_api *a, pa_time_event *e, const struct tim
         new_rate = base_rate;
     }
     else {
-        if (diff_time > (u->frame_size_ms / 2) * 1000) {
+        if (diff_time > 4000) {
             pa_log_info("playback too far ahead (%lld), realign", (long long) diff_time);
             /* diff too big, quickly adjust */
             pa_asyncmsgq_post(u->asyncmsgq, PA_MSGOBJECT(u->source_output), SOURCE_OUTPUT_MESSAGE_APPLY_DIFF_TIME,
@@ -627,9 +627,8 @@ static void source_output_push_cb(pa_source_output *o, const pa_memchunk *chunk)
         ;
     u->in_push = FALSE;
 
-    if (pa_atomic_load (&u->request_resync) == 1) {
+    if (pa_atomic_cmpxchg (&u->request_resync, 1, 0)) {
         do_resync (u);
-        pa_atomic_store (&u->request_resync, 0);
     }
 
     pa_memblockq_push_align(u->source_memblockq, chunk);
@@ -920,7 +919,6 @@ static void sink_input_update_sink_requested_latency_cb(pa_sink_input *i) {
     latency = pa_sink_get_requested_latency_within_thread(i->sink);
 
     pa_log_debug("Sink input update requested latency %lld", (long long) latency);
-    pa_atomic_store (&u->request_resync, 1);
 }
 
 /* Called from I/O thread context */
@@ -934,7 +932,6 @@ static void source_output_update_source_requested_latency_cb(pa_source_output *o
     latency = pa_source_get_requested_latency_within_thread(o->source);
 
     pa_log_debug("source output update requested latency %lld", (long long) latency);
-    pa_atomic_store (&u->request_resync, 1);
 }
 
 /* Called from I/O thread context */

commit 1983337f0ea7008903b2a1327d4d9ce9f7b69392
Author: Wim Taymans <wim.taymans at collabora.co.uk>
Date:   Tue Aug 24 13:29:18 2010 +0200

    echo-cancel: improve debug

diff --git a/src/modules/module-echo-cancel.c b/src/modules/module-echo-cancel.c
index 0abee55..4d44bf7 100644
--- a/src/modules/module-echo-cancel.c
+++ b/src/modules/module-echo-cancel.c
@@ -267,17 +267,15 @@ static void time_callback(pa_mainloop_api *a, pa_time_event *e, const struct tim
     base_rate = u->source_output->sample_spec.rate;
 
     if (diff_time < 0) {
-        pa_log_info("Playback after capture (%lld), realign", (long long) diff_time);
-        pa_asyncmsgq_post(u->asyncmsgq, PA_MSGOBJECT(u->source_output), SOURCE_OUTPUT_MESSAGE_APPLY_DIFF_TIME,
-            NULL, diff_time, NULL, NULL);
         /* recording before playback, we need to adjust quickly. The echo
          * canceler does not work in this case. */
+        pa_asyncmsgq_post(u->asyncmsgq, PA_MSGOBJECT(u->source_output), SOURCE_OUTPUT_MESSAGE_APPLY_DIFF_TIME,
+            NULL, diff_time, NULL, NULL);
         //new_rate = base_rate - ((pa_usec_to_bytes (-diff_time, &u->source_output->sample_spec) / fs) * PA_USEC_PER_SEC) / u->adjust_time;
         new_rate = base_rate;
     }
     else {
         if (diff_time > 4000) {
-            pa_log_info("playback too far ahead (%lld), realign", (long long) diff_time);
             /* diff too big, quickly adjust */
             pa_asyncmsgq_post(u->asyncmsgq, PA_MSGOBJECT(u->source_output), SOURCE_OUTPUT_MESSAGE_APPLY_DIFF_TIME,
                 NULL, diff_time, NULL, NULL);
@@ -575,17 +573,21 @@ static void apply_diff_time(struct userdata *u, int64_t diff_time) {
     if (diff_time < 0) {
         diff = pa_usec_to_bytes (-diff_time, &u->source_output->sample_spec);
 
-        pa_log_debug("drop sink (%lld)", (long long) diff);
+        if (diff > 0) {
+            pa_log_info("Playback after capture (%lld), drop sink %lld", (long long) diff_time, (long long) diff);
 
-        /* go forwards on the read side */
-        pa_memblockq_drop(u->sink_memblockq, diff);
-    } else {
+            /* go forwards on the read side */
+            pa_memblockq_drop(u->sink_memblockq, diff);
+        }
+    } else if (diff_time > 0) {
         diff = pa_usec_to_bytes (diff_time, &u->source_output->sample_spec);
 
-        pa_log_debug("drop source (%lld)", (long long) diff);
+        if (diff > 0) {
+            pa_log_info("playback too far ahead (%lld), drop source %lld", (long long) diff_time, (long long) diff);
 
-        /* go back on the read side */
-        pa_memblockq_rewind(u->sink_memblockq, diff);
+            /* go back on the read side */
+            pa_memblockq_rewind(u->sink_memblockq, diff);
+        }
     }
 }
 

commit d18cae458f0aabfeb4a36d82c60a00422fc98c69
Author: Wim Taymans <wim.taymans at collabora.co.uk>
Date:   Tue Aug 31 18:04:33 2010 +0200

    echo-cancel: keep frame_size a power of 2
    
    The speex echo canceler prefers a power of 2 for the frame size. Round down the
    ideal frame_size to the nearest power of two. This makes sure we don't create
    more than the requested frame_size_ms latency while still providing a power of 2
    to the speex echo canceller.

diff --git a/src/modules/module-echo-cancel.c b/src/modules/module-echo-cancel.c
index 4d44bf7..d6c2ca1 100644
--- a/src/modules/module-echo-cancel.c
+++ b/src/modules/module-echo-cancel.c
@@ -1269,7 +1269,7 @@ int pa__init(pa_module*m) {
     pa_source_new_data source_data;
     pa_sink_new_data sink_data;
     pa_memchunk silence;
-    int framelen, rate;
+    int framelen, rate, y;
     uint32_t frame_size_ms, filter_size_ms;
     uint32_t adjust_time_sec;
 
@@ -1323,6 +1323,13 @@ int pa__init(pa_module*m) {
     u->frame_size_ms = frame_size_ms;
     rate = ss.rate;
     framelen = (rate * frame_size_ms) / 1000;
+
+    /* framelen should be a power of 2, round down to nearest power of two */
+    y = 1 << ((8 * sizeof (int)) - 2);
+    while (y > framelen)
+      y >>= 1;
+    framelen = y;
+
     u->blocksize = framelen * pa_frame_size (&ss);
     pa_log_debug ("Using framelen %d, blocksize %lld, channels %d, rate %d", framelen, (long long) u->blocksize,
         ss.channels, ss.rate);

-- 
hooks/post-receive
PulseAudio Sound Server



More information about the pulseaudio-commits mailing list