henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 1 | /* |
kjellander | b24317b | 2016-02-10 07:54:43 -0800 | [diff] [blame] | 2 | * Copyright 2013 The WebRTC project authors. All Rights Reserved. |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 3 | * |
kjellander | b24317b | 2016-02-10 07:54:43 -0800 | [diff] [blame] | 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 |
| 6 | * tree. An additional intellectual property rights grant can be found |
| 7 | * in the file PATENTS. All contributing project authors may |
| 8 | * be found in the AUTHORS file in the root of the source tree. |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 9 | */ |
| 10 | |
Mirko Bonadei | 92ea95e | 2017-09-15 06:47:31 +0200 | [diff] [blame] | 11 | #include "pc/localaudiosource.h" |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 12 | |
| 13 | #include <vector> |
| 14 | |
Mirko Bonadei | 92ea95e | 2017-09-15 06:47:31 +0200 | [diff] [blame] | 15 | #include "api/mediaconstraintsinterface.h" |
| 16 | #include "media/base/mediaengine.h" |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 17 | |
| 18 | using webrtc::MediaConstraintsInterface; |
| 19 | using webrtc::MediaSourceInterface; |
| 20 | |
| 21 | namespace webrtc { |
| 22 | |
buildbot@webrtc.org | d4e598d | 2014-07-29 17:36:52 +0000 | [diff] [blame] | 23 | rtc::scoped_refptr<LocalAudioSource> LocalAudioSource::Create( |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 24 | const MediaConstraintsInterface* constraints) { |
buildbot@webrtc.org | d4e598d | 2014-07-29 17:36:52 +0000 | [diff] [blame] | 25 | rtc::scoped_refptr<LocalAudioSource> source( |
| 26 | new rtc::RefCountedObject<LocalAudioSource>()); |
deadbeef | 757146b | 2017-02-10 21:26:48 -0800 | [diff] [blame] | 27 | source->Initialize(constraints); |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 28 | return source; |
| 29 | } |
| 30 | |
hta | a2a49d9 | 2016-03-04 02:51:39 -0800 | [diff] [blame] | 31 | rtc::scoped_refptr<LocalAudioSource> LocalAudioSource::Create( |
hta | a2a49d9 | 2016-03-04 02:51:39 -0800 | [diff] [blame] | 32 | const cricket::AudioOptions* audio_options) { |
| 33 | rtc::scoped_refptr<LocalAudioSource> source( |
| 34 | new rtc::RefCountedObject<LocalAudioSource>()); |
deadbeef | 757146b | 2017-02-10 21:26:48 -0800 | [diff] [blame] | 35 | source->Initialize(audio_options); |
hta | a2a49d9 | 2016-03-04 02:51:39 -0800 | [diff] [blame] | 36 | return source; |
| 37 | } |
| 38 | |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 39 | void LocalAudioSource::Initialize( |
| 40 | const MediaConstraintsInterface* constraints) { |
deadbeef | fe0fd41 | 2017-01-13 11:47:56 -0800 | [diff] [blame] | 41 | CopyConstraintsIntoAudioOptions(constraints, &options_); |
hta | a2a49d9 | 2016-03-04 02:51:39 -0800 | [diff] [blame] | 42 | } |
| 43 | |
| 44 | void LocalAudioSource::Initialize( |
hta | a2a49d9 | 2016-03-04 02:51:39 -0800 | [diff] [blame] | 45 | const cricket::AudioOptions* audio_options) { |
| 46 | if (!audio_options) |
| 47 | return; |
| 48 | |
| 49 | options_ = *audio_options; |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 50 | } |
| 51 | |
| 52 | } // namespace webrtc |