OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CONTENT_RENDERER_MEDIA_MEDIA_STREAM_AUDIO_PROCESSOR_OPTIONS_H_ | 5 #ifndef CONTENT_RENDERER_MEDIA_MEDIA_STREAM_AUDIO_PROCESSOR_OPTIONS_H_ |
6 #define CONTENT_RENDERER_MEDIA_MEDIA_STREAM_AUDIO_PROCESSOR_OPTIONS_H_ | 6 #define CONTENT_RENDERER_MEDIA_MEDIA_STREAM_AUDIO_PROCESSOR_OPTIONS_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
| 9 #include <vector> |
9 | 10 |
10 #include "base/files/file.h" | 11 #include "base/files/file.h" |
11 #include "base/macros.h" | 12 #include "base/macros.h" |
12 #include "base/threading/thread_checker.h" | 13 #include "base/threading/thread_checker.h" |
13 #include "content/common/content_export.h" | 14 #include "content/common/content_export.h" |
14 #include "content/public/common/media_stream_request.h" | 15 #include "content/public/common/media_stream_request.h" |
| 16 #include "media/base/audio_point.h" |
15 #include "third_party/WebKit/public/platform/WebMediaConstraints.h" | 17 #include "third_party/WebKit/public/platform/WebMediaConstraints.h" |
16 #include "third_party/webrtc/api/mediastreaminterface.h" | 18 #include "third_party/webrtc/api/mediastreaminterface.h" |
17 #include "third_party/webrtc/media/base/mediachannel.h" | 19 #include "third_party/webrtc/media/base/mediachannel.h" |
18 #include "third_party/webrtc/modules/audio_processing/include/audio_processing.h
" | 20 #include "third_party/webrtc/modules/audio_processing/include/audio_processing.h
" |
19 | 21 |
20 namespace webrtc { | 22 namespace webrtc { |
21 | 23 |
22 class EchoCancellation; | 24 class EchoCancellation; |
23 class TypingDetection; | 25 class TypingDetection; |
24 | 26 |
25 } | 27 } |
26 | 28 |
27 namespace content { | 29 namespace content { |
28 | 30 |
29 using webrtc::AudioProcessing; | 31 using webrtc::AudioProcessing; |
30 | 32 |
31 // A helper class to parse audio constraints from a blink::WebMediaConstraints | 33 // A helper class to parse audio constraints from a blink::WebMediaConstraints |
32 // object. | 34 // object. |
| 35 // TODO(guidou): Remove this class. http://crbug.com/706408 |
33 class CONTENT_EXPORT MediaAudioConstraints { | 36 class CONTENT_EXPORT MediaAudioConstraints { |
34 public: | 37 public: |
35 // Constraint keys used by audio processing. | 38 // Constraint keys used by audio processing. |
36 static const char kEchoCancellation[]; | 39 static const char kEchoCancellation[]; |
37 static const char kGoogEchoCancellation[]; | 40 static const char kGoogEchoCancellation[]; |
38 static const char kGoogExperimentalEchoCancellation[]; | 41 static const char kGoogExperimentalEchoCancellation[]; |
39 static const char kGoogAutoGainControl[]; | 42 static const char kGoogAutoGainControl[]; |
40 static const char kGoogExperimentalAutoGainControl[]; | 43 static const char kGoogExperimentalAutoGainControl[]; |
41 static const char kGoogNoiseSuppression[]; | 44 static const char kGoogNoiseSuppression[]; |
42 static const char kGoogExperimentalNoiseSuppression[]; | 45 static const char kGoogExperimentalNoiseSuppression[]; |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 } | 90 } |
88 | 91 |
89 private: | 92 private: |
90 // Gets the default value of constraint named by |key| in |constraints|. | 93 // Gets the default value of constraint named by |key| in |constraints|. |
91 bool GetDefaultValueForConstraint(const std::string& key) const; | 94 bool GetDefaultValueForConstraint(const std::string& key) const; |
92 const blink::WebMediaConstraints constraints_; | 95 const blink::WebMediaConstraints constraints_; |
93 const int effects_; | 96 const int effects_; |
94 bool default_audio_processing_constraint_value_; | 97 bool default_audio_processing_constraint_value_; |
95 }; | 98 }; |
96 | 99 |
| 100 // Simple struct with audio-processing properties. Will substitute |
| 101 // MediaAudioConstraints once the old constraints-processing algorithm is |
| 102 // removed. http://crbug.com/706408 |
| 103 struct CONTENT_EXPORT AudioProcessingProperties { |
| 104 // Creates an AudioProcessingProperties object with fields initialized to |
| 105 // their default values. |
| 106 AudioProcessingProperties(); |
| 107 AudioProcessingProperties(const AudioProcessingProperties& other); |
| 108 AudioProcessingProperties& operator=(const AudioProcessingProperties& other); |
| 109 AudioProcessingProperties(AudioProcessingProperties&& other); |
| 110 AudioProcessingProperties& operator=(AudioProcessingProperties&& other); |
| 111 ~AudioProcessingProperties(); |
| 112 |
| 113 bool enable_sw_echo_cancellation = true; |
| 114 bool disable_hw_echo_cancellation = false; |
| 115 bool goog_audio_mirroring = false; |
| 116 bool goog_auto_gain_control = true; |
| 117 bool goog_experimental_echo_cancellation = |
| 118 #if defined(OS_ANDROID) |
| 119 false; |
| 120 #else |
| 121 true; |
| 122 #endif |
| 123 bool goog_typing_noise_detection = true; |
| 124 bool goog_noise_suppression = true; |
| 125 bool goog_experimental_noise_suppression = true; |
| 126 bool goog_beamforming = true; |
| 127 bool goog_highpass_filter = true; |
| 128 bool goog_experimental_auto_gain_control = true; |
| 129 std::vector<media::Point> goog_array_geometry; |
| 130 }; |
| 131 |
97 // A helper class to log echo information in general and Echo Cancellation | 132 // A helper class to log echo information in general and Echo Cancellation |
98 // quality in particular. | 133 // quality in particular. |
99 class CONTENT_EXPORT EchoInformation { | 134 class CONTENT_EXPORT EchoInformation { |
100 public: | 135 public: |
101 EchoInformation(); | 136 EchoInformation(); |
102 virtual ~EchoInformation(); | 137 virtual ~EchoInformation(); |
103 | 138 |
104 // Updates stats, and reports delay metrics as UMA stats every 5 seconds. | 139 // Updates stats, and reports delay metrics as UMA stats every 5 seconds. |
105 // Must be called every time AudioProcessing::ProcessStream() is called. | 140 // Must be called every time AudioProcessing::ProcessStream() is called. |
106 void UpdateAecStats(webrtc::EchoCancellation* echo_cancellation); | 141 void UpdateAecStats(webrtc::EchoCancellation* echo_cancellation); |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 | 197 |
163 // Returns the array geometry from the media constraints if existing and | 198 // Returns the array geometry from the media constraints if existing and |
164 // otherwise that provided by the input device. | 199 // otherwise that provided by the input device. |
165 CONTENT_EXPORT std::vector<webrtc::Point> GetArrayGeometryPreferringConstraints( | 200 CONTENT_EXPORT std::vector<webrtc::Point> GetArrayGeometryPreferringConstraints( |
166 const MediaAudioConstraints& audio_constraints, | 201 const MediaAudioConstraints& audio_constraints, |
167 const MediaStreamDevice::AudioDeviceParameters& input_params); | 202 const MediaStreamDevice::AudioDeviceParameters& input_params); |
168 | 203 |
169 } // namespace content | 204 } // namespace content |
170 | 205 |
171 #endif // CONTENT_RENDERER_MEDIA_MEDIA_STREAM_AUDIO_PROCESSOR_OPTIONS_H_ | 206 #endif // CONTENT_RENDERER_MEDIA_MEDIA_STREAM_AUDIO_PROCESSOR_OPTIONS_H_ |
OLD | NEW |