• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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
34- (RTC_OBJC_TYPE(RTCPeerConnectionFactory) *)createPeerConnectionFactory {
35  RTC_OBJC_TYPE(RTCPeerConnectionFactory) *factory =
36      [RTC_OBJC_TYPE(RTCPeerConnectionFactory) alloc];
37  return [factory initWithNativeAudioEncoderFactory:_audioEncoderFactory
38                          nativeAudioDecoderFactory:_audioDecoderFactory
39                          nativeVideoEncoderFactory:std::move(_videoEncoderFactory)
40                          nativeVideoDecoderFactory:std::move(_videoDecoderFactory)
41                                  audioDeviceModule:_audioDeviceModule.get()
42                              audioProcessingModule:_audioProcessingModule];
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
73