]> code.delx.au - pulseaudio/blobdiff - src/modules/echo-cancel/webrtc.cc
Whitespace cleanup: Remove all multiple newlines
[pulseaudio] / src / modules / echo-cancel / webrtc.cc
index c4ec7da5fe234ee81444dcf5f75b836cd0bd7e89..697e0baeff156cdf2be0900312daed4136914249 100644 (file)
@@ -77,13 +77,13 @@ static int routing_mode_from_string(const char *rmode) {
 }
 
 pa_bool_t pa_webrtc_ec_init(pa_core *c, pa_echo_canceller *ec,
-                            pa_sample_spec *source_ss, pa_channel_map *source_map,
-                            pa_sample_spec *sink_ss, pa_channel_map *sink_map,
-                            uint32_t *blocksize, const char *args)
-{
+                            pa_sample_spec *rec_ss, pa_channel_map *rec_map,
+                            pa_sample_spec *play_ss, pa_channel_map *play_map,
+                            pa_sample_spec *out_ss, pa_channel_map *out_map,
+                            uint32_t *nframes, const char *args) {
     webrtc::AudioProcessing *apm = NULL;
     pa_bool_t hpf, ns, agc, dgc, mobile, cn;
-    int rm;
+    int rm = -1;
     pa_modargs *ma;
 
     if (!(ma = pa_modargs_new(args, valid_modargs))) {
@@ -91,7 +91,6 @@ pa_bool_t pa_webrtc_ec_init(pa_core *c, pa_echo_canceller *ec,
         goto fail;
     }
 
-
     hpf = DEFAULT_HIGH_PASS_FILTER;
     if (pa_modargs_get_value_boolean(ma, "high_pass_filter", &hpf) < 0) {
         pa_log("Failed to parse high_pass_filter value");
@@ -158,23 +157,25 @@ pa_bool_t pa_webrtc_ec_init(pa_core *c, pa_echo_canceller *ec,
 
     apm = webrtc::AudioProcessing::Create(0);
 
-    source_ss->format = PA_SAMPLE_S16NE;
-    *sink_ss = *source_ss;
+    out_ss->format = PA_SAMPLE_S16NE;
+    *play_ss = *out_ss;
     /* FIXME: the implementation actually allows a different number of
      * source/sink channels. Do we want to support that? */
-    *sink_map = *source_map;
+    *play_map = *out_map;
+    *rec_ss = *out_ss;
+    *rec_map = *out_map;
 
-    apm->set_sample_rate_hz(source_ss->rate);
+    apm->set_sample_rate_hz(out_ss->rate);
 
-    apm->set_num_channels(source_ss->channels, source_ss->channels);
-    apm->set_num_reverse_channels(sink_ss->channels);
+    apm->set_num_channels(out_ss->channels, out_ss->channels);
+    apm->set_num_reverse_channels(play_ss->channels);
 
     if (hpf)
         apm->high_pass_filter()->Enable(true);
 
     if (!mobile) {
         if (ec->params.drift_compensation) {
-            apm->echo_cancellation()->set_device_sample_rate_hz(source_ss->rate);
+            apm->echo_cancellation()->set_device_sample_rate_hz(out_ss->rate);
             apm->echo_cancellation()->enable_drift_compensation(true);
         } else {
             apm->echo_cancellation()->enable_drift_compensation(false);
@@ -215,8 +216,9 @@ pa_bool_t pa_webrtc_ec_init(pa_core *c, pa_echo_canceller *ec,
     apm->voice_detection()->Enable(true);
 
     ec->params.priv.webrtc.apm = apm;
-    ec->params.priv.webrtc.sample_spec = *source_ss;
-    ec->params.priv.webrtc.blocksize = *blocksize = (uint64_t)pa_bytes_per_second(source_ss) * BLOCK_SIZE_US / PA_USEC_PER_SEC;
+    ec->params.priv.webrtc.sample_spec = *out_ss;
+    ec->params.priv.webrtc.blocksize = (uint64_t)pa_bytes_per_second(out_ss) * BLOCK_SIZE_US / PA_USEC_PER_SEC;
+    *nframes = ec->params.priv.webrtc.blocksize / pa_frame_size(out_ss);
 
     pa_modargs_free(ma);
     return TRUE;