[webrtc-apm] webrtc_apm.h/.cc header and format fixed

Format issues found by using `repo upload`, whose presubmit checks fail.

BUG=chromium:1318461
TEST=no

Change-Id: If85fb8b060719f5f0261dc2cba222ab6e31c9987
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/webrtc-apm/+/3608069
Reviewed-by: Hsinyu Chao <hychao@chromium.org>
Commit-Queue: Hsinyu Chao <hychao@chromium.org>
Tested-by: Hsinyu Chao <hychao@chromium.org>
diff --git a/webrtc_apm.cc b/webrtc_apm.cc
index 369d6d6..500dd13 100644
--- a/webrtc_apm.cc
+++ b/webrtc_apm.cc
@@ -1,4 +1,4 @@
-/* Copyright (c) 2018 The Chromium Authors. All rights reserved.
+/* Copyright 2018 The Chromium OS Authors. All rights reserved.
  * Use of this source code is governed by a BSD-style license that can be
  * found in the LICENSE file.
  */
@@ -25,243 +25,208 @@
 static std::string hist_name_prefix_;
 static std::unique_ptr<MetricsLibraryInterface> metrics_lib_;
 
-void webrtc_apm_init_metrics(const char *prefix)
-{
-	if (prefix == NULL)
-		return;
+void webrtc_apm_init_metrics(const char *prefix) {
+  if (prefix == NULL) return;
 
-	webrtc::metrics::Enable();
-	hist_name_prefix_ = prefix;
-	metrics_lib_ = std::make_unique<MetricsLibrary>();
+  webrtc::metrics::Enable();
+  hist_name_prefix_ = prefix;
+  metrics_lib_ = std::make_unique<MetricsLibrary>();
 }
 
-webrtc_apm webrtc_apm_create(
-		unsigned int num_channels,
-		unsigned int frame_rate,
-		dictionary *aec_ini,
-		dictionary *apm_ini) {
-
+webrtc_apm webrtc_apm_create(unsigned int num_channels, unsigned int frame_rate,
+                             dictionary *aec_ini, dictionary *apm_ini) {
   return webrtc_apm_create_with_enforced_effects(num_channels, frame_rate,
-		aec_ini,apm_ini,0,0,0);
+                                                 aec_ini, apm_ini, 0, 0, 0);
 }
 
 webrtc_apm webrtc_apm_create_with_enforced_effects(
-		unsigned int num_channels,
-		unsigned int frame_rate,
-		dictionary *aec_ini,
-		dictionary *apm_ini,
-		unsigned int enforce_aec_on,
-		unsigned int enforce_ns_on,
-		unsigned int enforce_agc_on)
-{
-	int err;
-	rtc::scoped_refptr<webrtc::AudioProcessing>* apm_refptr;
-	webrtc::AudioProcessing *apm;
-	webrtc::AudioProcessing::ChannelLayout channel_layout;
-	webrtc::AudioProcessingBuilder apm_builder;
-	webrtc::EchoCanceller3Config aec3_config;
+    unsigned int num_channels, unsigned int frame_rate, dictionary *aec_ini,
+    dictionary *apm_ini, unsigned int enforce_aec_on,
+    unsigned int enforce_ns_on, unsigned int enforce_agc_on) {
+  int err;
+  rtc::scoped_refptr<webrtc::AudioProcessing> *apm_refptr;
+  webrtc::AudioProcessing *apm;
+  webrtc::AudioProcessing::ChannelLayout channel_layout;
+  webrtc::AudioProcessingBuilder apm_builder;
+  webrtc::EchoCanceller3Config aec3_config;
 
-	switch (num_channels) {
-		case 1:
-			channel_layout = webrtc::AudioProcessing::kMono;
-			break;
-		case 2:
-			channel_layout = webrtc::AudioProcessing::kStereo;
-			break;
-		default:
-			return NULL;
-	}
+  switch (num_channels) {
+    case 1:
+      channel_layout = webrtc::AudioProcessing::kMono;
+      break;
+    case 2:
+      channel_layout = webrtc::AudioProcessing::kStereo;
+      break;
+    default:
+      return NULL;
+  }
 
-	/* Set the AEC-tunings. */
-	if (aec_ini) {
-		aec_config_get(aec_ini, &aec3_config);
-                std::unique_ptr<webrtc::EchoControlFactory> ec3_factory;
-		ec3_factory.reset(
-			new webrtc::EchoCanceller3Factory(aec3_config));
-		apm_builder.SetEchoControlFactory(std::move(ec3_factory));
-	}
+  /* Set the AEC-tunings. */
+  if (aec_ini) {
+    aec_config_get(aec_ini, &aec3_config);
+    std::unique_ptr<webrtc::EchoControlFactory> ec3_factory;
+    ec3_factory.reset(new webrtc::EchoCanceller3Factory(aec3_config));
+    apm_builder.SetEchoControlFactory(std::move(ec3_factory));
+  }
 
-	apm_refptr = new rtc::scoped_refptr<webrtc::AudioProcessing>();
-	*apm_refptr = apm_builder.Create();
-	apm = apm_refptr->get();
+  apm_refptr = new rtc::scoped_refptr<webrtc::AudioProcessing>();
+  *apm_refptr = apm_builder.Create();
+  apm = apm_refptr->get();
 
-	/* Set the rest of the all settings/tunings. */
-	webrtc::AudioProcessing::Config config = apm->GetConfig();
-	bool config_changed = false;
-	if (aec_ini || enforce_aec_on == 1) {
-		config.echo_canceller.enabled = true;
-		/* Activate playout stereo processing by default. This can be
-		 * turned off in |apm_ini|.
-		 */
-		if (enforce_aec_on) {
-			config.pipeline.multi_channel_render = true;
-		}
-		config_changed = true;
-	}
+  /* Set the rest of the all settings/tunings. */
+  webrtc::AudioProcessing::Config config = apm->GetConfig();
+  bool config_changed = false;
+  if (aec_ini || enforce_aec_on == 1) {
+    config.echo_canceller.enabled = true;
+    /* Activate playout stereo processing by default. This can be
+     * turned off in |apm_ini|.
+     */
+    if (enforce_aec_on) {
+      config.pipeline.multi_channel_render = true;
+    }
+    config_changed = true;
+  }
 
-	if (apm_ini) {
-		apm_config_set(apm_ini, &config);
-		config_changed = true;
-	}
+  if (apm_ini) {
+    apm_config_set(apm_ini, &config);
+    config_changed = true;
+  }
 
-	if (enforce_ns_on == 1) {
-		config.noise_suppression.enabled = true;
-		config_changed = true;
-	}
+  if (enforce_ns_on == 1) {
+    config.noise_suppression.enabled = true;
+    config_changed = true;
+  }
 
-	if (enforce_agc_on == 1) {
-		config.gain_controller1.enabled = true;
-		config.gain_controller1.mode =
-			webrtc::AudioProcessing::Config::GainController1::Mode::kAdaptiveAnalog;
-		config.capture_level_adjustment.enabled = true;
-		config.capture_level_adjustment.analog_mic_gain_emulation.enabled = true;
-		config_changed = true;
-	}
+  if (enforce_agc_on == 1) {
+    config.gain_controller1.enabled = true;
+    config.gain_controller1.mode =
+        webrtc::AudioProcessing::Config::GainController1::Mode::kAdaptiveAnalog;
+    config.capture_level_adjustment.enabled = true;
+    config.capture_level_adjustment.analog_mic_gain_emulation.enabled = true;
+    config_changed = true;
+  }
 
-	if (config_changed) {
-		apm->ApplyConfig(config);
-	}
+  if (config_changed) {
+    apm->ApplyConfig(config);
+  }
 
-	err = apm->Initialize(frame_rate, frame_rate, frame_rate,
-			      channel_layout, webrtc::AudioProcessing::kMono,
-			      channel_layout);
-	if (err) {
-		delete apm;
-		return NULL;
-	}
+  err = apm->Initialize(frame_rate, frame_rate, frame_rate, channel_layout,
+                        webrtc::AudioProcessing::kMono, channel_layout);
+  if (err) {
+    delete apm;
+    return NULL;
+  }
 
-	return reinterpret_cast<webrtc_apm>(apm_refptr);
+  return reinterpret_cast<webrtc_apm>(apm_refptr);
 }
 
-WEBRTC_APM_API void webrtc_apm_enable_effects(
-		webrtc_apm ptr,
-		bool enable_aec,
-		bool enable_ns,
-		bool enable_agc)
-{
+WEBRTC_APM_API void webrtc_apm_enable_effects(webrtc_apm ptr, bool enable_aec,
+                                              bool enable_ns, bool enable_agc) {
+  rtc::scoped_refptr<webrtc::AudioProcessing> *apm_refptr =
+      reinterpret_cast<rtc::scoped_refptr<webrtc::AudioProcessing> *>(ptr);
+  webrtc::AudioProcessing *apm = apm_refptr->get();
+  webrtc::AudioProcessing::Config config = apm->GetConfig();
+  bool config_changed = false;
 
-	rtc::scoped_refptr<webrtc::AudioProcessing>* apm_refptr =
-		reinterpret_cast<rtc::scoped_refptr<webrtc::AudioProcessing>*>(ptr);
-	webrtc::AudioProcessing *apm = apm_refptr->get();
-	webrtc::AudioProcessing::Config config = apm->GetConfig();
-	bool config_changed = false;
+  config_changed = config.echo_canceller.enabled != enable_aec;
+  config.echo_canceller.enabled = enable_aec;
 
-	config_changed = config.echo_canceller.enabled != enable_aec;
-	config.echo_canceller.enabled = enable_aec;
+  config_changed =
+      config_changed || config.noise_suppression.enabled != enable_ns;
+  config.noise_suppression.enabled = enable_ns;
 
-	config_changed = config_changed ||
-			config.noise_suppression.enabled != enable_ns;
-	config.noise_suppression.enabled = enable_ns;
+  config_changed =
+      config_changed || config.gain_controller1.enabled != enable_agc;
+  config.gain_controller1.enabled = enable_agc;
 
-	config_changed = config_changed ||
-			config.gain_controller1.enabled != enable_agc;
-	config.gain_controller1.enabled = enable_agc;
-
-	if (config_changed) {
-		apm->ApplyConfig(config);
-	}
+  if (config_changed) {
+    apm->ApplyConfig(config);
+  }
 }
 
-void webrtc_apm_dump_configs(dictionary *apm_ini,
-			     dictionary *aec_ini)
-{
-	if (apm_ini)
-		apm_config_dump(apm_ini);
-	if (aec_ini)
-		aec_config_dump(aec_ini);
+void webrtc_apm_dump_configs(dictionary *apm_ini, dictionary *aec_ini) {
+  if (apm_ini) apm_config_dump(apm_ini);
+  if (aec_ini) aec_config_dump(aec_ini);
 }
 
-int webrtc_apm_process_reverse_stream_f(
-		webrtc_apm ptr,
-		int num_channels, int rate,
-		float *const *data)
-{
-	webrtc::StreamConfig config =
-		webrtc::StreamConfig(rate, num_channels);
-	rtc::scoped_refptr<webrtc::AudioProcessing>* apm_refptr =
-		reinterpret_cast<rtc::scoped_refptr<webrtc::AudioProcessing>*>(ptr);
-        webrtc::AudioProcessing *apm = apm_refptr->get();
+int webrtc_apm_process_reverse_stream_f(webrtc_apm ptr, int num_channels,
+                                        int rate, float *const *data) {
+  webrtc::StreamConfig config = webrtc::StreamConfig(rate, num_channels);
+  rtc::scoped_refptr<webrtc::AudioProcessing> *apm_refptr =
+      reinterpret_cast<rtc::scoped_refptr<webrtc::AudioProcessing> *>(ptr);
+  webrtc::AudioProcessing *apm = apm_refptr->get();
 
-	return apm->ProcessReverseStream(data, config, config, data);
+  return apm->ProcessReverseStream(data, config, config, data);
 }
 
-int webrtc_apm_process_stream_f(webrtc_apm ptr,
-				int num_channels,
-				int rate,
-				float *const *data)
-{
-	webrtc::StreamConfig iconfig =
-		webrtc::StreamConfig(rate, num_channels);
-	webrtc::StreamConfig oconfig =
-		webrtc::StreamConfig(rate, 1);
-	rtc::scoped_refptr<webrtc::AudioProcessing>* apm_refptr =
-            reinterpret_cast<rtc::scoped_refptr<webrtc::AudioProcessing>*>(ptr);
-	webrtc::AudioProcessing *apm = apm_refptr->get();
-	return apm->ProcessStream(data, iconfig, oconfig, data);
+int webrtc_apm_process_stream_f(webrtc_apm ptr, int num_channels, int rate,
+                                float *const *data) {
+  webrtc::StreamConfig iconfig = webrtc::StreamConfig(rate, num_channels);
+  webrtc::StreamConfig oconfig = webrtc::StreamConfig(rate, 1);
+  rtc::scoped_refptr<webrtc::AudioProcessing> *apm_refptr =
+      reinterpret_cast<rtc::scoped_refptr<webrtc::AudioProcessing> *>(ptr);
+  webrtc::AudioProcessing *apm = apm_refptr->get();
+  return apm->ProcessStream(data, iconfig, oconfig, data);
 }
 
-void webrtc_apm_destroy(webrtc_apm ptr)
-{
-	rtc::scoped_refptr<webrtc::AudioProcessing>* apm_refptr =
-		reinterpret_cast<rtc::scoped_refptr<webrtc::AudioProcessing>*>(ptr);
-	*apm_refptr = nullptr;
-	delete apm_refptr;
+void webrtc_apm_destroy(webrtc_apm ptr) {
+  rtc::scoped_refptr<webrtc::AudioProcessing> *apm_refptr =
+      reinterpret_cast<rtc::scoped_refptr<webrtc::AudioProcessing> *>(ptr);
+  *apm_refptr = nullptr;
+  delete apm_refptr;
 
-	std::map<std::string, std::unique_ptr<SampleInfo>> hist;
+  std::map<std::string, std::unique_ptr<SampleInfo>> hist;
 
-	if (!metrics_lib_)
-		return;
+  if (!metrics_lib_) return;
 
-	webrtc::metrics::GetAndReset(&hist);
+  webrtc::metrics::GetAndReset(&hist);
 
-	for (auto it = hist.begin(); it != hist.end(); it++) {
-		SampleInfo *info = it->second.get();
-		std::string name = info->name;
-		name.insert(0, hist_name_prefix_);
-		/* info->samples stores <value, # of events> */
-		for (auto sample = info->samples.begin();
-		     sample != info->samples.end(); sample++) {
-			for (int i = 0; i < sample->second; i++)
-				metrics_lib_->SendToUMA(name, sample->first,
-							info->min, info->max,
-							info->bucket_count);
-		}
-	}
+  for (auto it = hist.begin(); it != hist.end(); it++) {
+    SampleInfo *info = it->second.get();
+    std::string name = info->name;
+    name.insert(0, hist_name_prefix_);
+    /* info->samples stores <value, # of events> */
+    for (auto sample = info->samples.begin(); sample != info->samples.end();
+         sample++) {
+      for (int i = 0; i < sample->second; i++)
+        metrics_lib_->SendToUMA(name, sample->first, info->min, info->max,
+                                info->bucket_count);
+    }
+  }
 }
 
-int webrtc_apm_set_stream_delay(webrtc_apm ptr, int delay_ms)
-{
-	rtc::scoped_refptr<webrtc::AudioProcessing>* apm_refptr =
-		reinterpret_cast<rtc::scoped_refptr<webrtc::AudioProcessing>*>(ptr);
-	webrtc::AudioProcessing *apm = apm_refptr->get();
+int webrtc_apm_set_stream_delay(webrtc_apm ptr, int delay_ms) {
+  rtc::scoped_refptr<webrtc::AudioProcessing> *apm_refptr =
+      reinterpret_cast<rtc::scoped_refptr<webrtc::AudioProcessing> *>(ptr);
+  webrtc::AudioProcessing *apm = apm_refptr->get();
 
-	return apm->set_stream_delay_ms(delay_ms);
+  return apm->set_stream_delay_ms(delay_ms);
 }
 
-int webrtc_apm_aec_dump(webrtc_apm ptr, void** wq_ptr, int start, FILE *handle)
-{
-	rtc::scoped_refptr<webrtc::AudioProcessing>* apm_refptr =
-		reinterpret_cast<rtc::scoped_refptr<webrtc::AudioProcessing>*>(ptr);
-	webrtc::AudioProcessing *apm = apm_refptr->get();
-	rtc::TaskQueue *work_queue;
+int webrtc_apm_aec_dump(webrtc_apm ptr, void **wq_ptr, int start,
+                        FILE *handle) {
+  rtc::scoped_refptr<webrtc::AudioProcessing> *apm_refptr =
+      reinterpret_cast<rtc::scoped_refptr<webrtc::AudioProcessing> *>(ptr);
+  webrtc::AudioProcessing *apm = apm_refptr->get();
+  rtc::TaskQueue *work_queue;
 
-	if (start) {
-		work_queue = new rtc::TaskQueue(webrtc::CreateDefaultTaskQueueFactory()->CreateTaskQueue("aecdump-worker-queue",
-						rtc::TaskQueue::Priority::LOW));
-		auto aec_dump = webrtc::AecDumpFactory::Create(handle, -1, work_queue);
-		if (!aec_dump)
-			return -ENOMEM;
-		apm->AttachAecDump(std::move(aec_dump));
-		*wq_ptr = reinterpret_cast<void *>(work_queue);
-	} else {
-		apm->DetachAecDump();
-		work_queue = reinterpret_cast<rtc::TaskQueue *>(*wq_ptr);
-		if (work_queue) {
-			delete work_queue;
-			work_queue = NULL;
-		}
-	}
-	return 0;
+  if (start) {
+    work_queue = new rtc::TaskQueue(
+        webrtc::CreateDefaultTaskQueueFactory()->CreateTaskQueue(
+            "aecdump-worker-queue", rtc::TaskQueue::Priority::LOW));
+    auto aec_dump = webrtc::AecDumpFactory::Create(handle, -1, work_queue);
+    if (!aec_dump) return -ENOMEM;
+    apm->AttachAecDump(std::move(aec_dump));
+    *wq_ptr = reinterpret_cast<void *>(work_queue);
+  } else {
+    apm->DetachAecDump();
+    work_queue = reinterpret_cast<rtc::TaskQueue *>(*wq_ptr);
+    if (work_queue) {
+      delete work_queue;
+      work_queue = NULL;
+    }
+  }
+  return 0;
 }
 
-} // extern "C"
+}  // extern "C"
diff --git a/webrtc_apm.h b/webrtc_apm.h
index c4a1256..131f78e 100644
--- a/webrtc_apm.h
+++ b/webrtc_apm.h
@@ -1,4 +1,4 @@
-/* Copyright (c) 2018 The Chromium Authors. All rights reserved.
+/* Copyright 2018 The Chromium OS Authors. All rights reserved.
  * Use of this source code is governed by a BSD-style license that can be
  * found in the LICENSE file.
  */
@@ -14,7 +14,7 @@
 #define WEBRTC_APM_API __attribute__((visibility("default")))
 
 /* Pointer to a webrtc::AudioProcessing instance. */
-typedef void* webrtc_apm;
+typedef void *webrtc_apm;
 
 /* Enables UMA metrics in webrtc APM.
  * Args:
@@ -38,13 +38,13 @@
  *                     regardless of settings in apm.ini
  */
 WEBRTC_APM_API webrtc_apm webrtc_apm_create_with_enforced_effects(
-		unsigned int num_channels,
-		unsigned int frame_rate,
-		dictionary *aec_ini,
-		dictionary *apm_ini,
-		unsigned int enforce_aec_on,
-		unsigned int enforce_ns_on,
-		unsigned int enforce_agc_on);
+    unsigned int num_channels,
+    unsigned int frame_rate,
+    dictionary *aec_ini,
+    dictionary *apm_ini,
+    unsigned int enforce_aec_on,
+    unsigned int enforce_ns_on,
+    unsigned int enforce_agc_on);
 
 /* Deprecated: Should be removed.
  * Creates a webrtc_apm for forward stream properties using the parameters in
@@ -55,11 +55,10 @@
  *    aec_config     - Pointer to aec config.
  *    apm_config     - Pointer to apm config.
  */
-WEBRTC_APM_API webrtc_apm webrtc_apm_create(
-		unsigned int num_channels,
-		unsigned int frame_rate,
-		dictionary *aec_ini,
-		dictionary *apm_ini);
+WEBRTC_APM_API webrtc_apm webrtc_apm_create(unsigned int num_channels,
+                                            unsigned int frame_rate,
+                                            dictionary *aec_ini,
+                                            dictionary *apm_ini);
 
 /* Enables/disables effects in a webrtc_apm.
  * This call is fully thread-safe and safe to use concurrently with
@@ -75,37 +74,35 @@
  *    enable_ns  - When set to 1, enables the NS.
  *    enable_agc - When set to 1, enables the AGC.
  */
-WEBRTC_APM_API void webrtc_apm_enable_effects(
-		webrtc_apm ptr,
-		bool enable_aec,
-		bool enable_ns,
-		bool enable_agc);
+WEBRTC_APM_API void webrtc_apm_enable_effects(webrtc_apm ptr,
+                                              bool enable_aec,
+                                              bool enable_ns,
+                                              bool enable_agc);
 
 /* Dumps configs content.
  * Args:
  *    apm_ini - APM config file in ini format.
  *    aec_ini - AEC3 config file in ini format.
  */
-WEBRTC_APM_API void webrtc_apm_dump_configs(
-		dictionary *apm_ini,
-		dictionary *aec_ini);
+WEBRTC_APM_API void webrtc_apm_dump_configs(dictionary *apm_ini,
+                                            dictionary *aec_ini);
 
 /* Destroys a webrtc_apm instance. */
 WEBRTC_APM_API void webrtc_apm_destroy(webrtc_apm apm);
 
 /* Processes deinterleaved float data in reverse stream. Expecting data
  * size be 10 ms equivalent of frames. */
-WEBRTC_APM_API int webrtc_apm_process_reverse_stream_f(
-		webrtc_apm ptr,
-		int num_channels, int rate,
-		float *const *data);
+WEBRTC_APM_API int webrtc_apm_process_reverse_stream_f(webrtc_apm ptr,
+                                                       int num_channels,
+                                                       int rate,
+                                                       float *const *data);
 
 /* Processes deinterleaved float data in forward stream. Expecting data
  * size be 10 ms equivalent of frames. */
 WEBRTC_APM_API int webrtc_apm_process_stream_f(webrtc_apm ptr,
-				int num_channels,
-				int rate,
-				float *const *data);
+                                               int num_channels,
+                                               int rate,
+                                               float *const *data);
 
 /* Sets the delay in ms between apm analyzes a frame in reverse stream
  * (playback) and this frame received as echo in forward stream (record)
@@ -124,8 +121,9 @@
  *    start - True to start dumping, false to stop.
  *    handle - Pointer of the file storing aec dump.
  */
-WEBRTC_APM_API int webrtc_apm_aec_dump(
-		webrtc_apm ptr, void** work_queue,
-		int start, FILE *handle);
+WEBRTC_APM_API int webrtc_apm_aec_dump(webrtc_apm ptr,
+                                       void **work_queue,
+                                       int start,
+                                       FILE *handle);
 
 #endif /* WEBRTC_APM_H_ */