| 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 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 if ((GetConstraintValueAsString(constraints, kMediaStreamSource, | 107 if ((GetConstraintValueAsString(constraints, kMediaStreamSource, |
| 108 &value_str)) || | 108 &value_str)) || |
| 109 (GetConstraintValueAsBoolean(constraints_, kEchoCancellation, | 109 (GetConstraintValueAsBoolean(constraints_, kEchoCancellation, |
| 110 &value_bool) && !value_bool)) { | 110 &value_bool) && !value_bool)) { |
| 111 default_audio_processing_constraint_value_ = false; | 111 default_audio_processing_constraint_value_ = false; |
| 112 } | 112 } |
| 113 } | 113 } |
| 114 | 114 |
| 115 MediaAudioConstraints::~MediaAudioConstraints() {} | 115 MediaAudioConstraints::~MediaAudioConstraints() {} |
| 116 | 116 |
| 117 // TODO(xians): Remove this method after the APM in WebRtc is deprecated. | |
| 118 bool MediaAudioConstraints::NeedsAudioProcessing() { | |
| 119 if (GetEchoCancellationProperty()) | |
| 120 return true; | |
| 121 | |
| 122 for (size_t i = 0; i < arraysize(kDefaultAudioConstraints); ++i) { | |
| 123 // |kEchoCancellation| and |kGoogEchoCancellation| have been convered by | |
| 124 // GetEchoCancellationProperty(). | |
| 125 if (kDefaultAudioConstraints[i].key != kEchoCancellation && | |
| 126 kDefaultAudioConstraints[i].key != kGoogEchoCancellation && | |
| 127 IsAudioProcessingConstraint(kDefaultAudioConstraints[i].key) && | |
| 128 GetProperty(kDefaultAudioConstraints[i].key)) { | |
| 129 return true; | |
| 130 } | |
| 131 } | |
| 132 | |
| 133 return false; | |
| 134 } | |
| 135 | |
| 136 bool MediaAudioConstraints::GetProperty(const std::string& key) { | 117 bool MediaAudioConstraints::GetProperty(const std::string& key) { |
| 137 // Return the value if the constraint is specified in |constraints|, | 118 // Return the value if the constraint is specified in |constraints|, |
| 138 // otherwise return the default value. | 119 // otherwise return the default value. |
| 139 bool value = false; | 120 bool value = false; |
| 140 if (!GetConstraintValueAsBoolean(constraints_, key, &value)) | 121 if (!GetConstraintValueAsBoolean(constraints_, key, &value)) |
| 141 value = GetDefaultValueForConstraint(constraints_, key); | 122 value = GetDefaultValueForConstraint(constraints_, key); |
| 142 | 123 |
| 143 return value; | 124 return value; |
| 144 } | 125 } |
| 145 | 126 |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 306 } | 287 } |
| 307 | 288 |
| 308 int median = 0, std = 0; | 289 int median = 0, std = 0; |
| 309 if (!audio_processing->echo_cancellation()->GetDelayMetrics(&median, &std)) { | 290 if (!audio_processing->echo_cancellation()->GetDelayMetrics(&median, &std)) { |
| 310 stats->echo_delay_median_ms = median; | 291 stats->echo_delay_median_ms = median; |
| 311 stats->echo_delay_std_ms = std; | 292 stats->echo_delay_std_ms = std; |
| 312 } | 293 } |
| 313 } | 294 } |
| 314 | 295 |
| 315 } // namespace content | 296 } // namespace content |
| OLD | NEW |