| 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/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/path_service.h" | 9 #include "base/path_service.h" |
| 10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
| 11 #include "content/common/media/media_stream_options.h" |
| 11 #include "content/renderer/media/rtc_media_constraints.h" | 12 #include "content/renderer/media/rtc_media_constraints.h" |
| 12 #include "media/audio/audio_parameters.h" | 13 #include "media/audio/audio_parameters.h" |
| 13 #include "third_party/WebKit/public/platform/WebMediaConstraints.h" | 14 #include "third_party/WebKit/public/platform/WebMediaConstraints.h" |
| 14 #include "third_party/libjingle/source/talk/app/webrtc/mediaconstraintsinterface
.h" | 15 #include "third_party/libjingle/source/talk/app/webrtc/mediaconstraintsinterface
.h" |
| 15 #include "third_party/webrtc/modules/audio_processing/include/audio_processing.h
" | 16 #include "third_party/webrtc/modules/audio_processing/include/audio_processing.h
" |
| 16 | 17 |
| 17 namespace content { | 18 namespace content { |
| 18 | 19 |
| 19 namespace { | 20 namespace { |
| 20 | 21 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 34 { webrtc::MediaConstraintsInterface::kAutoGainControl, | 35 { webrtc::MediaConstraintsInterface::kAutoGainControl, |
| 35 webrtc::MediaConstraintsInterface::kValueTrue }, | 36 webrtc::MediaConstraintsInterface::kValueTrue }, |
| 36 { webrtc::MediaConstraintsInterface::kExperimentalAutoGainControl, | 37 { webrtc::MediaConstraintsInterface::kExperimentalAutoGainControl, |
| 37 webrtc::MediaConstraintsInterface::kValueTrue }, | 38 webrtc::MediaConstraintsInterface::kValueTrue }, |
| 38 { webrtc::MediaConstraintsInterface::kNoiseSuppression, | 39 { webrtc::MediaConstraintsInterface::kNoiseSuppression, |
| 39 webrtc::MediaConstraintsInterface::kValueTrue }, | 40 webrtc::MediaConstraintsInterface::kValueTrue }, |
| 40 { webrtc::MediaConstraintsInterface::kHighpassFilter, | 41 { webrtc::MediaConstraintsInterface::kHighpassFilter, |
| 41 webrtc::MediaConstraintsInterface::kValueTrue }, | 42 webrtc::MediaConstraintsInterface::kValueTrue }, |
| 42 { webrtc::MediaConstraintsInterface::kTypingNoiseDetection, | 43 { webrtc::MediaConstraintsInterface::kTypingNoiseDetection, |
| 43 webrtc::MediaConstraintsInterface::kValueTrue }, | 44 webrtc::MediaConstraintsInterface::kValueTrue }, |
| 45 #if defined(OS_WIN) |
| 46 { content::kMediaStreamAudioDucking, |
| 47 webrtc::MediaConstraintsInterface::kValueTrue }, |
| 48 #endif |
| 44 }; | 49 }; |
| 45 | 50 |
| 46 } // namespace | 51 } // namespace |
| 47 | 52 |
| 48 void ApplyFixedAudioConstraints(RTCMediaConstraints* constraints) { | 53 void ApplyFixedAudioConstraints(RTCMediaConstraints* constraints) { |
| 49 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(kDefaultAudioConstraints); ++i) { | 54 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(kDefaultAudioConstraints); ++i) { |
| 50 bool already_set_value; | 55 bool already_set_value; |
| 51 if (!webrtc::FindConstraint(constraints, kDefaultAudioConstraints[i].key, | 56 if (!webrtc::FindConstraint(constraints, kDefaultAudioConstraints[i].key, |
| 52 &already_set_value, NULL)) { | 57 &already_set_value, NULL)) { |
| 53 constraints->AddOptional(kDefaultAudioConstraints[i].key, | 58 constraints->AddOptional(kDefaultAudioConstraints[i].key, |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 const webrtc::GainControl::Mode mode = webrtc::GainControl::kFixedDigital; | 167 const webrtc::GainControl::Mode mode = webrtc::GainControl::kFixedDigital; |
| 163 #else | 168 #else |
| 164 const webrtc::GainControl::Mode mode = webrtc::GainControl::kAdaptiveAnalog; | 169 const webrtc::GainControl::Mode mode = webrtc::GainControl::kAdaptiveAnalog; |
| 165 #endif | 170 #endif |
| 166 int err = audio_processing->gain_control()->set_mode(mode); | 171 int err = audio_processing->gain_control()->set_mode(mode); |
| 167 err |= audio_processing->gain_control()->Enable(true); | 172 err |= audio_processing->gain_control()->Enable(true); |
| 168 CHECK_EQ(err, 0); | 173 CHECK_EQ(err, 0); |
| 169 } | 174 } |
| 170 | 175 |
| 171 } // namespace content | 176 } // namespace content |
| OLD | NEW |