[PATCHv2 3/3] echo-cancel: Warn on different sample rates for rec, play, out stream

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The current echo-cancel framework does not support different sample
rates for the rec, play and out stream as it is assumed that the blocks
passed to the EC implementation's run() cover equal time spans. However,
pa__init() does not check that. Fix this.
---
 src/modules/echo-cancel/module-echo-cancel.c |    8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/src/modules/echo-cancel/module-echo-cancel.c b/src/modules/echo-cancel/module-echo-cancel.c
index 6227a93..e8ee984 100644
--- a/src/modules/echo-cancel/module-echo-cancel.c
+++ b/src/modules/echo-cancel/module-echo-cancel.c
@@ -1749,12 +1749,20 @@ int pa__init(pa_module*m) {
     source_output_ss = source_ss;
     source_output_map = source_map;
 
+    if (sink_ss.rate != source_ss.rate) {
+        pa_log_info("Sample rates of play and out stream differ. Adjusting rate of play stream.");
+        sink_ss.rate = source_ss.rate;
+    }
+
     pa_assert(u->ec->init);
     if (!u->ec->init(u->core, u->ec, &source_output_ss, &source_output_map, &sink_ss, &sink_map, &source_ss, &source_map, &nframes, pa_modargs_get_value(ma, "aec_args", NULL))) {
         pa_log("Failed to init AEC engine");
         goto fail;
     }
 
+    assert(source_output_ss.rate == source_ss.rate);
+    assert(sink_ss.rate == source_ss.rate);
+
     u->source_output_blocksize = nframes * pa_frame_size(&source_output_ss);
     u->source_blocksize = nframes * pa_frame_size(&source_ss);
     u->sink_blocksize = nframes * pa_frame_size(&sink_ss);
-- 
1.7.9.5



[Index of Archives]     [Linux Audio Users]     [AMD Graphics]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux