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" |
| 16 | #include "api/video_codecs/video_decoder_factory.h" |
| 17 | #include "api/video_codecs/video_encoder_factory.h" |
| 18 | #include "modules/audio_device/include/audio_device.h" |
| 19 | #include "modules/audio_processing/include/audio_processing.h" |
| 20 | |
| 21 | @implementation RTCPeerConnectionFactoryBuilder { |
| 22 | std::unique_ptr<webrtc::VideoEncoderFactory> _videoEncoderFactory; |
| 23 | std::unique_ptr<webrtc::VideoDecoderFactory> _videoDecoderFactory; |
| 24 | rtc::scoped_refptr<webrtc::AudioEncoderFactory> _audioEncoderFactory; |
| 25 | rtc::scoped_refptr<webrtc::AudioDecoderFactory> _audioDecoderFactory; |
| 26 | rtc::scoped_refptr<webrtc::AudioDeviceModule> _audioDeviceModule; |
| 27 | rtc::scoped_refptr<webrtc::AudioProcessing> _audioProcessingModule; |
| 28 | } |
| 29 | |
| 30 | + (RTCPeerConnectionFactoryBuilder *)builder { |
| 31 | return [[RTCPeerConnectionFactoryBuilder alloc] init]; |
| 32 | } |
| 33 | |
Mirko Bonadei | a81e9c8 | 2020-05-04 16:14:32 +0200 | [diff] [blame] | 34 | - (RTC_OBJC_TYPE(RTCPeerConnectionFactory) *)createPeerConnectionFactory { |
| 35 | RTC_OBJC_TYPE(RTCPeerConnectionFactory) *factory = |
| 36 | [RTC_OBJC_TYPE(RTCPeerConnectionFactory) alloc]; |
Jiawei Ou | ae810c1 | 2018-06-20 16:18:59 -0700 | [diff] [blame] | 37 | return [factory initWithNativeAudioEncoderFactory:_audioEncoderFactory |
| 38 | nativeAudioDecoderFactory:_audioDecoderFactory |
| 39 | nativeVideoEncoderFactory:std::move(_videoEncoderFactory) |
| 40 | nativeVideoDecoderFactory:std::move(_videoDecoderFactory) |
| 41 | audioDeviceModule:_audioDeviceModule |
Niels Möller | 938bc33 | 2020-06-10 17:36:17 +0200 | [diff] [blame] | 42 | audioProcessingModule:_audioProcessingModule]; |
Jiawei Ou | ae810c1 | 2018-06-20 16:18:59 -0700 | [diff] [blame] | 43 | } |
| 44 | |
| 45 | - (void)setVideoEncoderFactory:(std::unique_ptr<webrtc::VideoEncoderFactory>)videoEncoderFactory { |
| 46 | _videoEncoderFactory = std::move(videoEncoderFactory); |
| 47 | } |
| 48 | |
| 49 | - (void)setVideoDecoderFactory:(std::unique_ptr<webrtc::VideoDecoderFactory>)videoDecoderFactory { |
| 50 | _videoDecoderFactory = std::move(videoDecoderFactory); |
| 51 | } |
| 52 | |
| 53 | - (void)setAudioEncoderFactory: |
| 54 | (rtc::scoped_refptr<webrtc::AudioEncoderFactory>)audioEncoderFactory { |
| 55 | _audioEncoderFactory = audioEncoderFactory; |
| 56 | } |
| 57 | |
| 58 | - (void)setAudioDecoderFactory: |
| 59 | (rtc::scoped_refptr<webrtc::AudioDecoderFactory>)audioDecoderFactory { |
| 60 | _audioDecoderFactory = audioDecoderFactory; |
| 61 | } |
| 62 | |
| 63 | - (void)setAudioDeviceModule:(rtc::scoped_refptr<webrtc::AudioDeviceModule>)audioDeviceModule { |
| 64 | _audioDeviceModule = audioDeviceModule; |
| 65 | } |
| 66 | |
| 67 | - (void)setAudioProcessingModule: |
| 68 | (rtc::scoped_refptr<webrtc::AudioProcessing>)audioProcessingModule { |
| 69 | _audioProcessingModule = audioProcessingModule; |
| 70 | } |
| 71 | |
| 72 | @end |