summaryrefslogtreecommitdiff
path: root/chromium/media/base/audio_processing.cc
blob: ce32fd2370c9a425c9856bbfd7f0d342ab9265f1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
// Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "media/base/audio_processing.h"

#include "base/strings/strcat.h"

namespace media {

std::string AudioProcessingSettings::ToString() const {
  auto agc_to_string = [](AutomaticGainControlType type) -> const char* {
    switch (type) {
      case AutomaticGainControlType::kDisabled:
        return "disabled";
      case AutomaticGainControlType::kDefault:
        return "default";
      case AutomaticGainControlType::kExperimental:
        return "experimental";
      case AutomaticGainControlType::kHybridExperimental:
        return "hybrid experimental";
    }
  };

  auto aec_to_string = [](EchoCancellationType type) -> const char* {
    switch (type) {
      case EchoCancellationType::kDisabled:
        return "disabled";
      case EchoCancellationType::kAec3:
        return "aec3";
      case EchoCancellationType::kSystemAec:
        return "system aec";
    }
  };

  auto ns_to_string = [](NoiseSuppressionType type) -> const char* {
    switch (type) {
      case NoiseSuppressionType::kDisabled:
        return "disabled";
      case NoiseSuppressionType::kDefault:
        return "default";
      case NoiseSuppressionType::kExperimental:
        return "experimental";
    }
  };

  auto bool_to_yes_no = [](bool b) -> const char* { return b ? "yes" : "no"; };

  return base::StrCat(
      {"agc: ", agc_to_string(automatic_gain_control),
       ", aec: ", aec_to_string(echo_cancellation),
       ", ns: ", ns_to_string(noise_suppression),
       ", high pass filter: ", bool_to_yes_no(high_pass_filter),
       ", typing detection: ", bool_to_yes_no(typing_detection),
       ", stereo mirroring: ", bool_to_yes_no(stereo_mirroring)});
}

}  // namespace media