Jiawei Ou | ae810c1 | 2018-06-20 16:18:59 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2018 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 "RTCPeerConnectionFactoryBuilder.h" |
| 12 | #import "RTCPeerConnectionFactory+Native.h" |
| 13 | |
| 14 | #include "api/audio_codecs/audio_decoder_factory.h" |
| 15 | #include "api/audio_codecs/audio_encoder_factory.h" |
Piotr (Peter) Slatala | e0c2e97 | 2018-10-08 09:43:21 -0700 | [diff] [blame] | 16 | #include "api/media_transport_interface.h" |
Jiawei Ou | ae810c1 | 2018-06-20 16:18:59 -0700 | [diff] [blame] | 17 | #include "api/video_codecs/video_decoder_factory.h" |
| 18 | #include "api/video_codecs/video_encoder_factory.h" |
| 19 | #include "modules/audio_device/include/audio_device.h" |
| 20 | #include "modules/audio_processing/include/audio_processing.h" |
| 21 | |
| 22 | @implementation RTCPeerConnectionFactoryBuilder { |
| 23 | std::unique_ptr<webrtc::VideoEncoderFactory> _videoEncoderFactory; |
| 24 | std::unique_ptr<webrtc::VideoDecoderFactory> _videoDecoderFactory; |
| 25 | rtc::scoped_refptr<webrtc::AudioEncoderFactory> _audioEncoderFactory; |
| 26 | rtc::scoped_refptr<webrtc::AudioDecoderFactory> _audioDecoderFactory; |
| 27 | rtc::scoped_refptr<webrtc::AudioDeviceModule> _audioDeviceModule; |
| 28 | rtc::scoped_refptr<webrtc::AudioProcessing> _audioProcessingModule; |
Piotr (Peter) Slatala | e0c2e97 | 2018-10-08 09:43:21 -0700 | [diff] [blame] | 29 | std::unique_ptr<webrtc::MediaTransportFactory> _mediaTransportFactory; |
Jiawei Ou | ae810c1 | 2018-06-20 16:18:59 -0700 | [diff] [blame] | 30 | } |
| 31 | |
| 32 | + (RTCPeerConnectionFactoryBuilder *)builder { |
| 33 | return [[RTCPeerConnectionFactoryBuilder alloc] init]; |
| 34 | } |
| 35 | |
| 36 | - (RTCPeerConnectionFactory *)createPeerConnectionFactory { |
| 37 | RTCPeerConnectionFactory *factory = [RTCPeerConnectionFactory alloc]; |
| 38 | return [factory initWithNativeAudioEncoderFactory:_audioEncoderFactory |
| 39 | nativeAudioDecoderFactory:_audioDecoderFactory |
| 40 | nativeVideoEncoderFactory:std::move(_videoEncoderFactory) |
| 41 | nativeVideoDecoderFactory:std::move(_videoDecoderFactory) |
| 42 | audioDeviceModule:_audioDeviceModule |
Piotr (Peter) Slatala | e0c2e97 | 2018-10-08 09:43:21 -0700 | [diff] [blame] | 43 | audioProcessingModule:_audioProcessingModule |
| 44 | mediaTransportFactory:std::move(_mediaTransportFactory)]; |
Jiawei Ou | ae810c1 | 2018-06-20 16:18:59 -0700 | [diff] [blame] | 45 | } |
| 46 | |
| 47 | - (void)setVideoEncoderFactory:(std::unique_ptr<webrtc::VideoEncoderFactory>)videoEncoderFactory { |
| 48 | _videoEncoderFactory = std::move(videoEncoderFactory); |
| 49 | } |
| 50 | |
| 51 | - (void)setVideoDecoderFactory:(std::unique_ptr<webrtc::VideoDecoderFactory>)videoDecoderFactory { |
| 52 | _videoDecoderFactory = std::move(videoDecoderFactory); |
| 53 | } |
| 54 | |
| 55 | - (void)setAudioEncoderFactory: |
| 56 | (rtc::scoped_refptr<webrtc::AudioEncoderFactory>)audioEncoderFactory { |
| 57 | _audioEncoderFactory = audioEncoderFactory; |
| 58 | } |
| 59 | |
| 60 | - (void)setAudioDecoderFactory: |
| 61 | (rtc::scoped_refptr<webrtc::AudioDecoderFactory>)audioDecoderFactory { |
| 62 | _audioDecoderFactory = audioDecoderFactory; |
| 63 | } |
| 64 | |
| 65 | - (void)setAudioDeviceModule:(rtc::scoped_refptr<webrtc::AudioDeviceModule>)audioDeviceModule { |
| 66 | _audioDeviceModule = audioDeviceModule; |
| 67 | } |
| 68 | |
| 69 | - (void)setAudioProcessingModule: |
| 70 | (rtc::scoped_refptr<webrtc::AudioProcessing>)audioProcessingModule { |
| 71 | _audioProcessingModule = audioProcessingModule; |
| 72 | } |
| 73 | |
| 74 | @end |