blob: 57cfdf8fd49460ca89793974032b07b64d555de9 [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
Henrik Kjellander15583c12016-02-10 10:53:12 +010011#include "webrtc/api/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(
wu@webrtc.org97077a32013-10-25 21:18:33 +000024 const PeerConnectionFactoryInterface::Options& options,
henrike@webrtc.org28e20752013-07-10 00:45:36 +000025 const MediaConstraintsInterface* constraints) {
buildbot@webrtc.orgd4e598d2014-07-29 17:36:52 +000026 rtc::scoped_refptr<LocalAudioSource> source(
27 new rtc::RefCountedObject<LocalAudioSource>());
wu@webrtc.org97077a32013-10-25 21:18:33 +000028 source->Initialize(options, constraints);
henrike@webrtc.org28e20752013-07-10 00:45:36 +000029 return source;
30}
31
htaa2a49d92016-03-04 02:51:39 -080032rtc::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.org28e20752013-07-10 00:45:36 +000041void LocalAudioSource::Initialize(
wu@webrtc.org97077a32013-10-25 21:18:33 +000042 const PeerConnectionFactoryInterface::Options& options,
henrike@webrtc.org28e20752013-07-10 00:45:36 +000043 const MediaConstraintsInterface* constraints) {
deadbeeffe0fd412017-01-13 11:47:56 -080044 CopyConstraintsIntoAudioOptions(constraints, &options_);
htaa2a49d92016-03-04 02:51:39 -080045}
46
47void 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.org28e20752013-07-10 00:45:36 +000054}
55
56} // namespace webrtc