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 14#include "api/audio_codecs/builtin_audio_decoder_factory.h" 15#include "api/audio_codecs/builtin_audio_encoder_factory.h" 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" 20 21#if defined(WEBRTC_IOS) 22#import "sdk/objc/native/api/audio_device_module.h" 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 = webrtc::ObjCToNativeVideoEncoderFactory( 36 [[RTC_OBJC_TYPE(RTCVideoEncoderFactoryH264) alloc] init]); 37 [builder setVideoEncoderFactory:std::move(videoEncoderFactory)]; 38 39 auto videoDecoderFactory = webrtc::ObjCToNativeVideoDecoderFactory( 40 [[RTC_OBJC_TYPE(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 50