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 | |
Henrik Kjellander | 15583c1 | 2016-02-10 10:53:12 +0100 | [diff] [blame] | 11 | #include "webrtc/api/localaudiosource.h" |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 12 | |
| 13 | #include <vector> |
| 14 | |
Henrik Kjellander | 15583c1 | 2016-02-10 10:53:12 +0100 | [diff] [blame] | 15 | #include "webrtc/api/mediaconstraintsinterface.h" |
kjellander | a96e2d7 | 2016-02-04 23:52:28 -0800 | [diff] [blame] | 16 | #include "webrtc/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( |
wu@webrtc.org | 97077a3 | 2013-10-25 21:18:33 +0000 | [diff] [blame] | 24 | const PeerConnectionFactoryInterface::Options& options, |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 25 | const MediaConstraintsInterface* constraints) { |
buildbot@webrtc.org | d4e598d | 2014-07-29 17:36:52 +0000 | [diff] [blame] | 26 | rtc::scoped_refptr<LocalAudioSource> source( |
| 27 | new rtc::RefCountedObject<LocalAudioSource>()); |
wu@webrtc.org | 97077a3 | 2013-10-25 21:18:33 +0000 | [diff] [blame] | 28 | source->Initialize(options, constraints); |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 29 | return source; |
| 30 | } |
| 31 | |
hta | a2a49d9 | 2016-03-04 02:51:39 -0800 | [diff] [blame] | 32 | rtc::scoped_refptr<LocalAudioSource> LocalAudioSource::Create( |
| 33 | const PeerConnectionFactoryInterface::Options& options, |
| 34 | const cricket::AudioOptions* audio_options) { |
| 35 | rtc::scoped_refptr<LocalAudioSource> source( |
| 36 | new rtc::RefCountedObject<LocalAudioSource>()); |
| 37 | source->Initialize(options, audio_options); |
| 38 | return source; |
| 39 | } |
| 40 | |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 41 | void LocalAudioSource::Initialize( |
wu@webrtc.org | 97077a3 | 2013-10-25 21:18:33 +0000 | [diff] [blame] | 42 | const PeerConnectionFactoryInterface::Options& options, |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 43 | const MediaConstraintsInterface* constraints) { |
deadbeef | fe0fd41 | 2017-01-13 11:47:56 -0800 | [diff] [blame^] | 44 | CopyConstraintsIntoAudioOptions(constraints, &options_); |
hta | a2a49d9 | 2016-03-04 02:51:39 -0800 | [diff] [blame] | 45 | } |
| 46 | |
| 47 | void LocalAudioSource::Initialize( |
| 48 | const PeerConnectionFactoryInterface::Options& options, |
| 49 | const cricket::AudioOptions* audio_options) { |
| 50 | if (!audio_options) |
| 51 | return; |
| 52 | |
| 53 | options_ = *audio_options; |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 54 | } |
| 55 | |
| 56 | } // namespace webrtc |