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 "RTCPeerConnectionFactory+Native.h" |
| 12 | #import "RTCPeerConnectionFactoryBuilder+DefaultComponents.h" |
| 13 | |
Jiawei Ou | ae810c1 | 2018-06-20 16:18:59 -0700 | [diff] [blame] | 14 | #include "api/audio_codecs/builtin_audio_decoder_factory.h" |
| 15 | #include "api/audio_codecs/builtin_audio_encoder_factory.h" |
Anders Carlsson | 7bca8ca | 2018-08-30 09:30:29 +0200 | [diff] [blame] | 16 | #import "components/video_codec/RTCVideoDecoderFactoryH264.h" |
| 17 | #import "components/video_codec/RTCVideoEncoderFactoryH264.h" |
| 18 | #include "sdk/objc/native/api/video_decoder_factory.h" |
| 19 | #include "sdk/objc/native/api/video_encoder_factory.h" |
Jiawei Ou | ae810c1 | 2018-06-20 16:18:59 -0700 | [diff] [blame] | 20 | |
| 21 | #if defined(WEBRTC_IOS) |
Anders Carlsson | 7bca8ca | 2018-08-30 09:30:29 +0200 | [diff] [blame] | 22 | #import "sdk/objc/native/api/audio_device_module.h" |
Jiawei Ou | ae810c1 | 2018-06-20 16:18:59 -0700 | [diff] [blame] | 23 | #endif |
| 24 | |
| 25 | @implementation RTCPeerConnectionFactoryBuilder (DefaultComponents) |
| 26 | |
| 27 | + (RTCPeerConnectionFactoryBuilder *)defaultBuilder { |
| 28 | RTCPeerConnectionFactoryBuilder *builder = [[RTCPeerConnectionFactoryBuilder alloc] init]; |
| 29 | auto audioEncoderFactory = webrtc::CreateBuiltinAudioEncoderFactory(); |
| 30 | [builder setAudioEncoderFactory:audioEncoderFactory]; |
| 31 | |
| 32 | auto audioDecoderFactory = webrtc::CreateBuiltinAudioDecoderFactory(); |
| 33 | [builder setAudioDecoderFactory:audioDecoderFactory]; |
| 34 | |
| 35 | auto videoEncoderFactory = |
| 36 | webrtc::ObjCToNativeVideoEncoderFactory([[RTCVideoEncoderFactoryH264 alloc] init]); |
| 37 | [builder setVideoEncoderFactory:std::move(videoEncoderFactory)]; |
| 38 | |
| 39 | auto videoDecoderFactory = |
| 40 | webrtc::ObjCToNativeVideoDecoderFactory([[RTCVideoDecoderFactoryH264 alloc] init]); |
| 41 | [builder setVideoDecoderFactory:std::move(videoDecoderFactory)]; |
| 42 | |
| 43 | #if defined(WEBRTC_IOS) |
| 44 | [builder setAudioDeviceModule:webrtc::CreateAudioDeviceModule()]; |
| 45 | #endif |
| 46 | return builder; |
| 47 | } |
| 48 | |
| 49 | @end |