Chromium Code Reviews

Side by Side Diff: webrtc/api/objc/RTCPeerConnectionFactory.mm

Issue 1558473002: Update API for Objective-C RTCPeerConnectionFactory. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff |
OLDNEW
(Empty)
1 /*
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 #include "webrtc/base/ssladapter.h"
14
15 #import "webrtc/api/objc/RTCPeerConnectionFactory+Private.h"
16
17 @implementation RTCPeerConnectionFactory {
18 rtc::scoped_ptr<rtc::Thread> _signalingThread;
19 rtc::scoped_ptr<rtc::Thread> _workerThread;
20 }
21
22 @synthesize nativeFactory = _nativeFactory;
23
24 + (void)initializeSSL {
25 BOOL initialized = rtc::InitializeSSL();
26 NSAssert(initialized, @"Failed to initialize SSL library");
27 }
28
29 + (void)deinitializeSSL {
30 BOOL deinitialized = rtc::CleanupSSL();
31 NSAssert(deinitialized, @"Failed to deinitialize SSL library");
32 }
33
34 - (instancetype)init {
35 if ((self = [super init])) {
36 _signalingThread.reset(new rtc::Thread());
37 BOOL result = _signalingThread->Start();
38 NSAssert(result, @"Failed to start signaling thread.");
39 _workerThread.reset(new rtc::Thread());
40 result = _workerThread->Start();
41 NSAssert(result, @"Failed to start worker thread.");
42
43 _nativeFactory = webrtc::CreatePeerConnectionFactory(
44 _workerThread.get(), _signalingThread.get(), nullptr, nullptr, nullptr);
45 NSAssert(_nativeFactory, @"Failed to initialize PeerConnectionFactory!");
46 // Uncomment to get sensitive logs emitted (to stderr or logcat).
47 // rtc::LogMessage::LogToDebug(rtc::LS_SENSITIVE);
48 }
49 return self;
50 }
51
52 @end
OLDNEW

Powered by Google App Engine