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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 | 70 |
71 rtc::scoped_refptr<LocalAudioSource> LocalAudioSource::Create( | 71 rtc::scoped_refptr<LocalAudioSource> LocalAudioSource::Create( |
72 const PeerConnectionFactoryInterface::Options& options, | 72 const PeerConnectionFactoryInterface::Options& options, |
73 const MediaConstraintsInterface* constraints) { | 73 const MediaConstraintsInterface* constraints) { |
74 rtc::scoped_refptr<LocalAudioSource> source( | 74 rtc::scoped_refptr<LocalAudioSource> source( |
75 new rtc::RefCountedObject<LocalAudioSource>()); | 75 new rtc::RefCountedObject<LocalAudioSource>()); |
76 source->Initialize(options, constraints); | 76 source->Initialize(options, constraints); |
77 return source; | 77 return source; |
78 } | 78 } |
79 | 79 |
| 80 rtc::scoped_refptr<LocalAudioSource> LocalAudioSource::Create( |
| 81 const PeerConnectionFactoryInterface::Options& options, |
| 82 const cricket::AudioOptions* audio_options) { |
| 83 rtc::scoped_refptr<LocalAudioSource> source( |
| 84 new rtc::RefCountedObject<LocalAudioSource>()); |
| 85 source->Initialize(options, audio_options); |
| 86 return source; |
| 87 } |
| 88 |
80 void LocalAudioSource::Initialize( | 89 void LocalAudioSource::Initialize( |
81 const PeerConnectionFactoryInterface::Options& options, | 90 const PeerConnectionFactoryInterface::Options& options, |
82 const MediaConstraintsInterface* constraints) { | 91 const MediaConstraintsInterface* constraints) { |
83 if (!constraints) | 92 if (!constraints) |
84 return; | 93 return; |
85 | 94 |
86 // Apply optional constraints first, they will be overwritten by mandatory | 95 // Apply optional constraints first, they will be overwritten by mandatory |
87 // constraints. | 96 // constraints. |
88 FromConstraints(constraints->GetOptional(), &options_); | 97 FromConstraints(constraints->GetOptional(), &options_); |
89 | 98 |
90 cricket::AudioOptions mandatory_options; | 99 cricket::AudioOptions mandatory_options; |
91 FromConstraints(constraints->GetMandatory(), &mandatory_options); | 100 FromConstraints(constraints->GetMandatory(), &mandatory_options); |
92 options_.SetAll(mandatory_options); | 101 options_.SetAll(mandatory_options); |
93 source_state_ = kLive; | 102 source_state_ = kLive; |
94 } | 103 } |
95 | 104 |
| 105 void LocalAudioSource::Initialize( |
| 106 const PeerConnectionFactoryInterface::Options& options, |
| 107 const cricket::AudioOptions* audio_options) { |
| 108 if (!audio_options) |
| 109 return; |
| 110 |
| 111 options_ = *audio_options; |
| 112 source_state_ = kLive; |
| 113 } |
| 114 |
96 } // namespace webrtc | 115 } // namespace webrtc |
OLD | NEW |