blob: a6822f67024c5e57380b2d38fef5c0e98275bb9b [file] [log] [blame]
tkchind4bfbfc2016-08-30 11:56:05 -07001/*
2 * Copyright 2016 The WebRTC project authors. All Rights Reserved.
3 *
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.
9 */
10
11#import "RTCAudioSource+Private.h"
12
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020013#include "rtc_base/checks.h"
tkchind4bfbfc2016-08-30 11:56:05 -070014
15@implementation RTCAudioSource {
tkchind4bfbfc2016-08-30 11:56:05 -070016}
17
frederik.riedel0d1305e2017-02-23 13:57:00 -080018@synthesize volume = _volume;
kthelgason5a4c68e2017-03-28 04:35:58 -070019@synthesize nativeAudioSource = _nativeAudioSource;
frederik.riedel0d1305e2017-02-23 13:57:00 -080020
Yura Yaroshevich01cee072018-07-11 15:35:40 +030021- (instancetype)initWithFactory:(RTCPeerConnectionFactory *)factory
22 nativeAudioSource:
23 (rtc::scoped_refptr<webrtc::AudioSourceInterface>)nativeAudioSource {
24 RTC_DCHECK(factory);
tkchind4bfbfc2016-08-30 11:56:05 -070025 RTC_DCHECK(nativeAudioSource);
Yura Yaroshevich01cee072018-07-11 15:35:40 +030026
27 if (self = [super initWithFactory:factory
28 nativeMediaSource:nativeAudioSource
29 type:RTCMediaSourceTypeAudio]) {
tkchind4bfbfc2016-08-30 11:56:05 -070030 _nativeAudioSource = nativeAudioSource;
31 }
32 return self;
33}
34
Yura Yaroshevich01cee072018-07-11 15:35:40 +030035- (instancetype)initWithFactory:(RTCPeerConnectionFactory *)factory
36 nativeMediaSource:(rtc::scoped_refptr<webrtc::MediaSourceInterface>)nativeMediaSource
37 type:(RTCMediaSourceType)type {
tkchind4bfbfc2016-08-30 11:56:05 -070038 RTC_NOTREACHED();
39 return nil;
40}
41
42- (NSString *)description {
43 NSString *stateString = [[self class] stringForState:self.state];
44 return [NSString stringWithFormat:@"RTCAudioSource( %p ): %@", self, stateString];
45}
46
frederik.riedel0d1305e2017-02-23 13:57:00 -080047- (void)setVolume:(double)volume {
48 _volume = volume;
49 _nativeAudioSource->SetVolume(volume);
50}
51
tkchind4bfbfc2016-08-30 11:56:05 -070052@end