OLD | NEW |
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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 for (const auto& constraint : constraints) { | 59 for (const auto& constraint : constraints) { |
60 bool value = false; | 60 bool value = false; |
61 if (!rtc::FromString(constraint.value, &value)) | 61 if (!rtc::FromString(constraint.value, &value)) |
62 continue; | 62 continue; |
63 | 63 |
64 for (auto& entry : key_to_value) { | 64 for (auto& entry : key_to_value) { |
65 if (constraint.key.compare(entry.name) == 0) | 65 if (constraint.key.compare(entry.name) == 0) |
66 entry.value = rtc::Optional<bool>(value); | 66 entry.value = rtc::Optional<bool>(value); |
67 } | 67 } |
68 } | 68 } |
| 69 |
| 70 // Set non-boolean constraints. |
| 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 } |
69 } | 81 } |
70 | 82 |
71 } // namespace | 83 } // namespace |
72 | 84 |
73 rtc::scoped_refptr<LocalAudioSource> LocalAudioSource::Create( | 85 rtc::scoped_refptr<LocalAudioSource> LocalAudioSource::Create( |
74 const PeerConnectionFactoryInterface::Options& options, | 86 const PeerConnectionFactoryInterface::Options& options, |
75 const MediaConstraintsInterface* constraints) { | 87 const MediaConstraintsInterface* constraints) { |
76 rtc::scoped_refptr<LocalAudioSource> source( | 88 rtc::scoped_refptr<LocalAudioSource> source( |
77 new rtc::RefCountedObject<LocalAudioSource>()); | 89 new rtc::RefCountedObject<LocalAudioSource>()); |
78 source->Initialize(options, constraints); | 90 source->Initialize(options, constraints); |
(...skipping 27 matching lines...) Expand all Loading... |
106 void LocalAudioSource::Initialize( | 118 void LocalAudioSource::Initialize( |
107 const PeerConnectionFactoryInterface::Options& options, | 119 const PeerConnectionFactoryInterface::Options& options, |
108 const cricket::AudioOptions* audio_options) { | 120 const cricket::AudioOptions* audio_options) { |
109 if (!audio_options) | 121 if (!audio_options) |
110 return; | 122 return; |
111 | 123 |
112 options_ = *audio_options; | 124 options_ = *audio_options; |
113 } | 125 } |
114 | 126 |
115 } // namespace webrtc | 127 } // namespace webrtc |
OLD | NEW |