| OLD | NEW |
| 1 /* | 1 /* |
| 2 * libjingle | 2 * libjingle |
| 3 * Copyright 2013 Google Inc. | 3 * Copyright 2013 Google Inc. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions are met: | 6 * modification, are permitted provided that the following conditions are met: |
| 7 * | 7 * |
| 8 * 1. Redistributions of source code must retain the above copyright notice, | 8 * 1. Redistributions of source code must retain the above copyright notice, |
| 9 * this list of conditions and the following disclaimer. | 9 * this list of conditions and the following disclaimer. |
| 10 * 2. Redistributions in binary form must reproduce the above copyright notice, | 10 * 2. Redistributions in binary form must reproduce the above copyright notice, |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 #import "RTCVideoTrack+Internal.h" | 47 #import "RTCVideoTrack+Internal.h" |
| 48 | 48 |
| 49 #include "talk/app/webrtc/audiotrack.h" | 49 #include "talk/app/webrtc/audiotrack.h" |
| 50 #include "talk/app/webrtc/mediastreaminterface.h" | 50 #include "talk/app/webrtc/mediastreaminterface.h" |
| 51 #include "talk/app/webrtc/peerconnectioninterface.h" | 51 #include "talk/app/webrtc/peerconnectioninterface.h" |
| 52 #include "talk/app/webrtc/videosourceinterface.h" | 52 #include "talk/app/webrtc/videosourceinterface.h" |
| 53 #include "talk/app/webrtc/videotrack.h" | 53 #include "talk/app/webrtc/videotrack.h" |
| 54 #include "webrtc/base/logging.h" | 54 #include "webrtc/base/logging.h" |
| 55 #include "webrtc/base/ssladapter.h" | 55 #include "webrtc/base/ssladapter.h" |
| 56 | 56 |
| 57 | |
| 58 @implementation RTCPeerConnectionFactory { | 57 @implementation RTCPeerConnectionFactory { |
| 59 rtc::scoped_ptr<rtc::Thread> _signalingThread; | 58 rtc::scoped_ptr<rtc::Thread> _signalingThread; |
| 60 rtc::scoped_ptr<rtc::Thread> _workerThread; | 59 rtc::scoped_ptr<rtc::Thread> _workerThread; |
| 61 } | 60 } |
| 62 | 61 |
| 63 @synthesize nativeFactory = _nativeFactory; | 62 @synthesize nativeFactory = _nativeFactory; |
| 64 | 63 |
| 65 + (void)initializeSSL { | 64 + (void)initializeSSL { |
| 66 BOOL initialized = rtc::InitializeSSL(); | 65 BOOL initialized = rtc::InitializeSSL(); |
| 67 NSAssert(initialized, @"Failed to initialize SSL library"); | 66 NSAssert(initialized, @"Failed to initialize SSL library"); |
| 68 } | 67 } |
| 69 | 68 |
| 70 + (void)deinitializeSSL { | 69 + (void)deinitializeSSL { |
| 71 BOOL deinitialized = rtc::CleanupSSL(); | 70 BOOL deinitialized = rtc::CleanupSSL(); |
| 72 NSAssert(deinitialized, @"Failed to deinitialize SSL library"); | 71 NSAssert(deinitialized, @"Failed to deinitialize SSL library"); |
| 73 } | 72 } |
| 74 | 73 |
| 75 - (id)init { | 74 - (id)init { |
| 76 if ((self = [super init])) { | 75 if ((self = [super init])) { |
| 77 _signalingThread.reset(new rtc::Thread()); | 76 _signalingThread.reset(new rtc::Thread()); |
| 78 BOOL result = _signalingThread->Start(); | 77 BOOL result = _signalingThread->Start(); |
| 79 NSAssert(result, @"Failed to start signaling thread."); | 78 NSAssert(result, @"Failed to start signaling thread."); |
| 80 _workerThread.reset(new rtc::Thread()); | 79 _workerThread.reset(new rtc::Thread()); |
| 81 result = _workerThread->Start(); | 80 result = _workerThread->Start(); |
| 82 NSAssert(result, @"Failed to start worker thread."); | 81 NSAssert(result, @"Failed to start worker thread."); |
| 82 |
| 83 _nativeFactory = webrtc::CreatePeerConnectionFactory( | 83 _nativeFactory = webrtc::CreatePeerConnectionFactory( |
| 84 _signalingThread.get(), _workerThread.get(), NULL, NULL, NULL); | 84 _signalingThread.get(), _workerThread.get(), nullptr, nullptr, nullptr); |
| 85 NSAssert(_nativeFactory, @"Failed to initialize PeerConnectionFactory!"); | 85 NSAssert(_nativeFactory, @"Failed to initialize PeerConnectionFactory!"); |
| 86 // Uncomment to get sensitive logs emitted (to stderr or logcat). | 86 // Uncomment to get sensitive logs emitted (to stderr or logcat). |
| 87 // rtc::LogMessage::LogToDebug(rtc::LS_SENSITIVE); | 87 // rtc::LogMessage::LogToDebug(rtc::LS_SENSITIVE); |
| 88 } | 88 } |
| 89 return self; | 89 return self; |
| 90 } | 90 } |
| 91 | 91 |
| 92 - (RTCPeerConnection *)peerConnectionWithConfiguration:(RTCConfiguration *)confi
guration | 92 - (RTCPeerConnection *)peerConnectionWithConfiguration:(RTCConfiguration *)confi
guration |
| 93 constraints:(RTCMediaConstraints *)co
nstraints | 93 constraints:(RTCMediaConstraints *)co
nstraints |
| 94 delegate:(id<RTCPeerConnectionDele
gate>)delegate { | 94 delegate:(id<RTCPeerConnectionDele
gate>)delegate { |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 139 return [[RTCVideoTrack alloc] initWithMediaTrack:track]; | 139 return [[RTCVideoTrack alloc] initWithMediaTrack:track]; |
| 140 } | 140 } |
| 141 | 141 |
| 142 - (RTCAudioTrack*)audioTrackWithID:(NSString*)audioId { | 142 - (RTCAudioTrack*)audioTrackWithID:(NSString*)audioId { |
| 143 rtc::scoped_refptr<webrtc::AudioTrackInterface> track = | 143 rtc::scoped_refptr<webrtc::AudioTrackInterface> track = |
| 144 self.nativeFactory->CreateAudioTrack([audioId UTF8String], NULL); | 144 self.nativeFactory->CreateAudioTrack([audioId UTF8String], NULL); |
| 145 return [[RTCAudioTrack alloc] initWithMediaTrack:track]; | 145 return [[RTCAudioTrack alloc] initWithMediaTrack:track]; |
| 146 } | 146 } |
| 147 | 147 |
| 148 @end | 148 @end |
| OLD | NEW |