blob: 5454cdfaaec0bbf9f1f0c9fd146e686bd994e6ac [file] [log] [blame]
henrike@webrtc.org28e20752013-07-10 00:45:36 +00001/*
kjellanderb24317b2016-02-10 07:54:43 -08002 * Copyright 2013 The WebRTC project authors. All Rights Reserved.
henrike@webrtc.org28e20752013-07-10 00:45:36 +00003 *
kjellanderb24317b2016-02-10 07:54:43 -08004 * 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.org28e20752013-07-10 00:45:36 +00009 */
10
ossu7bb87ee2017-01-23 04:56:25 -080011#include "webrtc/pc/localaudiosource.h"
henrike@webrtc.org28e20752013-07-10 00:45:36 +000012
13#include <vector>
14
Henrik Kjellander15583c12016-02-10 10:53:12 +010015#include "webrtc/api/mediaconstraintsinterface.h"
kjellandera96e2d72016-02-04 23:52:28 -080016#include "webrtc/media/base/mediaengine.h"
henrike@webrtc.org28e20752013-07-10 00:45:36 +000017
18using webrtc::MediaConstraintsInterface;
19using webrtc::MediaSourceInterface;
20
21namespace webrtc {
22
buildbot@webrtc.orgd4e598d2014-07-29 17:36:52 +000023rtc::scoped_refptr<LocalAudioSource> LocalAudioSource::Create(
henrike@webrtc.org28e20752013-07-10 00:45:36 +000024 const MediaConstraintsInterface* constraints) {
buildbot@webrtc.orgd4e598d2014-07-29 17:36:52 +000025 rtc::scoped_refptr<LocalAudioSource> source(
26 new rtc::RefCountedObject<LocalAudioSource>());
deadbeef757146b2017-02-10 21:26:48 -080027 source->Initialize(constraints);
henrike@webrtc.org28e20752013-07-10 00:45:36 +000028 return source;
29}
30
htaa2a49d92016-03-04 02:51:39 -080031rtc::scoped_refptr<LocalAudioSource> LocalAudioSource::Create(
htaa2a49d92016-03-04 02:51:39 -080032 const cricket::AudioOptions* audio_options) {
33 rtc::scoped_refptr<LocalAudioSource> source(
34 new rtc::RefCountedObject<LocalAudioSource>());
deadbeef757146b2017-02-10 21:26:48 -080035 source->Initialize(audio_options);
htaa2a49d92016-03-04 02:51:39 -080036 return source;
37}
38
henrike@webrtc.org28e20752013-07-10 00:45:36 +000039void LocalAudioSource::Initialize(
40 const MediaConstraintsInterface* constraints) {
deadbeeffe0fd412017-01-13 11:47:56 -080041 CopyConstraintsIntoAudioOptions(constraints, &options_);
htaa2a49d92016-03-04 02:51:39 -080042}
43
44void LocalAudioSource::Initialize(
htaa2a49d92016-03-04 02:51:39 -080045 const cricket::AudioOptions* audio_options) {
46 if (!audio_options)
47 return;
48
49 options_ = *audio_options;
henrike@webrtc.org28e20752013-07-10 00:45:36 +000050}
51
52} // namespace webrtc