Skip to content
Draft
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
4 changes: 2 additions & 2 deletions ios/RCTWebRTC/AudioDeviceModuleObserver.h
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#import <WebRTC/WebRTC.h>
#import <LiveKitWebRTC/LiveKitWebRTC.h>
#import "WebRTCModule.h"

NS_ASSUME_NONNULL_BEGIN

@interface AudioDeviceModuleObserver : NSObject<RTCAudioDeviceModuleDelegate>
@interface AudioDeviceModuleObserver : NSObject<LKRTCAudioDeviceModuleDelegate>

- (instancetype)initWithWebRTCModule:(WebRTCModule *)module;

Expand Down
26 changes: 13 additions & 13 deletions ios/RCTWebRTC/AudioDeviceModuleObserver.m
Original file line number Diff line number Diff line change
Expand Up @@ -146,11 +146,11 @@ - (NSInteger)sendEventAndWaitWithName:(NSString *)eventName
return resultBlock();
}

#pragma mark - RTCAudioDeviceModuleDelegate
#pragma mark - LKRTCAudioDeviceModuleDelegate

- (void)audioDeviceModule:(RTCAudioDeviceModule *)audioDeviceModule
didReceiveSpeechActivityEvent:(RTCSpeechActivityEvent)speechActivityEvent {
NSString *eventType = speechActivityEvent == RTCSpeechActivityEventStarted ? @"started" : @"ended";
- (void)audioDeviceModule:(LKRTCAudioDeviceModule *)audioDeviceModule
didReceiveSpeechActivityEvent:(LKRTCSpeechActivityEvent)speechActivityEvent {
NSString *eventType = speechActivityEvent == LKRTCSpeechActivityEventStarted ? @"started" : @"ended";

[self.module sendEventWithName:kEventAudioDeviceModuleSpeechActivity
body:@{
Expand All @@ -160,7 +160,7 @@ - (void)audioDeviceModule:(RTCAudioDeviceModule *)audioDeviceModule
RCTLog(@"[AudioDeviceModuleObserver] Speech activity event: %@", eventType);
}

- (NSInteger)audioDeviceModule:(RTCAudioDeviceModule *)audioDeviceModule didCreateEngine:(AVAudioEngine *)engine {
- (NSInteger)audioDeviceModule:(LKRTCAudioDeviceModule *)audioDeviceModule didCreateEngine:(AVAudioEngine *)engine {
BOOL isActive = self.isEngineCreatedActive;

if (isActive) {
Expand All @@ -181,7 +181,7 @@ - (NSInteger)audioDeviceModule:(RTCAudioDeviceModule *)audioDeviceModule didCrea
return result;
}

- (NSInteger)audioDeviceModule:(RTCAudioDeviceModule *)audioDeviceModule
- (NSInteger)audioDeviceModule:(LKRTCAudioDeviceModule *)audioDeviceModule
willEnableEngine:(AVAudioEngine *)engine
isPlayoutEnabled:(BOOL)isPlayoutEnabled
isRecordingEnabled:(BOOL)isRecordingEnabled {
Expand Down Expand Up @@ -214,7 +214,7 @@ - (NSInteger)audioDeviceModule:(RTCAudioDeviceModule *)audioDeviceModule
return result;
}

- (NSInteger)audioDeviceModule:(RTCAudioDeviceModule *)audioDeviceModule
- (NSInteger)audioDeviceModule:(LKRTCAudioDeviceModule *)audioDeviceModule
willStartEngine:(AVAudioEngine *)engine
isPlayoutEnabled:(BOOL)isPlayoutEnabled
isRecordingEnabled:(BOOL)isRecordingEnabled {
Expand Down Expand Up @@ -243,7 +243,7 @@ - (NSInteger)audioDeviceModule:(RTCAudioDeviceModule *)audioDeviceModule
return result;
}

- (NSInteger)audioDeviceModule:(RTCAudioDeviceModule *)audioDeviceModule
- (NSInteger)audioDeviceModule:(LKRTCAudioDeviceModule *)audioDeviceModule
didStopEngine:(AVAudioEngine *)engine
isPlayoutEnabled:(BOOL)isPlayoutEnabled
isRecordingEnabled:(BOOL)isRecordingEnabled {
Expand Down Expand Up @@ -272,7 +272,7 @@ - (NSInteger)audioDeviceModule:(RTCAudioDeviceModule *)audioDeviceModule
return result;
}

- (NSInteger)audioDeviceModule:(RTCAudioDeviceModule *)audioDeviceModule
- (NSInteger)audioDeviceModule:(LKRTCAudioDeviceModule *)audioDeviceModule
didDisableEngine:(AVAudioEngine *)engine
isPlayoutEnabled:(BOOL)isPlayoutEnabled
isRecordingEnabled:(BOOL)isRecordingEnabled {
Expand Down Expand Up @@ -301,7 +301,7 @@ - (NSInteger)audioDeviceModule:(RTCAudioDeviceModule *)audioDeviceModule
return result;
}

- (NSInteger)audioDeviceModule:(RTCAudioDeviceModule *)audioDeviceModule willReleaseEngine:(AVAudioEngine *)engine {
- (NSInteger)audioDeviceModule:(LKRTCAudioDeviceModule *)audioDeviceModule willReleaseEngine:(AVAudioEngine *)engine {
BOOL isActive = self.isWillReleaseEngineActive;

if (isActive) {
Expand All @@ -322,7 +322,7 @@ - (NSInteger)audioDeviceModule:(RTCAudioDeviceModule *)audioDeviceModule willRel
return result;
}

- (NSInteger)audioDeviceModule:(RTCAudioDeviceModule *)audioDeviceModule
- (NSInteger)audioDeviceModule:(LKRTCAudioDeviceModule *)audioDeviceModule
engine:(AVAudioEngine *)engine
configureInputFromSource:(nullable AVAudioNode *)source
toDestination:(AVAudioNode *)destination
Expand All @@ -332,7 +332,7 @@ - (NSInteger)audioDeviceModule:(RTCAudioDeviceModule *)audioDeviceModule
return 0;
}

- (NSInteger)audioDeviceModule:(RTCAudioDeviceModule *)audioDeviceModule
- (NSInteger)audioDeviceModule:(LKRTCAudioDeviceModule *)audioDeviceModule
engine:(AVAudioEngine *)engine
configureOutputFromSource:(AVAudioNode *)source
toDestination:(nullable AVAudioNode *)destination
Expand All @@ -342,7 +342,7 @@ - (NSInteger)audioDeviceModule:(RTCAudioDeviceModule *)audioDeviceModule
return 0;
}

- (void)audioDeviceModuleDidUpdateDevices:(RTCAudioDeviceModule *)audioDeviceModule {
- (void)audioDeviceModuleDidUpdateDevices:(LKRTCAudioDeviceModule *)audioDeviceModule {
[self.module sendEventWithName:kEventAudioDeviceModuleDevicesUpdated body:@{}];

RCTLog(@"[AudioDeviceModuleObserver] Devices updated");
Expand Down
4 changes: 2 additions & 2 deletions ios/RCTWebRTC/CapturerEventsDelegate.h
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
#import <WebRTC/RTCVideoCapturer.h>
#import <LiveKitWebRTC/RTCVideoCapturer.h>

NS_ASSUME_NONNULL_BEGIN

@protocol CapturerEventsDelegate

/** Called when the capturer is ended and in an irrecoverable state. */
- (void)capturerDidEnd:(RTCVideoCapturer *)capturer;
- (void)capturerDidEnd:(LKRTCVideoCapturer *)capturer;

@end

Expand Down
8 changes: 4 additions & 4 deletions ios/RCTWebRTC/DataChannelWrapper.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#import <Foundation/Foundation.h>
#import <WebRTC/RTCDataChannel.h>
#import <LiveKitWebRTC/RTCDataChannel.h>

NS_ASSUME_NONNULL_BEGIN

Expand All @@ -8,17 +8,17 @@ NS_ASSUME_NONNULL_BEGIN
@protocol DataChannelWrapperDelegate<NSObject>

- (void)dataChannelDidChangeState:(DataChannelWrapper *)dataChannelWrapper;
- (void)dataChannel:(DataChannelWrapper *)dataChannelWrapper didReceiveMessageWithBuffer:(RTCDataBuffer *)buffer;
- (void)dataChannel:(DataChannelWrapper *)dataChannelWrapper didReceiveMessageWithBuffer:(LKRTCDataBuffer *)buffer;
- (void)dataChannel:(DataChannelWrapper *)dataChannelWrapper didChangeBufferedAmount:(uint64_t)amount;

@end

@interface DataChannelWrapper : NSObject

- (instancetype)initWithChannel:(RTCDataChannel *)channel reactTag:(NSString *)tag;
- (instancetype)initWithChannel:(LKRTCDataChannel *)channel reactTag:(NSString *)tag;

@property(nonatomic, nonnull, copy) NSNumber *pcId;
@property(nonatomic, nonnull, readonly) RTCDataChannel *channel;
@property(nonatomic, nonnull, readonly) LKRTCDataChannel *channel;
@property(nonatomic, nonnull, readonly) NSString *reactTag;
@property(nonatomic, nullable, weak) id<DataChannelWrapperDelegate> delegate;

Expand Down
12 changes: 6 additions & 6 deletions ios/RCTWebRTC/DataChannelWrapper.m
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@

#import "DataChannelWrapper.h"

#import <WebRTC/RTCDataChannel.h>
#import <LiveKitWebRTC/RTCDataChannel.h>

@interface DataChannelWrapper ()<RTCDataChannelDelegate>
@interface DataChannelWrapper ()<LKRTCDataChannelDelegate>
@end

@implementation DataChannelWrapper

- (instancetype)initWithChannel:(RTCDataChannel *)channel reactTag:(NSString *)tag {
- (instancetype)initWithChannel:(LKRTCDataChannel *)channel reactTag:(NSString *)tag {
self = [super init];
if (self) {
_channel = channel;
Expand All @@ -21,19 +21,19 @@ - (instancetype)initWithChannel:(RTCDataChannel *)channel reactTag:(NSString *)t
return self;
}

- (void)dataChannel:(nonnull RTCDataChannel *)dataChannel didReceiveMessageWithBuffer:(nonnull RTCDataBuffer *)buffer {
- (void)dataChannel:(nonnull LKRTCDataChannel *)dataChannel didReceiveMessageWithBuffer:(nonnull LKRTCDataBuffer *)buffer {
if (_delegate) {
[_delegate dataChannel:self didReceiveMessageWithBuffer:buffer];
}
}

- (void)dataChannelDidChangeState:(nonnull RTCDataChannel *)dataChannel {
- (void)dataChannelDidChangeState:(nonnull LKRTCDataChannel *)dataChannel {
if (_delegate) {
[_delegate dataChannelDidChangeState:self];
}
}

- (void)dataChannel:(nonnull RTCDataChannel *)dataChannel didChangeBufferedAmount:(uint64_t)amount {
- (void)dataChannel:(nonnull LKRTCDataChannel *)dataChannel didChangeBufferedAmount:(uint64_t)amount {
if (_delegate) {
[_delegate dataChannel:self didChangeBufferedAmount:amount];
}
Expand Down
4 changes: 2 additions & 2 deletions ios/RCTWebRTC/I420Converter.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@

#import <Accelerate/Accelerate.h>
#import <UIKit/UIKit.h>
#import <WebRTC/WebRTC.h>
#import <LiveKitWebRTC/LiveKitWebRTC.h>

@interface I420Converter : NSObject

- (vImage_Error)prepareForAccelerateConversion;
- (void)unprepareForAccelerateConversion;
- (CVPixelBufferRef)convertI420ToPixelBuffer:(RTCI420Buffer *)buffer;
- (CVPixelBufferRef)convertI420ToPixelBuffer:(LKRTCI420Buffer *)buffer;
- (void)createPixelBufferPoolWithWidth:(size_t)width height:(size_t)height;

@end
4 changes: 2 additions & 2 deletions ios/RCTWebRTC/I420Converter.m
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ - (void)createPixelBufferPoolWithWidth:(size_t)width height:(size_t)height {
}
}

- (CVPixelBufferRef)convertI420ToPixelBuffer:(RTCI420Buffer *)buffer {
- (CVPixelBufferRef)convertI420ToPixelBuffer:(LKRTCI420Buffer *)buffer {
if (_conversionInfo == nil) {
NSLog(@"%@: not prepared", NSStringFromSelector(_cmd));
return NULL;
Expand Down Expand Up @@ -106,7 +106,7 @@ - (CVPixelBufferRef)convertI420ToPixelBuffer:(RTCI420Buffer *)buffer {
return pixelBuffer;
}

- (vImage_Error)convertFrameVImageYUV:(RTCI420Buffer *)buffer toBuffer:(CVPixelBufferRef)pixelBufferRef {
- (vImage_Error)convertFrameVImageYUV:(LKRTCI420Buffer *)buffer toBuffer:(CVPixelBufferRef)pixelBufferRef {
if (pixelBufferRef == NULL) {
return kvImageInvalidParameter;
}
Expand Down
4 changes: 2 additions & 2 deletions ios/RCTWebRTC/PIPController.h
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
#import <AVKit/AVKit.h>
#import <UIKit/UIKit.h>
#import <WebRTC/RTCVideoTrack.h>
#import <LiveKitWebRTC/RTCVideoTrack.h>

#import "RTCVideoViewManager.h"

API_AVAILABLE(ios(15.0))
@interface PIPController : NSObject<AVPictureInPictureControllerDelegate>

@property(nonatomic, weak) UIView *sourceView;
@property(nonatomic, strong) RTCVideoTrack *videoTrack;
@property(nonatomic, strong) LKRTCVideoTrack *videoTrack;

@property(nonatomic, assign) BOOL startAutomatically;
@property(nonatomic, assign) BOOL stopAutomatically;
Expand Down
2 changes: 1 addition & 1 deletion ios/RCTWebRTC/PIPController.m
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ - (void)addToCallViewController:(UIView *)view {
[NSLayoutConstraint activateConstraints:constraints];
}

- (void)setVideoTrack:(RTCVideoTrack *)videoTrack {
- (void)setVideoTrack:(LKRTCVideoTrack *)videoTrack {
if (_videoTrack != videoTrack) {
[_videoTrack removeRenderer:_sampleView];
}
Expand Down
20 changes: 10 additions & 10 deletions ios/RCTWebRTC/RCTConvert+WebRTC.h
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
#import <React/RCTConvert.h>
#import <WebRTC/RTCConfiguration.h>
#import <WebRTC/RTCDataChannelConfiguration.h>
#import <WebRTC/RTCIceCandidate.h>
#import <WebRTC/RTCIceServer.h>
#import <WebRTC/RTCSessionDescription.h>
#import <LiveKitWebRTC/RTCConfiguration.h>
#import <LiveKitWebRTC/RTCDataChannelConfiguration.h>
#import <LiveKitWebRTC/RTCIceCandidate.h>
#import <LiveKitWebRTC/RTCIceServer.h>
#import <LiveKitWebRTC/RTCSessionDescription.h>

@interface RCTConvert (WebRTC)

+ (RTCIceCandidate *)RTCIceCandidate:(id)json;
+ (RTCSessionDescription *)RTCSessionDescription:(id)json;
+ (RTCIceServer *)RTCIceServer:(id)json;
+ (RTCDataChannelConfiguration *)RTCDataChannelConfiguration:(id)json;
+ (RTCConfiguration *)RTCConfiguration:(id)json;
+ (LKRTCIceCandidate *)LKRTCIceCandidate:(id)json;
+ (LKRTCSessionDescription *)LKRTCSessionDescription:(id)json;
+ (LKRTCIceServer *)LKRTCIceServer:(id)json;
+ (LKRTCDataChannelConfiguration *)LKRTCDataChannelConfiguration:(id)json;
+ (LKRTCConfiguration *)LKRTCConfiguration:(id)json;

@end
Loading
Loading