blob: 31f3dda6401cb4240800f705d2b7acbe563edaa7 [file] [log] [blame]
Jon Hjelleda99da82016-01-20 13:40:30 -08001/*
2 * Copyright 2015 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.h"
12
13#import "webrtc/api/objc/RTCPeerConnectionFactory+Private.h"
14
15@implementation RTCPeerConnectionFactory {
16 rtc::scoped_ptr<rtc::Thread> _signalingThread;
17 rtc::scoped_ptr<rtc::Thread> _workerThread;
18}
19
20@synthesize nativeFactory = _nativeFactory;
21
22- (instancetype)init {
23 if ((self = [super init])) {
24 _signalingThread.reset(new rtc::Thread());
25 BOOL result = _signalingThread->Start();
26 NSAssert(result, @"Failed to start signaling thread.");
27 _workerThread.reset(new rtc::Thread());
28 result = _workerThread->Start();
29 NSAssert(result, @"Failed to start worker thread.");
30
31 _nativeFactory = webrtc::CreatePeerConnectionFactory(
32 _workerThread.get(), _signalingThread.get(), nullptr, nullptr, nullptr);
33 NSAssert(_nativeFactory, @"Failed to initialize PeerConnectionFactory!");
34 }
35 return self;
36}
37
38@end