1/*
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
13#include "rtc_base/checks.h"
14
15@implementation RTC_OBJC_TYPE (RTCAudioSource) {
16}
17
18@synthesize volume = _volume;
19@synthesize nativeAudioSource = _nativeAudioSource;
20
21- (instancetype)initWithFactory:(RTC_OBJC_TYPE(RTCPeerConnectionFactory) *)factory
22              nativeAudioSource:
23                  (rtc::scoped_refptr<webrtc::AudioSourceInterface>)nativeAudioSource {
24  RTC_DCHECK(factory);
25  RTC_DCHECK(nativeAudioSource);
26
27  if (self = [super initWithFactory:factory
28                  nativeMediaSource:nativeAudioSource
29                               type:RTCMediaSourceTypeAudio]) {
30    _nativeAudioSource = nativeAudioSource;
31  }
32  return self;
33}
34
35- (instancetype)initWithFactory:(RTC_OBJC_TYPE(RTCPeerConnectionFactory) *)factory
36              nativeMediaSource:(rtc::scoped_refptr<webrtc::MediaSourceInterface>)nativeMediaSource
37                           type:(RTCMediaSourceType)type {
38  RTC_NOTREACHED();
39  return nil;
40}
41
42- (NSString *)description {
43  NSString *stateString = [[self class] stringForState:self.state];
44  return [NSString stringWithFormat:@"RTC_OBJC_TYPE(RTCAudioSource)( %p ): %@", self, stateString];
45}
46
47- (void)setVolume:(double)volume {
48  _volume = volume;
49  _nativeAudioSource->SetVolume(volume);
50}
51
52@end
53