blob: 3bb75eec686844071a7b9b6b7c18574ffb069eb4 [file] [log] [blame]
Jiawei Ouae810c12018-06-20 16:18:59 -07001/*
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 Ouae810c12018-06-20 16:18:59 -070014#include "api/audio_codecs/builtin_audio_decoder_factory.h"
15#include "api/audio_codecs/builtin_audio_encoder_factory.h"
Anders Carlsson7bca8ca2018-08-30 09:30:29 +020016#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 Ouae810c12018-06-20 16:18:59 -070020
21#if defined(WEBRTC_IOS)
Anders Carlsson7bca8ca2018-08-30 09:30:29 +020022#import "sdk/objc/native/api/audio_device_module.h"
Jiawei Ouae810c12018-06-20 16:18:59 -070023#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