Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(106)

Side by Side Diff: webrtc/api/localaudiosource.cc

Issue 2437803004: Adding googAudioNetworkAdaptorConfig to MediaConstraintsInterface. (Closed)
Patch Set: Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright 2013 The WebRTC project authors. All Rights Reserved. 2 * Copyright 2013 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 {MediaConstraintsInterface::kIntelligibilityEnhancer, 50 {MediaConstraintsInterface::kIntelligibilityEnhancer,
51 options->intelligibility_enhancer}, 51 options->intelligibility_enhancer},
52 {MediaConstraintsInterface::kLevelControl, options->level_control}, 52 {MediaConstraintsInterface::kLevelControl, options->level_control},
53 {MediaConstraintsInterface::kHighpassFilter, options->highpass_filter}, 53 {MediaConstraintsInterface::kHighpassFilter, options->highpass_filter},
54 {MediaConstraintsInterface::kTypingNoiseDetection, 54 {MediaConstraintsInterface::kTypingNoiseDetection,
55 options->typing_detection}, 55 options->typing_detection},
56 {MediaConstraintsInterface::kAudioMirroring, options->stereo_swapping} 56 {MediaConstraintsInterface::kAudioMirroring, options->stereo_swapping}
57 }; 57 };
58 58
59 for (const auto& constraint : constraints) { 59 for (const auto& constraint : constraints) {
60 // Set non-boolean constraints.
61 if (0 == constraint.key.compare(
62 MediaConstraintsInterface::kLevelControlInitialPeakLevelDBFS)) {
63 float level_control_initial_peak_level_dbfs;
the sun 2016/11/09 10:14:25 = 0.0f; *always* initialize. Code may be changed
64 if (rtc::FromString(constraint.value,
65 &level_control_initial_peak_level_dbfs)) {
66 options->level_control_initial_peak_level_dbfs =
67 rtc::Optional<float>(level_control_initial_peak_level_dbfs);
68 }
69 continue;
70 }
71 if (constraint.key.compare(
72 MediaConstraintsInterface::kAudioNetworkAdaptorConfig) == 0) {
73 // When |kAudioNetworkAdaptorConfig| is defined, it both means that audio
74 // network adaptor is wanted, and provides the config string.
75 options->audio_network_adaptor = rtc::Optional<bool>(true);
76 options->audio_network_adaptor_config =
77 rtc::Optional<std::string>(constraint.value);
the sun 2016/11/09 10:14:25 Is there any way we can validate the string at thi
minyue-webrtc 2016/12/02 10:34:19 The interpretation and validity check of the strin
78 continue;
79 }
80
81 // Parse boolean value.
60 bool value = false; 82 bool value = false;
61 if (!rtc::FromString(constraint.value, &value)) 83 if (!rtc::FromString(constraint.value, &value))
62 continue; 84 continue;
63 85
64 for (auto& entry : key_to_value) { 86 for (auto& entry : key_to_value) {
65 if (constraint.key.compare(entry.name) == 0) 87 if (constraint.key.compare(entry.name) == 0)
66 entry.value = rtc::Optional<bool>(value); 88 entry.value = rtc::Optional<bool>(value);
67 } 89 }
68 } 90 }
69
70 // Set non-boolean constraints.
minyue-webrtc 2016/11/01 10:55:09 This is a refactoring. This part is moved into the
71 std::string value;
72 if (constraints.FindFirst(
73 MediaConstraintsInterface::kLevelControlInitialPeakLevelDBFS,
74 &value)) {
75 float level_control_initial_peak_level_dbfs;
76 if (rtc::FromString(value, &level_control_initial_peak_level_dbfs)) {
77 options->level_control_initial_peak_level_dbfs =
78 rtc::Optional<float>(level_control_initial_peak_level_dbfs);
79 }
80 }
81 } 91 }
82 92
83 } // namespace 93 } // namespace
84 94
85 rtc::scoped_refptr<LocalAudioSource> LocalAudioSource::Create( 95 rtc::scoped_refptr<LocalAudioSource> LocalAudioSource::Create(
86 const PeerConnectionFactoryInterface::Options& options, 96 const PeerConnectionFactoryInterface::Options& options,
87 const MediaConstraintsInterface* constraints) { 97 const MediaConstraintsInterface* constraints) {
88 rtc::scoped_refptr<LocalAudioSource> source( 98 rtc::scoped_refptr<LocalAudioSource> source(
89 new rtc::RefCountedObject<LocalAudioSource>()); 99 new rtc::RefCountedObject<LocalAudioSource>());
90 source->Initialize(options, constraints); 100 source->Initialize(options, constraints);
(...skipping 27 matching lines...) Expand all
118 void LocalAudioSource::Initialize( 128 void LocalAudioSource::Initialize(
119 const PeerConnectionFactoryInterface::Options& options, 129 const PeerConnectionFactoryInterface::Options& options,
120 const cricket::AudioOptions* audio_options) { 130 const cricket::AudioOptions* audio_options) {
121 if (!audio_options) 131 if (!audio_options)
122 return; 132 return;
123 133
124 options_ = *audio_options; 134 options_ = *audio_options;
125 } 135 }
126 136
127 } // namespace webrtc 137 } // namespace webrtc
OLDNEW
« no previous file with comments | « no previous file | webrtc/api/mediaconstraintsinterface.h » ('j') | webrtc/api/mediaconstraintsinterface.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698