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 #include "content/renderer/media/media_stream_audio_processor_options.h" | 5 #include "content/renderer/media/media_stream_audio_processor_options.h" |
6 | 6 |
7 #include "base/files/file_path.h" | 7 #include "base/files/file_path.h" |
8 #include "base/files/file_util.h" | 8 #include "base/files/file_util.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/metrics/field_trial.h" | 10 #include "base/metrics/field_trial.h" |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 if ((GetConstraintValueAsString(constraints, kMediaStreamSource, | 133 if ((GetConstraintValueAsString(constraints, kMediaStreamSource, |
134 &value_str)) || | 134 &value_str)) || |
135 (GetConstraintValueAsBoolean(constraints_, kEchoCancellation, | 135 (GetConstraintValueAsBoolean(constraints_, kEchoCancellation, |
136 &value_bool) && !value_bool)) { | 136 &value_bool) && !value_bool)) { |
137 default_audio_processing_constraint_value_ = false; | 137 default_audio_processing_constraint_value_ = false; |
138 } | 138 } |
139 } | 139 } |
140 | 140 |
141 MediaAudioConstraints::~MediaAudioConstraints() {} | 141 MediaAudioConstraints::~MediaAudioConstraints() {} |
142 | 142 |
143 // TODO(xians): Remove this method after the APM in WebRtc is deprecated. | |
144 bool MediaAudioConstraints::NeedsAudioProcessing() { | |
145 if (GetEchoCancellationProperty()) | |
146 return true; | |
147 | |
148 for (size_t i = 0; i < arraysize(kDefaultAudioConstraints); ++i) { | |
149 // |kEchoCancellation| and |kGoogEchoCancellation| have been convered by | |
150 // GetEchoCancellationProperty(). | |
151 if (kDefaultAudioConstraints[i].key != kEchoCancellation && | |
152 kDefaultAudioConstraints[i].key != kGoogEchoCancellation && | |
153 IsAudioProcessingConstraint(kDefaultAudioConstraints[i].key) && | |
154 GetProperty(kDefaultAudioConstraints[i].key)) { | |
155 return true; | |
156 } | |
157 } | |
158 | |
159 return false; | |
160 } | |
161 | |
162 bool MediaAudioConstraints::GetProperty(const std::string& key) { | 143 bool MediaAudioConstraints::GetProperty(const std::string& key) { |
163 // Return the value if the constraint is specified in |constraints|, | 144 // Return the value if the constraint is specified in |constraints|, |
164 // otherwise return the default value. | 145 // otherwise return the default value. |
165 bool value = false; | 146 bool value = false; |
166 if (!GetConstraintValueAsBoolean(constraints_, key, &value)) | 147 if (!GetConstraintValueAsBoolean(constraints_, key, &value)) |
167 value = GetDefaultValueForConstraint(constraints_, key); | 148 value = GetDefaultValueForConstraint(constraints_, key); |
168 | 149 |
169 return value; | 150 return value; |
170 } | 151 } |
171 | 152 |
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
386 } | 367 } |
387 | 368 |
388 int median = 0, std = 0; | 369 int median = 0, std = 0; |
389 if (!audio_processing->echo_cancellation()->GetDelayMetrics(&median, &std)) { | 370 if (!audio_processing->echo_cancellation()->GetDelayMetrics(&median, &std)) { |
390 stats->echo_delay_median_ms = median; | 371 stats->echo_delay_median_ms = median; |
391 stats->echo_delay_std_ms = std; | 372 stats->echo_delay_std_ms = std; |
392 } | 373 } |
393 } | 374 } |
394 | 375 |
395 } // namespace content | 376 } // namespace content |
OLD | NEW |