Add RTCConfiguration constructor to RTCPeerConnection wrapper.
BUG=4658 R=jiayl@webrtc.org Review URL: https://webrtc-codereview.appspot.com/56419004 Cr-Commit-Position: refs/heads/master@{#9335}
This commit is contained in:
parent
d935f912b1
commit
bc7dd7e023
10
talk/app/webrtc/objc/.clang-format
Normal file
10
talk/app/webrtc/objc/.clang-format
Normal file
@ -0,0 +1,10 @@
|
||||
BasedOnStyle: Chromium
|
||||
ColumnLimit: 100
|
||||
BinPackParameters: false
|
||||
AllowAllParametersOfDeclarationOnNextLine: true
|
||||
DerivePointerAlignment: false
|
||||
PointerAlignment: Right
|
||||
SpacesBeforeTrailingComments: 1
|
||||
ObjCBlockIndentWidth: 2
|
||||
ObjCSpaceAfterProperty: false
|
||||
ObjCSpaceBeforeProtocolList: true
|
@ -25,14 +25,16 @@
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
// TODO(tkchin): remove this in favor of having objc headers mirror their C++ counterparts.
|
||||
// TODO(tkchin): see if we can move C++ enums into their own file so we can avoid all this
|
||||
// conversion code.
|
||||
#import "RTCTypes.h"
|
||||
|
||||
#include "talk/app/webrtc/peerconnectioninterface.h"
|
||||
#import "talk/app/webrtc/objc/RTCPeerConnectionInterface+Internal.h"
|
||||
|
||||
@interface RTCEnumConverter : NSObject
|
||||
|
||||
// TODO(tkchin): rename these.
|
||||
+ (RTCICEConnectionState)convertIceConnectionStateToObjC:
|
||||
(webrtc::PeerConnectionInterface::IceConnectionState)nativeState;
|
||||
|
||||
@ -54,4 +56,28 @@
|
||||
+ (RTCTrackState)convertTrackStateToObjC:
|
||||
(webrtc::MediaStreamTrackInterface::TrackState)nativeState;
|
||||
|
||||
+ (RTCIceTransportsType)iceTransportsTypeForNativeEnum:
|
||||
(webrtc::PeerConnectionInterface::IceTransportsType)nativeEnum;
|
||||
|
||||
+ (webrtc::PeerConnectionInterface::IceTransportsType)nativeEnumForIceTransportsType:
|
||||
(RTCIceTransportsType)iceTransportsType;
|
||||
|
||||
+ (RTCBundlePolicy)bundlePolicyForNativeEnum:
|
||||
(webrtc::PeerConnectionInterface::BundlePolicy)nativeEnum;
|
||||
|
||||
+ (webrtc::PeerConnectionInterface::BundlePolicy)nativeEnumForBundlePolicy:
|
||||
(RTCBundlePolicy)bundlePolicy;
|
||||
|
||||
+ (RTCRtcpMuxPolicy)rtcpMuxPolicyForNativeEnum:
|
||||
(webrtc::PeerConnectionInterface::RtcpMuxPolicy)nativeEnum;
|
||||
|
||||
+ (webrtc::PeerConnectionInterface::RtcpMuxPolicy)nativeEnumForRtcpMuxPolicy:
|
||||
(RTCRtcpMuxPolicy)rtcpMuxPolicy;
|
||||
|
||||
+ (RTCTcpCandidatePolicy)tcpCandidatePolicyForNativeEnum:
|
||||
(webrtc::PeerConnectionInterface::TcpCandidatePolicy)nativeEnum;
|
||||
|
||||
+ (webrtc::PeerConnectionInterface::TcpCandidatePolicy)nativeEnumForTcpCandidatePolicy:
|
||||
(RTCTcpCandidatePolicy)tcpCandidatePolicy;
|
||||
|
||||
@end
|
||||
|
@ -133,4 +133,96 @@
|
||||
}
|
||||
}
|
||||
|
||||
+ (RTCIceTransportsType)iceTransportsTypeForNativeEnum:
|
||||
(webrtc::PeerConnectionInterface::IceTransportsType)nativeEnum {
|
||||
switch (nativeEnum) {
|
||||
case webrtc::PeerConnectionInterface::kNone:
|
||||
return kRTCIceTransportsTypeNone;
|
||||
case webrtc::PeerConnectionInterface::kRelay:
|
||||
return kRTCIceTransportsTypeRelay;
|
||||
case webrtc::PeerConnectionInterface::kNoHost:
|
||||
return kRTCIceTransportsTypeNoHost;
|
||||
case webrtc::PeerConnectionInterface::kAll:
|
||||
return kRTCIceTransportsTypeAll;
|
||||
}
|
||||
}
|
||||
|
||||
+ (webrtc::PeerConnectionInterface::IceTransportsType)nativeEnumForIceTransportsType:
|
||||
(RTCIceTransportsType)iceTransportsType {
|
||||
switch (iceTransportsType) {
|
||||
case kRTCIceTransportsTypeNone:
|
||||
return webrtc::PeerConnectionInterface::kNone;
|
||||
case kRTCIceTransportsTypeRelay:
|
||||
return webrtc::PeerConnectionInterface::kRelay;
|
||||
case kRTCIceTransportsTypeNoHost:
|
||||
return webrtc::PeerConnectionInterface::kNoHost;
|
||||
case kRTCIceTransportsTypeAll:
|
||||
return webrtc::PeerConnectionInterface::kAll;
|
||||
}
|
||||
}
|
||||
|
||||
+ (RTCBundlePolicy)bundlePolicyForNativeEnum:
|
||||
(webrtc::PeerConnectionInterface::BundlePolicy)nativeEnum {
|
||||
switch (nativeEnum) {
|
||||
case webrtc::PeerConnectionInterface::kBundlePolicyBalanced:
|
||||
return kRTCBundlePolicyBalanced;
|
||||
case webrtc::PeerConnectionInterface::kBundlePolicyMaxBundle:
|
||||
return kRTCBundlePolicyMaxBundle;
|
||||
case webrtc::PeerConnectionInterface::kBundlePolicyMaxCompat:
|
||||
return kRTCBundlePolicyMaxCompat;
|
||||
}
|
||||
}
|
||||
|
||||
+ (webrtc::PeerConnectionInterface::BundlePolicy)nativeEnumForBundlePolicy:
|
||||
(RTCBundlePolicy)bundlePolicy {
|
||||
switch (bundlePolicy) {
|
||||
case kRTCBundlePolicyBalanced:
|
||||
return webrtc::PeerConnectionInterface::kBundlePolicyBalanced;
|
||||
case kRTCBundlePolicyMaxBundle:
|
||||
return webrtc::PeerConnectionInterface::kBundlePolicyMaxBundle;
|
||||
case kRTCBundlePolicyMaxCompat:
|
||||
return webrtc::PeerConnectionInterface::kBundlePolicyMaxCompat;
|
||||
}
|
||||
}
|
||||
|
||||
+ (RTCRtcpMuxPolicy)rtcpMuxPolicyForNativeEnum:
|
||||
(webrtc::PeerConnectionInterface::RtcpMuxPolicy)nativeEnum {
|
||||
switch (nativeEnum) {
|
||||
case webrtc::PeerConnectionInterface::kRtcpMuxPolicyNegotiate:
|
||||
return kRTCRtcpMuxPolicyNegotiate;
|
||||
case webrtc::PeerConnectionInterface::kRtcpMuxPolicyRequire:
|
||||
return kRTCRtcpMuxPolicyRequire;
|
||||
}
|
||||
}
|
||||
|
||||
+ (webrtc::PeerConnectionInterface::RtcpMuxPolicy)nativeEnumForRtcpMuxPolicy:
|
||||
(RTCRtcpMuxPolicy)rtcpMuxPolicy {
|
||||
switch (rtcpMuxPolicy) {
|
||||
case kRTCRtcpMuxPolicyNegotiate:
|
||||
return webrtc::PeerConnectionInterface::kRtcpMuxPolicyNegotiate;
|
||||
case kRTCRtcpMuxPolicyRequire:
|
||||
return webrtc::PeerConnectionInterface::kRtcpMuxPolicyRequire;
|
||||
}
|
||||
}
|
||||
|
||||
+ (RTCTcpCandidatePolicy)tcpCandidatePolicyForNativeEnum:
|
||||
(webrtc::PeerConnectionInterface::TcpCandidatePolicy)nativeEnum {
|
||||
switch (nativeEnum) {
|
||||
case webrtc::PeerConnectionInterface::kTcpCandidatePolicyEnabled:
|
||||
return kRTCTcpCandidatePolicyEnabled;
|
||||
case webrtc::PeerConnectionInterface::kTcpCandidatePolicyDisabled:
|
||||
return kRTCTcpCandidatePolicyDisabled;
|
||||
}
|
||||
}
|
||||
|
||||
+ (webrtc::PeerConnectionInterface::TcpCandidatePolicy)nativeEnumForTcpCandidatePolicy:
|
||||
(RTCTcpCandidatePolicy)tcpCandidatePolicy {
|
||||
switch (tcpCandidatePolicy) {
|
||||
case kRTCTcpCandidatePolicyEnabled:
|
||||
return webrtc::PeerConnectionInterface::kTcpCandidatePolicyEnabled;
|
||||
case kRTCTcpCandidatePolicyDisabled:
|
||||
return webrtc::PeerConnectionInterface::kTcpCandidatePolicyDisabled;
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
||||
|
@ -36,8 +36,13 @@
|
||||
@property(nonatomic, assign, readonly)
|
||||
rtc::scoped_refptr<webrtc::PeerConnectionInterface> peerConnection;
|
||||
|
||||
- (instancetype)initWithFactory:(webrtc::PeerConnectionFactoryInterface*)factory
|
||||
iceServers:(const webrtc::PeerConnectionInterface::IceServers&)iceServers
|
||||
constraints:(const webrtc::MediaConstraintsInterface*)constraints;
|
||||
- (instancetype)initWithFactory:(webrtc::PeerConnectionFactoryInterface *)factory
|
||||
iceServers:(const webrtc::PeerConnectionInterface::IceServers &)iceServers
|
||||
constraints:(const webrtc::MediaConstraintsInterface *)constraints;
|
||||
|
||||
- (instancetype)initWithFactory:(webrtc::PeerConnectionFactoryInterface *)factory
|
||||
config:(const webrtc::PeerConnectionInterface::RTCConfiguration &)config
|
||||
constraints:(const webrtc::MediaConstraintsInterface *)constraints
|
||||
delegate:(id<RTCPeerConnectionDelegate>)delegate;
|
||||
|
||||
@end
|
||||
|
@ -285,6 +285,21 @@ class RTCStatsObserver : public StatsObserver {
|
||||
return self;
|
||||
}
|
||||
|
||||
- (instancetype)initWithFactory:(webrtc::PeerConnectionFactoryInterface *)factory
|
||||
config:(const webrtc::PeerConnectionInterface::RTCConfiguration &)config
|
||||
constraints:(const webrtc::MediaConstraintsInterface *)constraints
|
||||
delegate:(id<RTCPeerConnectionDelegate>)delegate {
|
||||
NSParameterAssert(factory);
|
||||
if (self = [super init]) {
|
||||
_observer.reset(new webrtc::RTCPeerConnectionObserver(self));
|
||||
_peerConnection =
|
||||
factory->CreatePeerConnection(config, constraints, nullptr, nullptr, _observer.get());
|
||||
_localStreams = [[NSMutableArray alloc] init];
|
||||
_delegate = delegate;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (rtc::scoped_refptr<webrtc::PeerConnectionInterface>)peerConnection {
|
||||
return _peerConnection;
|
||||
}
|
||||
|
@ -41,6 +41,7 @@
|
||||
#import "RTCMediaStreamTrack+Internal.h"
|
||||
#import "RTCPeerConnection+Internal.h"
|
||||
#import "RTCPeerConnectionDelegate.h"
|
||||
#import "RTCPeerConnectionInterface+Internal.h"
|
||||
#import "RTCVideoCapturer+Internal.h"
|
||||
#import "RTCVideoSource+Internal.h"
|
||||
#import "RTCVideoTrack+Internal.h"
|
||||
@ -88,6 +89,15 @@
|
||||
return self;
|
||||
}
|
||||
|
||||
- (RTCPeerConnection *)peerConnectionWithConfiguration:(RTCConfiguration *)configuration
|
||||
constraints:(RTCMediaConstraints *)constraints
|
||||
delegate:(id<RTCPeerConnectionDelegate>)delegate {
|
||||
return [[RTCPeerConnection alloc] initWithFactory:self.nativeFactory.get()
|
||||
config:configuration.nativeConfiguration
|
||||
constraints:constraints.constraints
|
||||
delegate:delegate];
|
||||
}
|
||||
|
||||
- (RTCPeerConnection*)
|
||||
peerConnectionWithICEServers:(NSArray*)servers
|
||||
constraints:(RTCMediaConstraints*)constraints
|
||||
|
37
talk/app/webrtc/objc/RTCPeerConnectionInterface+Internal.h
Normal file
37
talk/app/webrtc/objc/RTCPeerConnectionInterface+Internal.h
Normal file
@ -0,0 +1,37 @@
|
||||
/*
|
||||
* libjingle
|
||||
* Copyright 2015 Google Inc.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
* 3. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
|
||||
* EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#import "talk/app/webrtc/objc/public/RTCPeerConnectionInterface.h"
|
||||
|
||||
#include "talk/app/webrtc/peerconnectioninterface.h"
|
||||
|
||||
@interface RTCConfiguration ()
|
||||
|
||||
@property(nonatomic, readonly)
|
||||
webrtc::PeerConnectionInterface::RTCConfiguration nativeConfiguration;
|
||||
|
||||
@end
|
87
talk/app/webrtc/objc/RTCPeerConnectionInterface.mm
Normal file
87
talk/app/webrtc/objc/RTCPeerConnectionInterface.mm
Normal file
@ -0,0 +1,87 @@
|
||||
/*
|
||||
* libjingle
|
||||
* Copyright 2015 Google Inc.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
* 3. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
|
||||
* EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#import "talk/app/webrtc/objc/RTCPeerConnectionInterface+Internal.h"
|
||||
|
||||
#import "talk/app/webrtc/objc/RTCEnumConverter.h"
|
||||
#import "talk/app/webrtc/objc/RTCICEServer+Internal.h"
|
||||
|
||||
@implementation RTCConfiguration
|
||||
|
||||
@synthesize iceTransportsType = _iceTransportsType;
|
||||
@synthesize iceServers = _iceServers;
|
||||
@synthesize bundlePolicy = _bundlePolicy;
|
||||
@synthesize rtcpMuxPolicy = _rtcpMuxPolicy;
|
||||
@synthesize tcpCandidatePolicy = _tcpCandidatePolicy;
|
||||
@synthesize audioJitterBufferMaxPackets = _audioJitterBufferMaxPackets;
|
||||
|
||||
- (instancetype)init {
|
||||
if (self = [super init]) {
|
||||
// Copy defaults.
|
||||
webrtc::PeerConnectionInterface::RTCConfiguration config;
|
||||
_iceTransportsType = [RTCEnumConverter iceTransportsTypeForNativeEnum:config.type];
|
||||
_bundlePolicy = [RTCEnumConverter bundlePolicyForNativeEnum:config.bundle_policy];
|
||||
_rtcpMuxPolicy = [RTCEnumConverter rtcpMuxPolicyForNativeEnum:config.rtcp_mux_policy];
|
||||
_tcpCandidatePolicy =
|
||||
[RTCEnumConverter tcpCandidatePolicyForNativeEnum:config.tcp_candidate_policy];
|
||||
_audioJitterBufferMaxPackets = config.audio_jitter_buffer_max_packets;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (instancetype)initWithIceTransportsType:(RTCIceTransportsType)iceTransportsType
|
||||
bundlePolicy:(RTCBundlePolicy)bundlePolicy
|
||||
rtcpMuxPolicy:(RTCRtcpMuxPolicy)rtcpMuxPolicy
|
||||
tcpCandidatePolicy:(RTCTcpCandidatePolicy)tcpCandidatePolicy
|
||||
audioJitterBufferMaxPackets:(int)audioJitterBufferMaxPackets {
|
||||
if (self = [super init]) {
|
||||
_iceTransportsType = iceTransportsType;
|
||||
_bundlePolicy = bundlePolicy;
|
||||
_rtcpMuxPolicy = rtcpMuxPolicy;
|
||||
_tcpCandidatePolicy = tcpCandidatePolicy;
|
||||
_audioJitterBufferMaxPackets = audioJitterBufferMaxPackets;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
#pragma mark - Private
|
||||
|
||||
- (webrtc::PeerConnectionInterface::RTCConfiguration)nativeConfiguration {
|
||||
webrtc::PeerConnectionInterface::RTCConfiguration nativeConfig;
|
||||
nativeConfig.type = [RTCEnumConverter nativeEnumForIceTransportsType:_iceTransportsType];
|
||||
for (RTCICEServer *iceServer : _iceServers) {
|
||||
nativeConfig.servers.push_back(iceServer.iceServer);
|
||||
}
|
||||
nativeConfig.bundle_policy = [RTCEnumConverter nativeEnumForBundlePolicy:_bundlePolicy];
|
||||
nativeConfig.rtcp_mux_policy = [RTCEnumConverter nativeEnumForRtcpMuxPolicy:_rtcpMuxPolicy];
|
||||
nativeConfig.tcp_candidate_policy =
|
||||
[RTCEnumConverter nativeEnumForTcpCandidatePolicy:_tcpCandidatePolicy];
|
||||
nativeConfig.audio_jitter_buffer_max_packets = _audioJitterBufferMaxPackets;
|
||||
return nativeConfig;
|
||||
}
|
||||
|
||||
@end
|
@ -28,6 +28,7 @@
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
@class RTCAudioTrack;
|
||||
@class RTCConfiguration;
|
||||
@class RTCMediaConstraints;
|
||||
@class RTCMediaStream;
|
||||
@class RTCPeerConnection;
|
||||
@ -44,7 +45,7 @@
|
||||
+ (void)initializeSSL;
|
||||
+ (void)deinitializeSSL;
|
||||
|
||||
// Create an RTCPeerConnection object. RTCPeerConnectionFactory will create
|
||||
// Create an RTCPeerConnection object. RTCPeerConnectionFactory will create
|
||||
// required libjingle threads, socket and network manager factory classes for
|
||||
// networking.
|
||||
- (RTCPeerConnection *)
|
||||
@ -52,6 +53,11 @@
|
||||
constraints:(RTCMediaConstraints *)constraints
|
||||
delegate:(id<RTCPeerConnectionDelegate>)delegate;
|
||||
|
||||
// Creates a peer connection using the default port allocator factory and identity service.
|
||||
- (RTCPeerConnection *)peerConnectionWithConfiguration:(RTCConfiguration *)configuration
|
||||
constraints:(RTCMediaConstraints *)constraints
|
||||
delegate:(id<RTCPeerConnectionDelegate>)delegate;
|
||||
|
||||
// Create an RTCMediaStream named |label|.
|
||||
- (RTCMediaStream *)mediaStreamWithLabel:(NSString *)label;
|
||||
|
||||
|
73
talk/app/webrtc/objc/public/RTCPeerConnectionInterface.h
Normal file
73
talk/app/webrtc/objc/public/RTCPeerConnectionInterface.h
Normal file
@ -0,0 +1,73 @@
|
||||
/*
|
||||
* libjingle
|
||||
* Copyright 2015 Google Inc.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
* 3. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
|
||||
* EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
// See talk/app/webrtc/peerconnectioninterface.h.
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
typedef NS_ENUM(NSInteger, RTCIceTransportsType) {
|
||||
kRTCIceTransportsTypeNone,
|
||||
kRTCIceTransportsTypeRelay,
|
||||
kRTCIceTransportsTypeNoHost,
|
||||
kRTCIceTransportsTypeAll,
|
||||
};
|
||||
|
||||
// https://tools.ietf.org/html/draft-ietf-rtcweb-jsep-08#section-4.1.1
|
||||
typedef NS_ENUM(NSInteger, RTCBundlePolicy) {
|
||||
kRTCBundlePolicyBalanced,
|
||||
kRTCBundlePolicyMaxBundle,
|
||||
kRTCBundlePolicyMaxCompat,
|
||||
};
|
||||
|
||||
// https://tools.ietf.org/html/draft-ietf-rtcweb-jsep-09#section-4.1.1
|
||||
typedef NS_ENUM(NSInteger, RTCRtcpMuxPolicy) {
|
||||
kRTCRtcpMuxPolicyNegotiate,
|
||||
kRTCRtcpMuxPolicyRequire,
|
||||
};
|
||||
|
||||
typedef NS_ENUM(NSInteger, RTCTcpCandidatePolicy) {
|
||||
kRTCTcpCandidatePolicyEnabled,
|
||||
kRTCTcpCandidatePolicyDisabled,
|
||||
};
|
||||
|
||||
// Configuration object used for creating a peer connection.
|
||||
@interface RTCConfiguration : NSObject
|
||||
|
||||
@property(nonatomic, assign) RTCIceTransportsType iceTransportsType;
|
||||
@property(nonatomic, copy) NSArray *iceServers;
|
||||
@property(nonatomic, assign) RTCBundlePolicy bundlePolicy;
|
||||
@property(nonatomic, assign) RTCRtcpMuxPolicy rtcpMuxPolicy;
|
||||
@property(nonatomic, assign) RTCTcpCandidatePolicy tcpCandidatePolicy;
|
||||
@property(nonatomic, assign) int audioJitterBufferMaxPackets;
|
||||
|
||||
- (instancetype)initWithIceTransportsType:(RTCIceTransportsType)iceTransportsType
|
||||
bundlePolicy:(RTCBundlePolicy)bundlePolicy
|
||||
rtcpMuxPolicy:(RTCRtcpMuxPolicy)rtcpMuxPolicy
|
||||
tcpCandidatePolicy:(RTCTcpCandidatePolicy)tcpCandidatePolicy
|
||||
audioJitterBufferMaxPackets:(int)audioJitterBufferMaxPackets;
|
||||
|
||||
@end
|
@ -34,6 +34,7 @@
|
||||
#import "RTCMediaConstraints.h"
|
||||
#import "RTCMediaStream.h"
|
||||
#import "RTCPair.h"
|
||||
#import "RTCPeerConnectionInterface.h"
|
||||
#import "RTCVideoCapturer.h"
|
||||
#import "RTCAVFoundationVideoSource.h"
|
||||
|
||||
@ -397,9 +398,11 @@ static NSInteger const kARDAppClientErrorInvalidRoom = -6;
|
||||
|
||||
// Create peer connection.
|
||||
RTCMediaConstraints *constraints = [self defaultPeerConnectionConstraints];
|
||||
_peerConnection = [_factory peerConnectionWithICEServers:_iceServers
|
||||
constraints:constraints
|
||||
delegate:self];
|
||||
RTCConfiguration *config = [[RTCConfiguration alloc] init];
|
||||
config.iceServers = _iceServers;
|
||||
_peerConnection = [_factory peerConnectionWithConfiguration:config
|
||||
constraints:constraints
|
||||
delegate:self];
|
||||
// Create AV media stream and add it to the peer connection.
|
||||
RTCMediaStream *localStream = [self createLocalMediaStream];
|
||||
[_peerConnection addStream:localStream];
|
||||
|
@ -28,8 +28,6 @@
|
||||
<string>AppRTCDemo</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>APPL</string>
|
||||
<key>CFBundleResourceSpecification</key>
|
||||
<string>ResourceRules.plist</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.0</string>
|
||||
<key>CFBundleSignature</key>
|
||||
|
@ -257,6 +257,8 @@
|
||||
'app/webrtc/objc/RTCPeerConnection+Internal.h',
|
||||
'app/webrtc/objc/RTCPeerConnection.mm',
|
||||
'app/webrtc/objc/RTCPeerConnectionFactory.mm',
|
||||
'app/webrtc/objc/RTCPeerConnectionInterface+Internal.h',
|
||||
'app/webrtc/objc/RTCPeerConnectionInterface.mm',
|
||||
'app/webrtc/objc/RTCPeerConnectionObserver.h',
|
||||
'app/webrtc/objc/RTCPeerConnectionObserver.mm',
|
||||
'app/webrtc/objc/RTCSessionDescription+Internal.h',
|
||||
@ -286,6 +288,7 @@
|
||||
'app/webrtc/objc/public/RTCPeerConnection.h',
|
||||
'app/webrtc/objc/public/RTCPeerConnectionDelegate.h',
|
||||
'app/webrtc/objc/public/RTCPeerConnectionFactory.h',
|
||||
'app/webrtc/objc/public/RTCPeerConnectionInterface.h',
|
||||
'app/webrtc/objc/public/RTCSessionDescription.h',
|
||||
'app/webrtc/objc/public/RTCSessionDescriptionDelegate.h',
|
||||
'app/webrtc/objc/public/RTCStatsDelegate.h',
|
||||
|
Loading…
Reference in New Issue
Block a user