Skip to content

Commit 4440c2a

Browse files
hiroshihorieipavlidakis
authored andcommitted
Prefix enums with RTC_OBJC_TYPE macro (#171)
Continued from webrtc-sdk/webrtc#100 also prefix enums. I think this shouldn't break compiling.
1 parent e69ebe3 commit 4440c2a

File tree

117 files changed

+1036
-1035
lines changed

Some content is hidden

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

117 files changed

+1036
-1035
lines changed

sdk/objc/api/logging/RTCCallbackLogger.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,15 @@ NS_ASSUME_NONNULL_BEGIN
1717

1818
typedef void (^RTCCallbackLoggerMessageHandler)(NSString *message);
1919
typedef void (^RTCCallbackLoggerMessageAndSeverityHandler)(NSString *message,
20-
RTCLoggingSeverity severity);
20+
RTC_OBJC_TYPE(RTCLoggingSeverity) severity);
2121

2222
// This class intercepts WebRTC logs and forwards them to a registered block.
2323
// This class is not threadsafe.
2424
RTC_OBJC_EXPORT
2525
@interface RTC_OBJC_TYPE (RTCCallbackLogger) : NSObject
2626

2727
// The severity level to capture. The default is kRTCLoggingSeverityInfo.
28-
@property(nonatomic, assign) RTCLoggingSeverity severity;
28+
@property(nonatomic, assign) RTC_OBJC_TYPE(RTCLoggingSeverity) severity;
2929

3030
// The callback handler will be called on the same thread that does the
3131
// logging, so if the logging callback can be slow it may be a good idea

sdk/objc/api/logging/RTCCallbackLogger.mm

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -53,24 +53,24 @@ void OnLogMessage(const std::string& message, rtc::LoggingSeverity severity) ove
5353

5454
void OnLogMessage(absl::string_view message, rtc::LoggingSeverity severity) override {
5555
if (callback_handler_) {
56-
RTCLoggingSeverity loggingSeverity = NativeSeverityToObjcSeverity(severity);
56+
RTC_OBJC_TYPE(RTCLoggingSeverity) loggingSeverity = NativeSeverityToObjcSeverity(severity);
5757
callback_handler_([NSString stringForAbslStringView:message], loggingSeverity);
5858
}
5959
}
6060

