Minor ObjC header updates.
BUG=
Review URL: https://codereview.webrtc.org/1845133002
Cr-Commit-Position: refs/heads/master@{#12183}
diff --git a/webrtc/api/objc/RTCAVFoundationVideoSource.h b/webrtc/api/objc/RTCAVFoundationVideoSource.h
index d7cdbef..6d224d3 100644
--- a/webrtc/api/objc/RTCAVFoundationVideoSource.h
+++ b/webrtc/api/objc/RTCAVFoundationVideoSource.h
@@ -38,5 +38,4 @@
@end
-
NS_ASSUME_NONNULL_END
diff --git a/webrtc/api/objc/RTCAudioTrack+Private.h b/webrtc/api/objc/RTCAudioTrack+Private.h
index bcedca6..ea86b1f 100644
--- a/webrtc/api/objc/RTCAudioTrack+Private.h
+++ b/webrtc/api/objc/RTCAudioTrack+Private.h
@@ -14,6 +14,7 @@
NS_ASSUME_NONNULL_BEGIN
+@class RTCPeerConnectionFactory;
@interface RTCAudioTrack ()
/** AudioTrackInterface created or passed in at construction. */
diff --git a/webrtc/api/objc/RTCAudioTrack.h b/webrtc/api/objc/RTCAudioTrack.h
index 284206e..c33a7b4 100644
--- a/webrtc/api/objc/RTCAudioTrack.h
+++ b/webrtc/api/objc/RTCAudioTrack.h
@@ -12,8 +12,6 @@
NS_ASSUME_NONNULL_BEGIN
-@class RTCPeerConnectionFactory;
-
@interface RTCAudioTrack : RTCMediaStreamTrack
- (instancetype)init NS_UNAVAILABLE;
diff --git a/webrtc/api/objc/RTCDataChannel.h b/webrtc/api/objc/RTCDataChannel.h
index 43f5767..59ab2b8 100644
--- a/webrtc/api/objc/RTCDataChannel.h
+++ b/webrtc/api/objc/RTCDataChannel.h
@@ -8,6 +8,7 @@
* be found in the AUTHORS file in the root of the source tree.
*/
+#import <AvailabilityMacros.h>
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
@@ -32,7 +33,6 @@
@class RTCDataChannel;
-
@protocol RTCDataChannelDelegate <NSObject>
/** The data channel state changed. */
@@ -43,7 +43,6 @@
didReceiveMessageWithBuffer:(RTCDataBuffer *)buffer;
@optional
-
/** The data channel's |bufferedAmount| changed. */
- (void)dataChannel:(RTCDataChannel *)dataChannel
didChangeBufferedAmount:(uint64_t)amount;
@@ -53,12 +52,13 @@
/** Represents the state of the data channel. */
typedef NS_ENUM(NSInteger, RTCDataChannelState) {
- RTCDataChannelStateConnecting,
- RTCDataChannelStateOpen,
- RTCDataChannelStateClosing,
- RTCDataChannelStateClosed,
+ RTCDataChannelStateConnecting,
+ RTCDataChannelStateOpen,
+ RTCDataChannelStateClosing,
+ RTCDataChannelStateClosed,
};
+
@interface RTCDataChannel : NSObject
/**
@@ -67,9 +67,16 @@
*/
@property(nonatomic, readonly) NSString *label;
+/** Whether the data channel can send messages in unreliable mode. */
+@property(nonatomic, readonly) BOOL isReliable DEPRECATED_ATTRIBUTE;
+
/** Returns whether this data channel is ordered or not. */
@property(nonatomic, readonly) BOOL isOrdered;
+/** Deprecated. Use maxPacketLifeTime. */
+@property(nonatomic, readonly) NSUInteger maxRetransmitTime
+ DEPRECATED_ATTRIBUTE;
+
/**
* The length of the time window (in milliseconds) during which transmissions
* and retransmissions may occur in unreliable mode.
@@ -92,6 +99,9 @@
*/
@property(nonatomic, readonly) BOOL isNegotiated;
+/** Deprecated. Use channelId. */
+@property(nonatomic, readonly) NSInteger streamId DEPRECATED_ATTRIBUTE;
+
/** The identifier for this data channel. */
@property(nonatomic, readonly) int channelId;
diff --git a/webrtc/api/objc/RTCDataChannel.mm b/webrtc/api/objc/RTCDataChannel.mm
index 4be3a22..a2c2e18 100644
--- a/webrtc/api/objc/RTCDataChannel.mm
+++ b/webrtc/api/objc/RTCDataChannel.mm
@@ -86,7 +86,7 @@
@implementation RTCDataChannel {
- rtc::scoped_refptr<webrtc::DataChannelInterface> _nativDataChannel;
+ rtc::scoped_refptr<webrtc::DataChannelInterface> _nativeDataChannel;
rtc::scoped_ptr<webrtc::DataChannelDelegateAdapter> _observer;
BOOL _isObserverRegistered;
}
@@ -100,40 +100,52 @@
}
- (NSString *)label {
- return [NSString stringForStdString:_nativDataChannel->label()];
+ return [NSString stringForStdString:_nativeDataChannel->label()];
+}
+
+- (BOOL)isReliable {
+ return _nativeDataChannel->reliable();
}
- (BOOL)isOrdered {
- return _nativDataChannel->ordered();
+ return _nativeDataChannel->ordered();
+}
+
+- (NSUInteger)maxRetransmitTime {
+ return self.maxPacketLifeTime;
}
- (uint16_t)maxPacketLifeTime {
- return _nativDataChannel->maxRetransmitTime();
+ return _nativeDataChannel->maxRetransmitTime();
}
- (uint16_t)maxRetransmits {
- return _nativDataChannel->maxRetransmits();
+ return _nativeDataChannel->maxRetransmits();
}
- (NSString *)protocol {
- return [NSString stringForStdString:_nativDataChannel->protocol()];
+ return [NSString stringForStdString:_nativeDataChannel->protocol()];
}
- (BOOL)isNegotiated {
- return _nativDataChannel->negotiated();
+ return _nativeDataChannel->negotiated();
+}
+
+- (NSInteger)streamId {
+ return self.channelId;
}
- (int)channelId {
- return _nativDataChannel->id();
+ return _nativeDataChannel->id();
}
- (RTCDataChannelState)readyState {
return [[self class] dataChannelStateForNativeState:
- _nativDataChannel->state()];
+ _nativeDataChannel->state()];
}
- (uint64_t)bufferedAmount {
- return _nativDataChannel->buffered_amount();
+ return _nativeDataChannel->buffered_amount();
}
- (void)setDelegate:(id<RTCDataChannelDelegate>)delegate {
@@ -141,22 +153,22 @@
return;
}
if (_isObserverRegistered) {
- _nativDataChannel->UnregisterObserver();
+ _nativeDataChannel->UnregisterObserver();
_isObserverRegistered = NO;
}
_delegate = delegate;
if (_delegate) {
- _nativDataChannel->RegisterObserver(_observer.get());
+ _nativeDataChannel->RegisterObserver(_observer.get());
_isObserverRegistered = YES;
}
}
- (void)close {
- _nativDataChannel->Close();
+ _nativeDataChannel->Close();
}
- (BOOL)sendData:(RTCDataBuffer *)data {
- return _nativDataChannel->Send(*data.nativeDataBuffer);
+ return _nativeDataChannel->Send(*data.nativeDataBuffer);
}
- (NSString *)description {
@@ -173,7 +185,7 @@
(rtc::scoped_refptr<webrtc::DataChannelInterface>)nativeDataChannel {
NSParameterAssert(nativeDataChannel);
if (self = [super init]) {
- _nativDataChannel = nativeDataChannel;
+ _nativeDataChannel = nativeDataChannel;
_observer.reset(new webrtc::DataChannelDelegateAdapter(self));
}
return self;
diff --git a/webrtc/api/objc/RTCDataChannelConfiguration.h b/webrtc/api/objc/RTCDataChannelConfiguration.h
index ef0562e..fbe342d 100644
--- a/webrtc/api/objc/RTCDataChannelConfiguration.h
+++ b/webrtc/api/objc/RTCDataChannelConfiguration.h
@@ -8,6 +8,7 @@
* be found in the AUTHORS file in the root of the source tree.
*/
+#import <AvailabilityMacros.h>
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
@@ -17,6 +18,9 @@
/** Set to YES if ordered delivery is required. */
@property(nonatomic, assign) BOOL isOrdered;
+/** Deprecated. Use maxPacketLifeTime. */
+@property(nonatomic, assign) NSInteger maxRetransmitTimeMs DEPRECATED_ATTRIBUTE;
+
/**
* Max period in milliseconds in which retransmissions will be sent. After this
* time, no more retransmissions will be sent. -1 if unset.
@@ -31,8 +35,11 @@
*/
@property(nonatomic, assign) BOOL isNegotiated;
-/** The stream id, or SID, for SCTP data channels. -1 if unset. */
-@property(nonatomic, assign) int streamId;
+/** Deprecated. Use channelId. */
+@property(nonatomic, assign) int streamId DEPRECATED_ATTRIBUTE;
+
+/** The id of the data channel. */
+@property(nonatomic, assign) int channelId;
/** Set by the application and opaque to the WebRTC implementation. */
@property(nonatomic) NSString *protocol;
diff --git a/webrtc/api/objc/RTCDataChannelConfiguration.mm b/webrtc/api/objc/RTCDataChannelConfiguration.mm
index 77de4ee..4a1dcb0 100644
--- a/webrtc/api/objc/RTCDataChannelConfiguration.mm
+++ b/webrtc/api/objc/RTCDataChannelConfiguration.mm
@@ -25,6 +25,14 @@
_nativeDataChannelInit.ordered = isOrdered;
}
+- (NSInteger)maxRetransmitTimeMs {
+ return self.maxPacketLifeTime;
+}
+
+- (void)setMaxRetransmitTimeMs:(NSInteger)maxRetransmitTimeMs {
+ self.maxPacketLifeTime = maxRetransmitTimeMs;
+}
+
- (int)maxPacketLifeTime {
return _nativeDataChannelInit.maxRetransmitTime;
}
@@ -58,11 +66,19 @@
}
- (int)streamId {
- return _nativeDataChannelInit.id;
+ return self.channelId;
}
- (void)setStreamId:(int)streamId {
- _nativeDataChannelInit.id = streamId;
+ self.channelId = streamId;
}
-@end
\ No newline at end of file
+- (int)channelId {
+ return _nativeDataChannelInit.id;
+}
+
+- (void)setChannelId:(int)channelId {
+ _nativeDataChannelInit.id = channelId;
+}
+
+@end
diff --git a/webrtc/api/objc/RTCVideoFrame.h b/webrtc/api/objc/RTCVideoFrame.h
index 8ed23ba..8061047 100644
--- a/webrtc/api/objc/RTCVideoFrame.h
+++ b/webrtc/api/objc/RTCVideoFrame.h
@@ -12,6 +12,7 @@
NS_ASSUME_NONNULL_BEGIN
+// RTCVideoFrame is an ObjectiveC version of cricket::VideoFrame.
@interface RTCVideoFrame : NSObject
/** Width without rotation applied. */
diff --git a/webrtc/api/objctests/RTCDataChannelConfigurationTest.mm b/webrtc/api/objctests/RTCDataChannelConfigurationTest.mm
index 2642717..1b3f21b 100644
--- a/webrtc/api/objctests/RTCDataChannelConfigurationTest.mm
+++ b/webrtc/api/objctests/RTCDataChannelConfigurationTest.mm
@@ -27,7 +27,7 @@
int maxPacketLifeTime = 5;
int maxRetransmits = 4;
BOOL isNegotiated = YES;
- int streamId = 4;
+ int channelId = 4;
NSString *protocol = @"protocol";
RTCDataChannelConfiguration *dataChannelConfig =
@@ -36,7 +36,7 @@
dataChannelConfig.maxPacketLifeTime = maxPacketLifeTime;
dataChannelConfig.maxRetransmits = maxRetransmits;
dataChannelConfig.isNegotiated = isNegotiated;
- dataChannelConfig.streamId = streamId;
+ dataChannelConfig.channelId = channelId;
dataChannelConfig.protocol = protocol;
webrtc::DataChannelInit nativeInit = dataChannelConfig.nativeDataChannelInit;
@@ -44,7 +44,7 @@
EXPECT_EQ(maxPacketLifeTime, nativeInit.maxRetransmitTime);
EXPECT_EQ(maxRetransmits, nativeInit.maxRetransmits);
EXPECT_EQ(isNegotiated, nativeInit.negotiated);
- EXPECT_EQ(streamId, nativeInit.id);
+ EXPECT_EQ(channelId, nativeInit.id);
EXPECT_EQ(protocol.stdString, nativeInit.protocol);
}
diff --git a/webrtc/base/objc/RTCFileLogger.h b/webrtc/base/objc/RTCFileLogger.h
index c736012..281be4e 100644
--- a/webrtc/base/objc/RTCFileLogger.h
+++ b/webrtc/base/objc/RTCFileLogger.h
@@ -11,17 +11,19 @@
#import <Foundation/Foundation.h>
typedef NS_ENUM(NSUInteger, RTCFileLoggerSeverity) {
- kRTCFileLoggerSeverityVerbose,
- kRTCFileLoggerSeverityInfo,
- kRTCFileLoggerSeverityWarning,
- kRTCFileLoggerSeverityError
+ RTCFileLoggerSeverityVerbose,
+ RTCFileLoggerSeverityInfo,
+ RTCFileLoggerSeverityWarning,
+ RTCFileLoggerSeverityError
};
typedef NS_ENUM(NSUInteger, RTCFileLoggerRotationType) {
- kRTCFileLoggerTypeCall,
- kRTCFileLoggerTypeApp,
+ RTCFileLoggerTypeCall,
+ RTCFileLoggerTypeApp,
};
+NS_ASSUME_NONNULL_BEGIN
+
// This class intercepts WebRTC logs and saves them to a file. The file size
// will not exceed the given maximum bytesize. When the maximum bytesize is
// reached, logs are rotated according to the rotationType specified.
@@ -67,3 +69,6 @@
- (NSData *)logData;
@end
+
+NS_ASSUME_NONNULL_END
+
diff --git a/webrtc/base/objc/RTCFileLogger.mm b/webrtc/base/objc/RTCFileLogger.mm
index cc3a39d..bf61794 100644
--- a/webrtc/base/objc/RTCFileLogger.mm
+++ b/webrtc/base/objc/RTCFileLogger.mm
@@ -45,7 +45,7 @@
maxFileSize:(NSUInteger)maxFileSize {
return [self initWithDirPath:dirPath
maxFileSize:maxFileSize
- rotationType:kRTCFileLoggerTypeCall];
+ rotationType:RTCFileLoggerTypeCall];
}
- (instancetype)initWithDirPath:(NSString *)dirPath
@@ -72,7 +72,7 @@
}
_dirPath = dirPath;
_maxFileSize = maxFileSize;
- _severity = kRTCFileLoggerSeverityInfo;
+ _severity = RTCFileLoggerSeverityInfo;
}
return self;
}
@@ -86,14 +86,14 @@
return;
}
switch (_rotationType) {
- case kRTCFileLoggerTypeApp:
+ case RTCFileLoggerTypeApp:
_logSink.reset(
new rtc::FileRotatingLogSink(_dirPath.UTF8String,
kRTCFileLoggerRotatingLogPrefix,
_maxFileSize,
_maxFileSize / 10));
break;
- case kRTCFileLoggerTypeCall:
+ case RTCFileLoggerTypeCall:
_logSink.reset(
new rtc::CallSessionFileRotatingLogSink(_dirPath.UTF8String,
_maxFileSize));
@@ -131,12 +131,12 @@
NSMutableData* logData = [NSMutableData data];
rtc::scoped_ptr<rtc::FileRotatingStream> stream;
switch(_rotationType) {
- case kRTCFileLoggerTypeApp:
+ case RTCFileLoggerTypeApp:
stream.reset(
new rtc::FileRotatingStream(_dirPath.UTF8String,
kRTCFileLoggerRotatingLogPrefix));
break;
- case kRTCFileLoggerTypeCall:
+ case RTCFileLoggerTypeCall:
stream.reset(new rtc::CallSessionFileRotatingStream(_dirPath.UTF8String));
break;
}
@@ -161,13 +161,13 @@
- (rtc::LoggingSeverity)rtcSeverity {
switch (_severity) {
- case kRTCFileLoggerSeverityVerbose:
+ case RTCFileLoggerSeverityVerbose:
return rtc::LS_VERBOSE;
- case kRTCFileLoggerSeverityInfo:
+ case RTCFileLoggerSeverityInfo:
return rtc::LS_INFO;
- case kRTCFileLoggerSeverityWarning:
+ case RTCFileLoggerSeverityWarning:
return rtc::LS_WARNING;
- case kRTCFileLoggerSeverityError:
+ case RTCFileLoggerSeverityError:
return rtc::LS_ERROR;
}
}
diff --git a/webrtc/base/objc/RTCLogging.h b/webrtc/base/objc/RTCLogging.h
index 19fade5..fbc4ffa 100644
--- a/webrtc/base/objc/RTCLogging.h
+++ b/webrtc/base/objc/RTCLogging.h
@@ -12,10 +12,10 @@
// Subset of rtc::LoggingSeverity.
typedef NS_ENUM(NSInteger, RTCLoggingSeverity) {
- kRTCLoggingSeverityVerbose,
- kRTCLoggingSeverityInfo,
- kRTCLoggingSeverityWarning,
- kRTCLoggingSeverityError,
+ RTCLoggingSeverityVerbose,
+ RTCLoggingSeverityInfo,
+ RTCLoggingSeverityWarning,
+ RTCLoggingSeverityError,
};
#if defined(__cplusplus)
@@ -53,16 +53,16 @@
} while (false)
#define RTCLogVerbose(format, ...) \
- RTCLogFormat(kRTCLoggingSeverityVerbose, format, ##__VA_ARGS__) \
+ RTCLogFormat(RTCLoggingSeverityVerbose, format, ##__VA_ARGS__) \
#define RTCLogInfo(format, ...) \
- RTCLogFormat(kRTCLoggingSeverityInfo, format, ##__VA_ARGS__) \
+ RTCLogFormat(RTCLoggingSeverityInfo, format, ##__VA_ARGS__) \
#define RTCLogWarning(format, ...) \
- RTCLogFormat(kRTCLoggingSeverityWarning, format, ##__VA_ARGS__) \
+ RTCLogFormat(RTCLoggingSeverityWarning, format, ##__VA_ARGS__) \
#define RTCLogError(format, ...) \
- RTCLogFormat(kRTCLoggingSeverityError, format, ##__VA_ARGS__) \
+ RTCLogFormat(RTCLoggingSeverityError, format, ##__VA_ARGS__) \
#if !defined(NDEBUG)
#define RTCLogDebug(format, ...) RTCLogInfo(format, ##__VA_ARGS__)
diff --git a/webrtc/base/objc/RTCLogging.mm b/webrtc/base/objc/RTCLogging.mm
index e9afe72..598d52d 100644
--- a/webrtc/base/objc/RTCLogging.mm
+++ b/webrtc/base/objc/RTCLogging.mm
@@ -14,13 +14,13 @@
rtc::LoggingSeverity RTCGetNativeLoggingSeverity(RTCLoggingSeverity severity) {
switch (severity) {
- case kRTCLoggingSeverityVerbose:
+ case RTCLoggingSeverityVerbose:
return rtc::LS_VERBOSE;
- case kRTCLoggingSeverityInfo:
+ case RTCLoggingSeverityInfo:
return rtc::LS_INFO;
- case kRTCLoggingSeverityWarning:
+ case RTCLoggingSeverityWarning:
return rtc::LS_WARNING;
- case kRTCLoggingSeverityError:
+ case RTCLoggingSeverityError:
return rtc::LS_ERROR;
}
}
diff --git a/webrtc/build/ios/export_headers b/webrtc/build/ios/export_headers
index 6808e67..84e738c 100755
--- a/webrtc/build/ios/export_headers
+++ b/webrtc/build/ios/export_headers
@@ -18,16 +18,20 @@
import sys
LEGACY_HEADER_DIRS = ['talk/app/webrtc/objc/public', 'webrtc/base/objc/']
-HEADER_DIRS = ['webrtc/api/objc/', 'webrtc/base/objc/']
+HEADER_DIRS = ['webrtc/api/objc/', 'webrtc/base/objc/',
+ 'webrtc/modules/audio_device/ios/objc']
# Individual header files that should also be exported.
LEGACY_HEADER_INCLUDES = []
HEADER_INCLUDES = []
# Individual header files that should not be exported.
LEGACY_HEADER_EXCLUDES = ['talk/app/webrtc/objc/public/RTCNSGLVideoView.h']
-HEADER_EXCLUDES = ['webrtc/api/objc/avfoundationvideocapturer.h',
- 'webrtc/api/objc/RTCNSGLVideoView.h',
- 'webrtc/base/objc/NSString+StdString.h',
- 'webrtc/base/objc/RTCUIApplication.h',]
+HEADER_EXCLUDES = [
+ 'webrtc/api/objc/avfoundationvideocapturer.h',
+ 'webrtc/api/objc/RTCNSGLVideoView.h',
+ 'webrtc/base/objc/NSString+StdString.h',
+ 'webrtc/base/objc/RTCUIApplication.h',
+ 'webrtc/modules/audio_device/ios/objc/RTCAudioSessionDelegateAdapter.h',
+]
def ExportHeaders(include_base_dir, use_legacy_headers):
"""Exports iOS header files.
@@ -41,6 +45,9 @@
include_dir_name = 'include'
include_path = os.path.join(include_base_dir, include_dir_name)
+ # Remove existing directory first in case files change.
+ if (os.path.exists(include_path)):
+ shutil.rmtree(include_path)
script_path = sys.path[0]
webrtc_base_path = os.path.join(script_path, '../../..')
diff --git a/webrtc/examples/objc/AppRTCDemo/ios/ARDAppDelegate.m b/webrtc/examples/objc/AppRTCDemo/ios/ARDAppDelegate.m
index b169ca4..c18c818 100644
--- a/webrtc/examples/objc/AppRTCDemo/ios/ARDAppDelegate.m
+++ b/webrtc/examples/objc/AppRTCDemo/ios/ARDAppDelegate.m
@@ -37,7 +37,7 @@
// In debug builds the default level is LS_INFO and in non-debug builds it is
// disabled. Continue to log to console in non-debug builds, but only
// warnings and errors.
- RTCSetMinDebugLogLevel(kRTCLoggingSeverityWarning);
+ RTCSetMinDebugLogLevel(RTCLoggingSeverityWarning);
#endif
return YES;