blob: 5c86dd30f96485ef582876b0a66c3e079932fe5f [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
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020011#include "pc/localaudiosource.h"
henrike@webrtc.org28e20752013-07-10 00:45:36 +000012
13#include <vector>
14
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020015#include "api/mediaconstraintsinterface.h"
16#include "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