6161
private:
62-
static RTCLoggingSeverity NativeSeverityToObjcSeverity(rtc::LoggingSeverity severity) {
62+
static RTC_OBJC_TYPE(RTCLoggingSeverity) NativeSeverityToObjcSeverity(rtc::LoggingSeverity severity) {
6363
switch (severity) {
6464
case rtc::LS_VERBOSE:
65-
return RTCLoggingSeverityVerbose;
65+
return RTC_OBJC_TYPE(RTCLoggingSeverityVerbose);
6666
case rtc::LS_INFO:
67-
return RTCLoggingSeverityInfo;
67+
return RTC_OBJC_TYPE(RTCLoggingSeverityInfo);
6868
case rtc::LS_WARNING:
69-
return RTCLoggingSeverityWarning;
69+
return RTC_OBJC_TYPE(RTCLoggingSeverityWarning);
7070
case rtc::LS_ERROR:
71-
return RTCLoggingSeverityError;
71+
return RTC_OBJC_TYPE(RTCLoggingSeverityError);
7272
case rtc::LS_NONE:
73-
return RTCLoggingSeverityNone;
73+
return RTC_OBJC_TYPE(RTCLoggingSeverityNone);
7474
}
7575
}
7676

@@ -89,7 +89,7 @@ @implementation RTC_OBJC_TYPE (RTCCallbackLogger) {
8989
- (instancetype)init {
9090
self = [super init];
9191
if (self != nil) {
92-
_severity = RTCLoggingSeverityInfo;
92+
_severity = RTC_OBJC_TYPE(RTCLoggingSeverityInfo);
9393
}
9494
return self;
9595
}
@@ -135,15 +135,15 @@ - (void)stop {
135135

136136
- (rtc::LoggingSeverity)rtcSeverity {
137137
switch (_severity) {
138-
case RTCLoggingSeverityVerbose:
138+
case RTC_OBJC_TYPE(RTCLoggingSeverityVerbose):
139139
return rtc::LS_VERBOSE;
140-
case RTCLoggingSeverityInfo:
140+
case RTC_OBJC_TYPE(RTCLoggingSeverityInfo):
141141
return rtc::LS_INFO;
142-
case RTCLoggingSeverityWarning:
142+
case RTC_OBJC_TYPE(RTCLoggingSeverityWarning):
143143
return rtc::LS_WARNING;
144-
case RTCLoggingSeverityError:
144+
case RTC_OBJC_TYPE(RTCLoggingSeverityError):
145145
return rtc::LS_ERROR;
146-
case RTCLoggingSeverityNone:
146+
case RTC_OBJC_TYPE(RTCLoggingSeverityNone):
147147
return rtc::LS_NONE;
148148
}
149149
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,6 @@
2929

3030
- (instancetype)initWithFactory:(RTC_OBJC_TYPE(RTCPeerConnectionFactory) *)factory
3131
nativeMediaSource:(rtc::scoped_refptr<webrtc::MediaSourceInterface>)nativeMediaSource
32-
type:(RTCMediaSourceType)type NS_UNAVAILABLE;
32+
type:(RTC_OBJC_TYPE(RTCMediaSourceType))type NS_UNAVAILABLE;
3333

3434
@end

sdk/objc/api/peerconnection/RTCAudioSource.mm

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,15 @@ - (instancetype)initWithFactory:(RTC_OBJC_TYPE(RTCPeerConnectionFactory) *)facto
2626

2727
if (self = [super initWithFactory:factory
2828
nativeMediaSource:nativeAudioSource
29-
type:RTCMediaSourceTypeAudio]) {
29+
type:RTC_OBJC_TYPE(RTCMediaSourceTypeAudio)]) {
3030
_nativeAudioSource = nativeAudioSource;
3131
}
3232
return self;
3333
}
3434

3535
- (instancetype)initWithFactory:(RTC_OBJC_TYPE(RTCPeerConnectionFactory) *)factory
3636
nativeMediaSource:(rtc::scoped_refptr<webrtc::MediaSourceInterface>)nativeMediaSource
37-
type:(RTCMediaSourceType)type {
37+
type:(RTC_OBJC_TYPE(RTCMediaSourceType))type {
3838
RTC_DCHECK_NOTREACHED();
3939
return nil;
4040
}

sdk/objc/api/peerconnection/RTCAudioTrack.mm

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ - (instancetype)initWithFactory:(RTC_OBJC_TYPE(RTCPeerConnectionFactory) *)facto
3939
std::string nativeId = [NSString stdStringForString:trackId];
4040
rtc::scoped_refptr<webrtc::AudioTrackInterface> track =
4141
factory.nativeFactory->CreateAudioTrack(nativeId, source.nativeAudioSource.get());
42-
if (self = [self initWithFactory:factory nativeTrack:track type:RTCMediaStreamTrackTypeAudio]) {
42+
if (self = [self initWithFactory:factory nativeTrack:track type:RTC_OBJC_TYPE(RTCMediaStreamTrackTypeAudio)]) {
4343
_source = source;
4444
}
4545

@@ -48,10 +48,10 @@ - (instancetype)initWithFactory:(RTC_OBJC_TYPE(RTCPeerConnectionFactory) *)facto
4848

4949
- (instancetype)initWithFactory:(RTC_OBJC_TYPE(RTCPeerConnectionFactory) *)factory
5050
nativeTrack:(rtc::scoped_refptr<webrtc::MediaStreamTrackInterface>)nativeTrack
51-
type:(RTCMediaStreamTrackType)type {
51+
type:(RTC_OBJC_TYPE(RTCMediaStreamTrackType))type {
5252
NSParameterAssert(factory);
5353
NSParameterAssert(nativeTrack);
54-
NSParameterAssert(type == RTCMediaStreamTrackTypeAudio);
54+
NSParameterAssert(type == RTC_OBJC_TYPE(RTCMediaStreamTrackTypeAudio));
5555
if (self = [super initWithFactory:factory nativeTrack:nativeTrack type:type]) {
5656
_adapters = [NSMutableArray array];
5757
_signalingThread = factory.signalingThread;

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

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -18,52 +18,52 @@ NS_ASSUME_NONNULL_BEGIN
1818
()
1919

2020
+ (webrtc::PeerConnectionInterface::IceTransportsType)nativeTransportsTypeForTransportPolicy
21-
: (RTCIceTransportPolicy)policy;
21+
: (RTC_OBJC_TYPE(RTCIceTransportPolicy))policy;
2222

23-
+ (RTCIceTransportPolicy)transportPolicyForTransportsType:
23+
+ (RTC_OBJC_TYPE(RTCIceTransportPolicy))transportPolicyForTransportsType:
2424
(webrtc::PeerConnectionInterface::IceTransportsType)nativeType;
2525

26-
+ (NSString *)stringForTransportPolicy:(RTCIceTransportPolicy)policy;
26+
+ (NSString *)stringForTransportPolicy:(RTC_OBJC_TYPE(RTCIceTransportPolicy))policy;
2727

2828
+ (webrtc::PeerConnectionInterface::BundlePolicy)nativeBundlePolicyForPolicy:
29-
(RTCBundlePolicy)policy;
29+
(RTC_OBJC_TYPE(RTCBundlePolicy))policy;
3030

31-
+ (RTCBundlePolicy)bundlePolicyForNativePolicy:
31+
+ (RTC_OBJC_TYPE(RTCBundlePolicy))bundlePolicyForNativePolicy:
3232
(webrtc::PeerConnectionInterface::BundlePolicy)nativePolicy;
3333

34-
+ (NSString *)stringForBundlePolicy:(RTCBundlePolicy)policy;
34+
+ (NSString *)stringForBundlePolicy:(RTC_OBJC_TYPE(RTCBundlePolicy))policy;
3535

3636
+ (webrtc::PeerConnectionInterface::RtcpMuxPolicy)nativeRtcpMuxPolicyForPolicy:
37-
(RTCRtcpMuxPolicy)policy;
37+
(RTC_OBJC_TYPE(RTCRtcpMuxPolicy))policy;
3838

39-
+ (RTCRtcpMuxPolicy)rtcpMuxPolicyForNativePolicy:
39+
+ (RTC_OBJC_TYPE(RTCRtcpMuxPolicy))rtcpMuxPolicyForNativePolicy:
4040
(webrtc::PeerConnectionInterface::RtcpMuxPolicy)nativePolicy;
4141

42-
+ (NSString *)stringForRtcpMuxPolicy:(RTCRtcpMuxPolicy)policy;
42+
+ (NSString *)stringForRtcpMuxPolicy:(RTC_OBJC_TYPE(RTCRtcpMuxPolicy))policy;
4343

4444
+ (webrtc::PeerConnectionInterface::TcpCandidatePolicy)nativeTcpCandidatePolicyForPolicy:
45-
(RTCTcpCandidatePolicy)policy;
45+
(RTC_OBJC_TYPE(RTCTcpCandidatePolicy))policy;
4646

47-
+ (RTCTcpCandidatePolicy)tcpCandidatePolicyForNativePolicy:
47+
+ (RTC_OBJC_TYPE(RTCTcpCandidatePolicy))tcpCandidatePolicyForNativePolicy:
4848
(webrtc::PeerConnectionInterface::TcpCandidatePolicy)nativePolicy;
4949

50-
+ (NSString *)stringForTcpCandidatePolicy:(RTCTcpCandidatePolicy)policy;
50+
+ (NSString *)stringForTcpCandidatePolicy:(RTC_OBJC_TYPE(RTCTcpCandidatePolicy))policy;
5151

5252
+ (webrtc::PeerConnectionInterface::CandidateNetworkPolicy)nativeCandidateNetworkPolicyForPolicy:
53-
(RTCCandidateNetworkPolicy)policy;
53+
(RTC_OBJC_TYPE(RTCCandidateNetworkPolicy))policy;
5454

55-
+ (RTCCandidateNetworkPolicy)candidateNetworkPolicyForNativePolicy:
55+
+ (RTC_OBJC_TYPE(RTCCandidateNetworkPolicy))candidateNetworkPolicyForNativePolicy:
5656
(webrtc::PeerConnectionInterface::CandidateNetworkPolicy)nativePolicy;
5757

58-
+ (NSString *)stringForCandidateNetworkPolicy:(RTCCandidateNetworkPolicy)policy;
58+
+ (NSString *)stringForCandidateNetworkPolicy:(RTC_OBJC_TYPE(RTCCandidateNetworkPolicy))policy;
5959

60-
+ (rtc::KeyType)nativeEncryptionKeyTypeForKeyType:(RTCEncryptionKeyType)keyType;
60+
+ (rtc::KeyType)nativeEncryptionKeyTypeForKeyType:(RTC_OBJC_TYPE(RTCEncryptionKeyType))keyType;
6161

62-
+ (webrtc::SdpSemantics)nativeSdpSemanticsForSdpSemantics:(RTCSdpSemantics)sdpSemantics;
62+
+ (webrtc::SdpSemantics)nativeSdpSemanticsForSdpSemantics:(RTC_OBJC_TYPE(RTCSdpSemantics))sdpSemantics;
6363

64-
+ (RTCSdpSemantics)sdpSemanticsForNativeSdpSemantics:(webrtc::SdpSemantics)sdpSemantics;
64+
+ (RTC_OBJC_TYPE(RTCSdpSemantics))sdpSemanticsForNativeSdpSemantics:(webrtc::SdpSemantics)sdpSemantics;
6565

66-
+ (NSString *)stringForSdpSemantics:(RTCSdpSemantics)sdpSemantics;
66+
+ (NSString *)stringForSdpSemantics:(RTC_OBJC_TYPE(RTCSdpSemantics))sdpSemantics;
6767

6868
/**
6969
* RTCConfiguration struct representation of this RTCConfiguration.

sdk/objc/api/peerconnection/RTCConfiguration.h

Lines changed: 36 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -20,52 +20,55 @@
2020
* Represents the ice transport policy. This exposes the same states in C++,
2121
* which include one more state than what exists in the W3C spec.
2222
*/
23-
typedef NS_ENUM(NSInteger, RTCIceTransportPolicy) {
24-
RTCIceTransportPolicyNone,
25-
RTCIceTransportPolicyRelay,
26-
RTCIceTransportPolicyNoHost,
27-
RTCIceTransportPolicyAll
23+
typedef NS_ENUM(NSInteger, RTC_OBJC_TYPE(RTCIceTransportPolicy)) {
24+
RTC_OBJC_TYPE(RTCIceTransportPolicyNone),
25+
RTC_OBJC_TYPE(RTCIceTransportPolicyRelay),
26+
RTC_OBJC_TYPE(RTCIceTransportPolicyNoHost),
27+
RTC_OBJC_TYPE(RTCIceTransportPolicyAll)
2828
};
2929

3030
/** Represents the bundle policy. */
31-
typedef NS_ENUM(NSInteger, RTCBundlePolicy) {
32-
RTCBundlePolicyBalanced,
33-
RTCBundlePolicyMaxCompat,
34-
RTCBundlePolicyMaxBundle
31+
typedef NS_ENUM(NSInteger, RTC_OBJC_TYPE(RTCBundlePolicy)) {
32+
RTC_OBJC_TYPE(RTCBundlePolicyBalanced),
33+
RTC_OBJC_TYPE(RTCBundlePolicyMaxCompat),
34+
RTC_OBJC_TYPE(RTCBundlePolicyMaxBundle)
3535
};
3636

3737
/** Represents the rtcp mux policy. */
38-
typedef NS_ENUM(NSInteger, RTCRtcpMuxPolicy) { RTCRtcpMuxPolicyNegotiate, RTCRtcpMuxPolicyRequire };
38+
typedef NS_ENUM(NSInteger, RTC_OBJC_TYPE(RTCRtcpMuxPolicy)) {
39+
RTC_OBJC_TYPE(RTCRtcpMuxPolicyNegotiate),
40+
RTC_OBJC_TYPE(RTCRtcpMuxPolicyRequire)
41+
};
3942

4043
/** Represents the tcp candidate policy. */
41-
typedef NS_ENUM(NSInteger, RTCTcpCandidatePolicy) {
42-
RTCTcpCandidatePolicyEnabled,
43-
RTCTcpCandidatePolicyDisabled
44+
typedef NS_ENUM(NSInteger, RTC_OBJC_TYPE(RTCTcpCandidatePolicy)) {
45+
RTC_OBJC_TYPE(RTCTcpCandidatePolicyEnabled),
46+
RTC_OBJC_TYPE(RTCTcpCandidatePolicyDisabled)
4447
};
4548

4649
/** Represents the candidate network policy. */
47-
typedef NS_ENUM(NSInteger, RTCCandidateNetworkPolicy) {
48-
RTCCandidateNetworkPolicyAll,
49-
RTCCandidateNetworkPolicyLowCost
50+
typedef NS_ENUM(NSInteger, RTC_OBJC_TYPE(RTCCandidateNetworkPolicy)) {
51+
RTC_OBJC_TYPE(RTCCandidateNetworkPolicyAll),
52+
RTC_OBJC_TYPE(RTCCandidateNetworkPolicyLowCost)
5053
};
5154

5255
/** Represents the continual gathering policy. */
53-
typedef NS_ENUM(NSInteger, RTCContinualGatheringPolicy) {
54-
RTCContinualGatheringPolicyGatherOnce,
55-
RTCContinualGatheringPolicyGatherContinually
56+
typedef NS_ENUM(NSInteger, RTC_OBJC_TYPE(RTCContinualGatheringPolicy)) {
57+
RTC_OBJC_TYPE(RTCContinualGatheringPolicyGatherOnce),
58+
RTC_OBJC_TYPE(RTCContinualGatheringPolicyGatherContinually)
5659
};
5760

5861
/** Represents the encryption key type. */
59-
typedef NS_ENUM(NSInteger, RTCEncryptionKeyType) {
60-
RTCEncryptionKeyTypeRSA,
61-
RTCEncryptionKeyTypeECDSA,
62+
typedef NS_ENUM(NSInteger, RTC_OBJC_TYPE(RTCEncryptionKeyType)) {
63+
RTC_OBJC_TYPE(RTCEncryptionKeyTypeRSA),
64+
RTC_OBJC_TYPE(RTCEncryptionKeyTypeECDSA),
6265
};
6366

6467
/** Represents the chosen SDP semantics for the RTCPeerConnection. */
65-
typedef NS_ENUM(NSInteger, RTCSdpSemantics) {
68+
typedef NS_ENUM(NSInteger, RTC_OBJC_TYPE(RTCSdpSemantics)) {
6669
// TODO(https://crbug.com/webrtc/13528): Remove support for Plan B.
67-
RTCSdpSemanticsPlanB,
68-
RTCSdpSemanticsUnifiedPlan,
70+
RTC_OBJC_TYPE(RTCSdpSemanticsPlanB),
71+
RTC_OBJC_TYPE(RTCSdpSemanticsUnifiedPlan),
6972
};
7073

7174
NS_ASSUME_NONNULL_BEGIN
@@ -86,16 +89,16 @@ RTC_OBJC_EXPORT
8689

8790
/** Which candidates the ICE agent is allowed to use. The W3C calls it
8891
* `iceTransportPolicy`, while in C++ it is called `type`. */
89-
@property(nonatomic, assign) RTCIceTransportPolicy iceTransportPolicy;
92+
@property(nonatomic, assign) RTC_OBJC_TYPE(RTCIceTransportPolicy) iceTransportPolicy;
9093

9194
/** The media-bundling policy to use when gathering ICE candidates. */
92-
@property(nonatomic, assign) RTCBundlePolicy bundlePolicy;
95+
@property(nonatomic, assign) RTC_OBJC_TYPE(RTCBundlePolicy) bundlePolicy;
9396

9497
/** The rtcp-mux policy to use when gathering ICE candidates. */
95-
@property(nonatomic, assign) RTCRtcpMuxPolicy rtcpMuxPolicy;
96-
@property(nonatomic, assign) RTCTcpCandidatePolicy tcpCandidatePolicy;
97-
@property(nonatomic, assign) RTCCandidateNetworkPolicy candidateNetworkPolicy;
98-
@property(nonatomic, assign) RTCContinualGatheringPolicy continualGatheringPolicy;
98+
@property(nonatomic, assign) RTC_OBJC_TYPE(RTCRtcpMuxPolicy) rtcpMuxPolicy;
99+
@property(nonatomic, assign) RTC_OBJC_TYPE(RTCTcpCandidatePolicy) tcpCandidatePolicy;
100+
@property(nonatomic, assign) RTC_OBJC_TYPE(RTCCandidateNetworkPolicy) candidateNetworkPolicy;
101+
@property(nonatomic, assign) RTC_OBJC_TYPE(RTCContinualGatheringPolicy) continualGatheringPolicy;
99102

100103
/** If set to YES, don't gather IPv6 ICE candidates on Wi-Fi.
101104
* Only intended to be used on specific devices. Certain phones disable IPv6
@@ -125,7 +128,7 @@ RTC_OBJC_EXPORT
125128
@property(nonatomic, assign) int iceBackupCandidatePairPingInterval;
126129

127130
/** Key type used to generate SSL identity. Default is ECDSA. */
128-
@property(nonatomic, assign) RTCEncryptionKeyType keyType;
131+
@property(nonatomic, assign) RTC_OBJC_TYPE(RTCEncryptionKeyType) keyType;
129132

130133
/** ICE candidate pool size as defined in JSEP. Default is 0. */
131134
@property(nonatomic, assign) int iceCandidatePoolSize;
@@ -176,7 +179,7 @@ RTC_OBJC_EXPORT
176179
* the section. This will also cause RTCPeerConnection to ignore all but the
177180
* first m= section of the same media type.
178181
*/
179-
@property(nonatomic, assign) RTCSdpSemantics sdpSemantics;
182+
@property(nonatomic, assign) RTC_OBJC_TYPE(RTCSdpSemantics) sdpSemantics;
180183

181184
/** Actively reset the SRTP parameters when the DTLS transports underneath are
182185
* changed after offer/answer negotiation. This is only intended to be a

0 commit comments

Comments
 (0)