Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 Use RTCPeerConnectionOptions with peer configuration for creating transport objects #126

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions mediasoup-client-ios.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@
35F7268023A3261C009BCD7F /* RTCUtils.h in Headers */ = {isa = PBXBuildFile; fileRef = 35F7267F23A3261C009BCD7F /* RTCUtils.h */; settings = {ATTRIBUTES = (Public, ); }; };
35FB2488238B9E400092EBCB /* ProducerWrapper.h in Headers */ = {isa = PBXBuildFile; fileRef = 35FB2487238B870E0092EBCB /* ProducerWrapper.h */; settings = {ATTRIBUTES = (Public, ); }; };
35FB2489238B9E470092EBCB /* TransportWrapper.h in Headers */ = {isa = PBXBuildFile; fileRef = 35FB2486238B823F0092EBCB /* TransportWrapper.h */; settings = {ATTRIBUTES = (Public, ); }; };
F0CE98BB2879F301002B2644 /* RTCPeerConnectionOptions.h in Headers */ = {isa = PBXBuildFile; fileRef = F0CE98BA2879F301002B2644 /* RTCPeerConnectionOptions.h */; };
F0CE98BD2879F320002B2644 /* RTCPeerConnectionOptions.m in Sources */ = {isa = PBXBuildFile; fileRef = F0CE98BC2879F320002B2644 /* RTCPeerConnectionOptions.m */; };
/* End PBXBuildFile section */

