Skip to content

Commit d5afc4b

Browse files
authored
Fix missing RTC_OBJC_TYPE macros (#100)
* RTCVideoRendererAdapter * RTCDisplayLinkTimer * RTCNetworkMonitor * RTCMTLVideoView * RTCMTLRGBRenderer * progress * fix * ObjCAudioDeviceDelegate * remaining types * fix macos * revert prefix * prefix string references * fix RTCMTLVideoView symbols
1 parent fcab26b commit d5afc4b

File tree

77 files changed

+247
-242
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

77 files changed

+247
-242
lines changed

sdk/BUILD.gn

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -385,7 +385,12 @@ if (is_ios || is_mac) {
385385
"objc/components/network/RTCNetworkMonitor.mm",
386386
]
387387

388-
configs += [ ":used_from_extension" ]
388+
configs += [
389+
"..:common_objc",
390+
":used_from_extension",
391+
]
392+
393+
public_configs = [ ":common_config_objc" ]
389394

390395
frameworks = [ "Network.framework" ]
391396

sdk/objc/api/RTCVideoRendererAdapter+Private.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
NS_ASSUME_NONNULL_BEGIN
1818

19-
@interface RTCVideoRendererAdapter ()
19+
@interface RTC_OBJC_TYPE(RTCVideoRendererAdapter) ()
2020

2121
/**
2222
* The Objective-C video renderer passed to this adapter during construction.

sdk/objc/api/RTCVideoRendererAdapter.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010

1111
#import <Foundation/Foundation.h>
1212

13+
#import "RTCMacros.h"
14+
1315
NS_ASSUME_NONNULL_BEGIN
1416

1517
/*
@@ -18,7 +20,7 @@ NS_ASSUME_NONNULL_BEGIN
1820
* adapter adapts calls made to that interface to the RTCVideoRenderer supplied
1921
* during construction.
2022
*/
21-
@interface RTCVideoRendererAdapter : NSObject
23+
@interface RTC_OBJC_TYPE (RTCVideoRendererAdapter): NSObject
2224

2325
- (instancetype)init NS_UNAVAILABLE;
2426

sdk/objc/api/RTCVideoRendererAdapter.mm

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,20 +17,19 @@
1717

1818
namespace webrtc {
1919

20-
class VideoRendererAdapter
21-
: public rtc::VideoSinkInterface<webrtc::VideoFrame> {
20+
class VideoRendererAdapter : public rtc::VideoSinkInterface<webrtc::VideoFrame> {
2221
public:
23-
VideoRendererAdapter(RTCVideoRendererAdapter* adapter) {
22+
VideoRendererAdapter(RTC_OBJC_TYPE(RTCVideoRendererAdapter) * adapter) {
2423
adapter_ = adapter;
2524
size_ = CGSizeZero;
2625
}
2726

2827
void OnFrame(const webrtc::VideoFrame& nativeVideoFrame) override {
2928
RTC_OBJC_TYPE(RTCVideoFrame)* videoFrame = NativeToObjCVideoFrame(nativeVideoFrame);
3029

31-
CGSize current_size = (videoFrame.rotation % 180 == 0)
32-
? CGSizeMake(videoFrame.width, videoFrame.height)
33-
: CGSizeMake(videoFrame.height, videoFrame.width);
30+
CGSize current_size = (videoFrame.rotation % 180 == 0) ?
31+
CGSizeMake(videoFrame.width, videoFrame.height) :
32+
CGSizeMake(videoFrame.height, videoFrame.width);
3433

3534
if (!CGSizeEqualToSize(size_, current_size)) {
3635
size_ = current_size;
@@ -40,12 +39,12 @@ void OnFrame(const webrtc::VideoFrame& nativeVideoFrame) override {
4039
}
4140

4241
private:
43-
__weak RTCVideoRendererAdapter *adapter_;
42+
__weak RTC_OBJC_TYPE(RTCVideoRendererAdapter) * adapter_;
4443
CGSize size_;
4544
};
46-
}
45+
} // namespace webrtc
4746

48-
@implementation RTCVideoRendererAdapter {
47+
@implementation RTC_OBJC_TYPE (RTCVideoRendererAdapter) {
4948
std::unique_ptr<webrtc::VideoRendererAdapter> _adapter;
5049
}
5150

@@ -60,7 +59,7 @@ - (instancetype)initWithNativeRenderer:(id<RTC_OBJC_TYPE(RTCVideoRenderer)>)vide
6059
return self;
6160
}
6261

63-
- (rtc::VideoSinkInterface<webrtc::VideoFrame> *)nativeVideoRenderer {
62+
- (rtc::VideoSinkInterface<webrtc::VideoFrame>*)nativeVideoRenderer {
6463
return _adapter.get();
6564
}
6665

sdk/objc/api/peerconnection/RTCAudioDeviceModule+Private.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121

2222
NS_ASSUME_NONNULL_BEGIN
2323

24-
@interface RTCAudioDeviceModule ()
24+
@interface RTC_OBJC_TYPE(RTCAudioDeviceModule) ()
2525

2626
- (instancetype)initWithNativeModule:(rtc::scoped_refptr<webrtc::AudioDeviceModule> )module
2727
workerThread:(rtc::Thread *)workerThread;

sdk/objc/api/peerconnection/RTCAudioDeviceModule.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ RTC_OBJC_EXPORT
3939
// Executes low-level API's in sequence to switch the device
4040
// Use outputDevice / inputDevice property unless you need to know if setting the device is
4141
// successful.
42-
- (BOOL)trySetOutputDevice:(nullable RTCIODevice *)device;
43-
- (BOOL)trySetInputDevice:(nullable RTCIODevice *)device;
42+
- (BOOL)trySetOutputDevice:(nullable RTC_OBJC_TYPE(RTCIODevice) *)device;
43+
- (BOOL)trySetInputDevice:(nullable RTC_OBJC_TYPE(RTCIODevice) *)device;
4444

4545
- (BOOL)setDevicesUpdatedHandler: (nullable RTCOnAudioDevicesDidUpdate) handler;
4646

sdk/objc/api/peerconnection/RTCAudioDeviceModule.mm

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ - (instancetype)initWithNativeModule:(rtc::scoped_refptr<webrtc::AudioDeviceModu
7777
});
7878
}
7979

80-
- (RTCIODevice *)outputDevice {
80+
- (RTC_OBJC_TYPE(RTCIODevice) *)outputDevice {
8181
return _workerThread->BlockingCall([self] {
8282

8383
NSArray<RTC_OBJC_TYPE(RTCIODevice) *> *devices = [self _outputDevices];
@@ -92,11 +92,11 @@ - (RTCIODevice *)outputDevice {
9292
});
9393
}
9494

95-
- (void)setOutputDevice: (RTCIODevice *)device {
95+
- (void)setOutputDevice: (RTC_OBJC_TYPE(RTCIODevice) *)device {
9696
[self trySetOutputDevice: device];
9797
}
9898

99-
- (BOOL)trySetOutputDevice: (RTCIODevice *)device {
99+
- (BOOL)trySetOutputDevice: (RTC_OBJC_TYPE(RTCIODevice) *)device {
100100

101101
return _workerThread->BlockingCall([self, device] {
102102

@@ -108,7 +108,7 @@ - (BOOL)trySetOutputDevice: (RTCIODevice *)device {
108108
}
109109

110110
if (device != nil) {
111-
index = [devices indexOfObjectPassingTest:^BOOL(RTCIODevice *e, NSUInteger i, BOOL *stop) {
111+
index = [devices indexOfObjectPassingTest:^BOOL(RTC_OBJC_TYPE(RTCIODevice) *e, NSUInteger i, BOOL *stop) {
112112
return (*stop = [e.deviceId isEqualToString:device.deviceId]);
113113
}];
114114
if (index == NSNotFound) {
@@ -129,7 +129,7 @@ - (BOOL)trySetOutputDevice: (RTCIODevice *)device {
129129
});
130130
}
131131

132-
- (RTCIODevice *)inputDevice {
132+
- (RTC_OBJC_TYPE(RTCIODevice) *)inputDevice {
133133

134134
return _workerThread->BlockingCall([self] {
135135

@@ -145,11 +145,11 @@ - (RTCIODevice *)inputDevice {
145145
});
146146
}
147147

148-
- (void)setInputDevice: (RTCIODevice *)device {
148+
- (void)setInputDevice: (RTC_OBJC_TYPE(RTCIODevice) *)device {
149149
[self trySetInputDevice: device];
150150
}
151151

152-
- (BOOL)trySetInputDevice: (RTCIODevice *)device {
152+
- (BOOL)trySetInputDevice: (RTC_OBJC_TYPE(RTCIODevice) *)device {
153153

154154
return _workerThread->BlockingCall([self, device] {
155155

@@ -161,7 +161,7 @@ - (BOOL)trySetInputDevice: (RTCIODevice *)device {
161161
}
162162

163163
if (device != nil) {
164-
index = [devices indexOfObjectPassingTest:^BOOL(RTCIODevice *e, NSUInteger i, BOOL *stop) {
164+
index = [devices indexOfObjectPassingTest:^BOOL(RTC_OBJC_TYPE(RTCIODevice) *e, NSUInteger i, BOOL *stop) {
165165
return (*stop = [e.deviceId isEqualToString:device.deviceId]);
166166
}];
167167
if (index == NSNotFound) {
@@ -261,7 +261,7 @@ - (BOOL)setDevicesUpdatedHandler: (nullable RTCOnAudioDevicesDidUpdate) handler
261261
_native->PlayoutDeviceName(i, name, guid);
262262
NSString *strGUID = [[NSString alloc] initWithCString:guid encoding:NSUTF8StringEncoding];
263263
NSString *strName = [[NSString alloc] initWithCString:name encoding:NSUTF8StringEncoding];
264-
RTCIODevice *device = [[RTCIODevice alloc] initWithType:RTCIODeviceTypeOutput deviceId:strGUID name:strName];
264+
RTC_OBJC_TYPE(RTCIODevice) *device = [[RTC_OBJC_TYPE(RTCIODevice) alloc] initWithType:RTCIODeviceTypeOutput deviceId:strGUID name:strName];
265265
[result addObject: device];
266266
}
267267
}
@@ -283,7 +283,7 @@ - (BOOL)setDevicesUpdatedHandler: (nullable RTCOnAudioDevicesDidUpdate) handler
283283
_native->RecordingDeviceName(i, name, guid);
284284
NSString *strGUID = [[NSString alloc] initWithCString:guid encoding:NSUTF8StringEncoding];
285285
NSString *strName = [[NSString alloc] initWithCString:name encoding:NSUTF8StringEncoding];
286-
RTCIODevice *device = [[RTCIODevice alloc] initWithType:RTCIODeviceTypeInput deviceId:strGUID name:strName];
286+
RTC_OBJC_TYPE(RTCIODevice) *device = [[RTC_OBJC_TYPE(RTCIODevice) alloc] initWithType:RTCIODeviceTypeInput deviceId:strGUID name:strName];
287287
[result addObject: device];
288288
}
289289
}

sdk/objc/api/peerconnection/RTCAudioTrack.mm

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,12 @@
2828
class AudioSinkConverter : public rtc::RefCountInterface, public webrtc::AudioTrackSinkInterface {
2929
private:
3030
os_unfair_lock *lock_;
31-
__weak RTCAudioTrack *audio_track_;
31+
__weak RTC_OBJC_TYPE(RTCAudioTrack) *audio_track_;
3232
int64_t total_frames_ = 0;
3333
bool attached_ = false;
3434

3535
public:
36-
AudioSinkConverter(RTCAudioTrack *audioTrack, os_unfair_lock *lock) {
36+
AudioSinkConverter(RTC_OBJC_TYPE(RTCAudioTrack) *audioTrack, os_unfair_lock *lock) {
3737
RTC_LOG(LS_INFO) << "RTCAudioTrack.AudioSinkConverter init";
3838
audio_track_ = audioTrack;
3939
lock_ = lock;
@@ -274,7 +274,7 @@ - (void)didCaptureSampleBuffer:(CMSampleBufferRef)sampleBuffer {
274274
NSArray *renderers = [_renderers allObjects];
275275
os_unfair_lock_unlock(&_lock);
276276

277-
for (id<RTCAudioRenderer> renderer in renderers) {
277+
for (id<RTC_OBJC_TYPE(RTCAudioRenderer)> renderer in renderers) {
278278
[renderer renderSampleBuffer:sampleBuffer];
279279
}
280280
}

sdk/objc/api/peerconnection/RTCEncodedImage+Private.mm

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,16 +34,16 @@ explicit ObjCEncodedImageBuffer(NSData *data) : data_(data) {}
3434

3535
NSData *data_;
3636
};
37-
}
37+
} // namespace
3838

3939
// A simple wrapper around webrtc::EncodedImageBufferInterface to make it usable with associated
4040
// objects.
41-
@interface RTCWrappedEncodedImageBuffer : NSObject
41+
@interface RTC_OBJC_TYPE (RTCWrappedEncodedImageBuffer): NSObject
4242
@property(nonatomic) rtc::scoped_refptr<webrtc::EncodedImageBufferInterface> buffer;
4343
- (instancetype)initWithEncodedImageBuffer:
4444
(rtc::scoped_refptr<webrtc::EncodedImageBufferInterface>)buffer;
4545
@end
46-
@implementation RTCWrappedEncodedImageBuffer
46+
@implementation RTC_OBJC_TYPE (RTCWrappedEncodedImageBuffer)
4747
@synthesize buffer = _buffer;
4848
- (instancetype)initWithEncodedImageBuffer:
4949
(rtc::scoped_refptr<webrtc::EncodedImageBufferInterface>)buffer {
@@ -59,7 +59,7 @@ @implementation RTC_OBJC_TYPE (RTCEncodedImage)
5959
(Private)
6060

6161
- (rtc::scoped_refptr<webrtc::EncodedImageBufferInterface>)encodedData {
62-
RTCWrappedEncodedImageBuffer *wrappedBuffer =
62+
RTC_OBJC_TYPE(RTCWrappedEncodedImageBuffer) *wrappedBuffer =
6363
objc_getAssociatedObject(self, @selector(encodedData));
6464
return wrappedBuffer.buffer;
6565
}
@@ -68,7 +68,7 @@ - (void)setEncodedData:(rtc::scoped_refptr<webrtc::EncodedImageBufferInterface>)
6868
return objc_setAssociatedObject(
6969
self,
7070
@selector(encodedData),
71-
[[RTCWrappedEncodedImageBuffer alloc] initWithEncodedImageBuffer:buffer],
71+
[[RTC_OBJC_TYPE(RTCWrappedEncodedImageBuffer) alloc] initWithEncodedImageBuffer:buffer],
7272
OBJC_ASSOCIATION_RETAIN_NONATOMIC);
7373
}
7474

sdk/objc/api/peerconnection/RTCIODevice+Private.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
NS_ASSUME_NONNULL_BEGIN
1919

20-
@interface RTCIODevice ()
20+
@interface RTC_OBJC_TYPE(RTCIODevice) ()
2121

2222
- (instancetype)initWithType:(RTCIODeviceType)type
2323
deviceId:(NSString *)deviceId

0 commit comments

Comments
 (0)