/* Begin PBXFileReference section */
Expand Down Expand Up @@ -106,6 +108,8 @@
35FB2487238B870E0092EBCB /* ProducerWrapper.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ProducerWrapper.h; sourceTree = "<group>"; };
35FB248B238BA8920092EBCB /* ConsumerWrapper.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ConsumerWrapper.h; sourceTree = "<group>"; };
35FB248C238BA8C00092EBCB /* DeviceWrapper.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DeviceWrapper.h; sourceTree = "<group>"; };
F0CE98BA2879F301002B2644 /* RTCPeerConnectionOptions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RTCPeerConnectionOptions.h; sourceTree = "<group>"; };
F0CE98BC2879F320002B2644 /* RTCPeerConnectionOptions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RTCPeerConnectionOptions.m; sourceTree = "<group>"; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
Expand Down Expand Up @@ -220,6 +224,7 @@
isa = PBXGroup;
children = (
35F7267F23A3261C009BCD7F /* RTCUtils.h */,
F0CE98BA2879F301002B2644 /* RTCPeerConnectionOptions.h */,
350559B323A8C9AD00576D83 /* wrapper */,
3570311923977E0F00761AF5 /* MediasoupLogger.h */,
35D7427D2390B71500C22679 /* MediasoupDevice.h */,
Expand All @@ -236,6 +241,7 @@
35F7267C23A325DC009BCD7F /* webrtc */ = {
isa = PBXGroup;
children = (
F0CE98BC2879F320002B2644 /* RTCPeerConnectionOptions.m */,
35F7267D23A3260A009BCD7F /* RTCUtils.m */,
);
path = webrtc;
Expand All @@ -249,6 +255,7 @@
buildActionMask = 2147483647;
files = (
35FB2489238B9E470092EBCB /* TransportWrapper.h in Headers */,
F0CE98BB2879F301002B2644 /* RTCPeerConnectionOptions.h in Headers */,
35FB2488238B9E400092EBCB /* ProducerWrapper.h in Headers */,
35D762DE238CBA2E0033D7AD /* DeviceWrapper.h in Headers */,
3538C5532397A8AA007EB078 /* MediasoupDevice.h in Headers */,
Expand Down Expand Up @@ -372,6 +379,7 @@
35F7267E23A3260A009BCD7F /* RTCUtils.m in Sources */,
355C612A2387702600986297 /* ConsumerWrapper.mm in Sources */,
3538C55A2397AE5C007EB078 /* DeviceWrapper.mm in Sources */,
F0CE98BD2879F320002B2644 /* RTCPeerConnectionOptions.m in Sources */,
351A83382394C11C00BA7A13 /* Producer.mm in Sources */,
3570311623977BFC00761AF5 /* LoggerWrapper.mm in Sources */,
351A83402394DE3A00BA7A13 /* SendTransport.mm in Sources */,
Expand Down
4 changes: 2 additions & 2 deletions mediasoup-client-ios/include/MediasoupDevice.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
@param appData Custom application data
@return SendTransport
*/
-(SendTransport *)createSendTransport:(id<SendTransportListener>)listener id:(NSString *)id iceParameters:(NSString *)iceParameters iceCandidates:(NSString *)iceCandidates dtlsParameters:(NSString *)dtlsParameters sctpParameters:(NSString *)sctpParameters options:(RTCPeerConnectionFactoryOptions *)options appData:(NSString *)appData;
-(SendTransport *)createSendTransport:(id<SendTransportListener>)listener id:(NSString *)id iceParameters:(NSString *)iceParameters iceCandidates:(NSString *)iceCandidates dtlsParameters:(NSString *)dtlsParameters sctpParameters:(NSString *)sctpParameters options:(RTCPeerConnectionOptions *)options appData:(NSString *)appData;
/*!
@brief Creates a new WebRTC transport to <b>receive</b> media
@discussion The transport must be previously created in the mediasoup router
Expand All @@ -95,7 +95,7 @@
@param appData Custom application data
@return RecvTransport
*/
-(RecvTransport *)createRecvTransport:(id<RecvTransportListener>)listener id:(NSString *)id iceParameters:(NSString *)iceParameters iceCandidates:(NSString *)iceCandidates dtlsParameters:(NSString *)dtlsParameters sctpParameters:(NSString *)sctpParameters options:(RTCPeerConnectionFactoryOptions *)options appData:(NSString *)appData;
-(RecvTransport *)createRecvTransport:(id<RecvTransportListener>)listener id:(NSString *)id iceParameters:(NSString *)iceParameters iceCandidates:(NSString *)iceCandidates dtlsParameters:(NSString *)dtlsParameters sctpParameters:(NSString *)sctpParameters options:(RTCPeerConnectionOptions *)options appData:(NSString *)appData;
@end

#endif /* Device_h */
18 changes: 18 additions & 0 deletions mediasoup-client-ios/include/RTCPeerConnectionOptions.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
//
// RTCPeerConnectionOptions.h
// mediasoup-client-ios
//
// Created by Bojan Bozovic on 7/6/22.
// Copyright © 2022 Denvir Ethan. All rights reserved.
//

#import <Foundation/Foundation.h>
#import <WebRTC/RTCConfiguration.h>

NS_ASSUME_NONNULL_BEGIN

@interface RTCPeerConnectionOptions : NSObject
@property(nonatomic, strong) RTCConfiguration *config;
@end

NS_ASSUME_NONNULL_END
5 changes: 3 additions & 2 deletions mediasoup-client-ios/include/wrapper/DeviceWrapper.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#import "Device.hpp"
#import "SendTransport.h"
#import "RecvTransport.h"
#import "RTCPeerConnectionOptions.h"

#ifndef DeviceWrapper_h
#define DeviceWrapper_h
Expand All @@ -23,8 +24,8 @@
+(NSString *)nativeGetRtpCapabilities:(NSValue *)nativeDevice;
+(NSString *)nativeGetSctpCapabilities:(NSValue *)nativeDevice;
+(bool)nativeCanProduce:(NSValue *)nativeDevice kind:(NSString *)kind;
+(NSValue *)nativeCreateSendTransport:(NSValue *)nativeDevice listener:(id<SendTransportListener>)listener id:(NSString *)id iceParameters:(NSString *)iceParameters iceCandidates:(NSString *)iceCandidates dtlsParameters:(NSString *)dtlsParameters sctpParameters:(NSString *)sctpParameters options:(RTCPeerConnectionFactoryOptions *)options appData:(NSString *)appData;
+(NSValue *)nativeCreateRecvTransport:(NSValue *)nativeDevice listener:(id<RecvTransportListener>)listener id:(NSString *)id iceParameters:(NSString *)iceParameters iceCandidates:(NSString *)iceCandidates dtlsParameters:(NSString *)dtlsParameters sctpParameters: (NSString *)sctpParameters options:(RTCPeerConnectionFactoryOptions *)options appData:(NSString *)appData;
+(NSValue *)nativeCreateSendTransport:(NSValue *)nativeDevice listener:(id<SendTransportListener>)listener id:(NSString *)id iceParameters:(NSString *)iceParameters iceCandidates:(NSString *)iceCandidates dtlsParameters:(NSString *)dtlsParameters sctpParameters:(NSString *)sctpParameters options:(RTCPeerConnectionOptions *)options appData:(NSString *)appData;
+(NSValue *)nativeCreateRecvTransport:(NSValue *)nativeDevice listener:(id<RecvTransportListener>)listener id:(NSString *)id iceParameters:(NSString *)iceParameters iceCandidates:(NSString *)iceCandidates dtlsParameters:(NSString *)dtlsParameters sctpParameters: (NSString *)sctpParameters options:(RTCPeerConnectionOptions *)options appData:(NSString *)appData;
@end

#endif /* DeviceWrapper_h */
4 changes: 2 additions & 2 deletions mediasoup-client-ios/src/C++Wrapper/DeviceWrapper.mm
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ +(bool)nativeCanProduce:(NSValue *)nativeDevice kind:(NSString *)kind {
}
}

+(NSValue *)nativeCreateSendTransport:(NSValue *)nativeDevice listener:(id<SendTransportListener>)listener id:(NSString *)id iceParameters:(NSString *)iceParameters iceCandidates:(NSString *)iceCandidates dtlsParameters:(NSString *)dtlsParameters sctpParameters:(NSString *)sctpParameters options:(RTCPeerConnectionFactoryOptions *)options appData:(NSString *)appData {
+(NSValue *)nativeCreateSendTransport:(NSValue *)nativeDevice listener:(id<SendTransportListener>)listener id:(NSString *)id iceParameters:(NSString *)iceParameters iceCandidates:(NSString *)iceCandidates dtlsParameters:(NSString *)dtlsParameters sctpParameters:(NSString *)sctpParameters options:(RTCPeerConnectionOptions *)options appData:(NSString *)appData {
MSC_TRACE();

try {
Expand Down Expand Up @@ -142,7 +142,7 @@ +(NSValue *)nativeCreateSendTransport:(NSValue *)nativeDevice listener:(id<SendT
return nullptr;
}

+(NSValue *)nativeCreateRecvTransport:(NSValue *)nativeDevice listener:(id<RecvTransportListener>)listener id:(NSString *)id iceParameters:(NSString *)iceParameters iceCandidates:(NSString *)iceCandidates dtlsParameters:(NSString *)dtlsParameters sctpParameters:(NSString *)sctpParameters options:(RTCPeerConnectionFactoryOptions *)options appData:(NSString *)appData {
+(NSValue *)nativeCreateRecvTransport:(NSValue *)nativeDevice listener:(id<RecvTransportListener>)listener id:(NSString *)id iceParameters:(NSString *)iceParameters iceCandidates:(NSString *)iceCandidates dtlsParameters:(NSString *)dtlsParameters sctpParameters:(NSString *)sctpParameters options:(RTCPeerConnectionOptions *)options appData:(NSString *)appData {
MSC_TRACE();

try {
Expand Down
4 changes: 2 additions & 2 deletions mediasoup-client-ios/src/MediasoupDevice.mm
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ -(SendTransport *)createSendTransport:(id<SendTransportListener>)listener id:(NS
return [self createSendTransport:listener id:id iceParameters:iceParameters iceCandidates:iceCandidates dtlsParameters:dtlsParameters sctpParameters:nil options:nil appData:nil];
}

-(SendTransport *)createSendTransport:(id<SendTransportListener>)listener id:(NSString *)id iceParameters:(NSString *)iceParameters iceCandidates:(NSString *)iceCandidates dtlsParameters:(NSString *)dtlsParameters sctpParameters:(NSString *)sctpParameters options:(RTCPeerConnectionFactoryOptions *)options appData:(NSString *)appData {
-(SendTransport *)createSendTransport:(id<SendTransportListener>)listener id:(NSString *)id iceParameters:(NSString *)iceParameters iceCandidates:(NSString *)iceCandidates dtlsParameters:(NSString *)dtlsParameters sctpParameters:(NSString *)sctpParameters options:(RTCPeerConnectionOptions *)options appData:(NSString *)appData {
[self checkDeviceExists];

NSObject *transport = [DeviceWrapper nativeCreateSendTransport:self.nativeDevice listener:listener id:id iceParameters:iceParameters iceCandidates:iceCandidates dtlsParameters:dtlsParameters sctpParameters:sctpParameters options:options appData:appData];
Expand All @@ -77,7 +77,7 @@ -(RecvTransport *)createRecvTransport:(id<RecvTransportListener>)listener id:(NS
return [self createRecvTransport:listener id:id iceParameters:iceParameters iceCandidates:iceCandidates dtlsParameters:dtlsParameters sctpParameters:nil options:nil appData:nil];
}

-(RecvTransport *)createRecvTransport:(id<RecvTransportListener>)listener id:(NSString *)id iceParameters:(NSString *)iceParameters iceCandidates:(NSString *)iceCandidates dtlsParameters:(NSString *)dtlsParameters sctpParameters:(NSString *)sctpParameters options:(RTCPeerConnectionFactoryOptions *)options appData:(NSString *)appData {
-(RecvTransport *)createRecvTransport:(id<RecvTransportListener>)listener id:(NSString *)id iceParameters:(NSString *)iceParameters iceCandidates:(NSString *)iceCandidates dtlsParameters:(NSString *)dtlsParameters sctpParameters:(NSString *)sctpParameters options:(RTCPeerConnectionOptions *)options appData:(NSString *)appData {
[self checkDeviceExists];

NSObject *transport = [DeviceWrapper nativeCreateRecvTransport:self.nativeDevice listener:listener id:id iceParameters:iceParameters iceCandidates:iceCandidates dtlsParameters:dtlsParameters sctpParameters:sctpParameters options:options appData:appData];
Expand Down
21 changes: 21 additions & 0 deletions mediasoup-client-ios/src/webrtc/RTCPeerConnectionOptions.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
//
// RTCPeerConnectionOptions.m
// mediasoup-client-ios
//
// Created by Bojan Bozovic on 7/6/22.
// Copyright © 2022 Denvir Ethan. All rights reserved.
//

#import "RTCPeerConnectionOptions.h"

@implementation RTCPeerConnectionOptions

-(instancetype)initWith:(RTConfiguration *)config {
self = [super init];
if (self) {
self.config = config;
}
return self;
}

@end