Use default rtp parameters to init wrappers in iOS

Before these changes default initialized iOS wrappers
around various RTP*Parameters types had their own
default values of nonnull values, which did not always
matched default values from native code, which then causes
override of default native values, if library user didn't
specified it's own initialization.
After these changes default initialization of iOS wrappers
uses default property values from default initialized
native types.

Bug: None
Change-Id: Ie21a7dc38ddc3862aca8ec424859c776c67b1388
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/215220
Reviewed-by: Kári Helgason <kthelgason@webrtc.org>
Commit-Queue: Kári Helgason <kthelgason@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#33731}
This commit is contained in:
Yura Yaroshevich 2021-04-14 12:41:21 +03:00 committed by Commit Bot
parent 89f3dd5bf7
commit 9aec8c239f
15 changed files with 30 additions and 20 deletions

View file

@ -21,7 +21,8 @@ NS_ASSUME_NONNULL_BEGIN
@property(nonatomic, readonly) webrtc::RtcpParameters nativeParameters; @property(nonatomic, readonly) webrtc::RtcpParameters nativeParameters;
/** Initialize the object with a native RtcpParameters structure. */ /** Initialize the object with a native RtcpParameters structure. */
- (instancetype)initWithNativeParameters:(const webrtc::RtcpParameters &)nativeParameters; - (instancetype)initWithNativeParameters:(const webrtc::RtcpParameters &)nativeParameters
NS_DESIGNATED_INITIALIZER;
@end @end

View file

@ -23,7 +23,7 @@ RTC_OBJC_EXPORT
/** Whether reduced size RTCP is configured or compound RTCP. */ /** Whether reduced size RTCP is configured or compound RTCP. */
@property(nonatomic, assign) BOOL isReducedSize; @property(nonatomic, assign) BOOL isReducedSize;
- (instancetype)init NS_DESIGNATED_INITIALIZER; - (instancetype)init;
@end @end

View file

@ -18,11 +18,12 @@
@synthesize isReducedSize = _isReducedSize; @synthesize isReducedSize = _isReducedSize;
- (instancetype)init { - (instancetype)init {
return [super init]; webrtc::RtcpParameters nativeParameters;
return [self initWithNativeParameters:nativeParameters];
} }
- (instancetype)initWithNativeParameters:(const webrtc::RtcpParameters &)nativeParameters { - (instancetype)initWithNativeParameters:(const webrtc::RtcpParameters &)nativeParameters {
if (self = [self init]) { if (self = [super init]) {
_cname = [NSString stringForStdString:nativeParameters.cname]; _cname = [NSString stringForStdString:nativeParameters.cname];
_isReducedSize = nativeParameters.reduced_size; _isReducedSize = nativeParameters.reduced_size;
} }

View file

@ -21,7 +21,8 @@ NS_ASSUME_NONNULL_BEGIN
@property(nonatomic, readonly) webrtc::RtpCodecParameters nativeParameters; @property(nonatomic, readonly) webrtc::RtpCodecParameters nativeParameters;
/** Initialize the object with a native RtpCodecParameters structure. */ /** Initialize the object with a native RtpCodecParameters structure. */
- (instancetype)initWithNativeParameters:(const webrtc::RtpCodecParameters &)nativeParameters; - (instancetype)initWithNativeParameters:(const webrtc::RtpCodecParameters &)nativeParameters
NS_DESIGNATED_INITIALIZER;
@end @end

View file

@ -66,7 +66,7 @@ RTC_OBJC_EXPORT
/** The "format specific parameters" field from the "a=fmtp" line in the SDP */ /** The "format specific parameters" field from the "a=fmtp" line in the SDP */
@property(nonatomic, readonly, nonnull) NSDictionary *parameters; @property(nonatomic, readonly, nonnull) NSDictionary *parameters;
- (instancetype)init NS_DESIGNATED_INITIALIZER; - (instancetype)init;
@end @end

View file

@ -44,12 +44,13 @@ const NSString * const kRTCH264CodecName = @(cricket::kH264CodecName);
@synthesize parameters = _parameters; @synthesize parameters = _parameters;
- (instancetype)init { - (instancetype)init {
return [super init]; webrtc::RtpCodecParameters nativeParameters;
return [self initWithNativeParameters:nativeParameters];
} }
- (instancetype)initWithNativeParameters: - (instancetype)initWithNativeParameters:
(const webrtc::RtpCodecParameters &)nativeParameters { (const webrtc::RtpCodecParameters &)nativeParameters {
if (self = [self init]) { if (self = [super init]) {
_payloadType = nativeParameters.payload_type; _payloadType = nativeParameters.payload_type;
_name = [NSString stringForStdString:nativeParameters.name]; _name = [NSString stringForStdString:nativeParameters.name];
switch (nativeParameters.kind) { switch (nativeParameters.kind) {

View file

@ -21,7 +21,8 @@ NS_ASSUME_NONNULL_BEGIN
@property(nonatomic, readonly) webrtc::RtpEncodingParameters nativeParameters; @property(nonatomic, readonly) webrtc::RtpEncodingParameters nativeParameters;
/** Initialize the object with a native RtpEncodingParameters structure. */ /** Initialize the object with a native RtpEncodingParameters structure. */
- (instancetype)initWithNativeParameters:(const webrtc::RtpEncodingParameters &)nativeParameters; - (instancetype)initWithNativeParameters:(const webrtc::RtpEncodingParameters &)nativeParameters
NS_DESIGNATED_INITIALIZER;
@end @end

View file

@ -65,7 +65,7 @@ RTC_OBJC_EXPORT
/** The relative DiffServ Code Point priority. */ /** The relative DiffServ Code Point priority. */
@property(nonatomic, assign) RTCPriority networkPriority; @property(nonatomic, assign) RTCPriority networkPriority;
- (instancetype)init NS_DESIGNATED_INITIALIZER; - (instancetype)init;
@end @end

View file

@ -26,12 +26,13 @@
@synthesize networkPriority = _networkPriority; @synthesize networkPriority = _networkPriority;
- (instancetype)init { - (instancetype)init {
return [super init]; webrtc::RtpEncodingParameters nativeParameters;
return [self initWithNativeParameters:nativeParameters];
} }
- (instancetype)initWithNativeParameters: - (instancetype)initWithNativeParameters:
(const webrtc::RtpEncodingParameters &)nativeParameters { (const webrtc::RtpEncodingParameters &)nativeParameters {
if (self = [self init]) { if (self = [super init]) {
if (!nativeParameters.rid.empty()) { if (!nativeParameters.rid.empty()) {
_rid = [NSString stringForStdString:nativeParameters.rid]; _rid = [NSString stringForStdString:nativeParameters.rid];
} }

View file

@ -21,7 +21,8 @@ NS_ASSUME_NONNULL_BEGIN
@property(nonatomic, readonly) webrtc::RtpExtension nativeParameters; @property(nonatomic, readonly) webrtc::RtpExtension nativeParameters;
/** Initialize the object with a native RtpExtension structure. */ /** Initialize the object with a native RtpExtension structure. */
- (instancetype)initWithNativeParameters:(const webrtc::RtpExtension &)nativeParameters; - (instancetype)initWithNativeParameters:(const webrtc::RtpExtension &)nativeParameters
NS_DESIGNATED_INITIALIZER;
@end @end

View file

@ -26,7 +26,7 @@ RTC_OBJC_EXPORT
/** Whether the header extension is encrypted or not. */ /** Whether the header extension is encrypted or not. */
@property(nonatomic, readonly, getter=isEncrypted) BOOL encrypted; @property(nonatomic, readonly, getter=isEncrypted) BOOL encrypted;
- (instancetype)init NS_DESIGNATED_INITIALIZER; - (instancetype)init;
@end @end

View file

@ -19,11 +19,12 @@
@synthesize encrypted = _encrypted; @synthesize encrypted = _encrypted;
- (instancetype)init { - (instancetype)init {
return [super init]; webrtc::RtpExtension nativeExtension;
return [self initWithNativeParameters:nativeExtension];
} }
- (instancetype)initWithNativeParameters:(const webrtc::RtpExtension &)nativeParameters { - (instancetype)initWithNativeParameters:(const webrtc::RtpExtension &)nativeParameters {
if (self = [self init]) { if (self = [super init]) {
_uri = [NSString stringForStdString:nativeParameters.uri]; _uri = [NSString stringForStdString:nativeParameters.uri];
_id = nativeParameters.id; _id = nativeParameters.id;
_encrypted = nativeParameters.encrypt; _encrypted = nativeParameters.encrypt;

View file

@ -21,7 +21,8 @@ NS_ASSUME_NONNULL_BEGIN
@property(nonatomic, readonly) webrtc::RtpParameters nativeParameters; @property(nonatomic, readonly) webrtc::RtpParameters nativeParameters;
/** Initialize the object with a native RtpParameters structure. */ /** Initialize the object with a native RtpParameters structure. */
- (instancetype)initWithNativeParameters:(const webrtc::RtpParameters &)nativeParameters; - (instancetype)initWithNativeParameters:(const webrtc::RtpParameters &)nativeParameters
NS_DESIGNATED_INITIALIZER;
@end @end

View file

@ -51,7 +51,7 @@ RTC_OBJC_EXPORT
*/ */
@property(nonatomic, copy, nullable) NSNumber *degradationPreference; @property(nonatomic, copy, nullable) NSNumber *degradationPreference;
- (instancetype)init NS_DESIGNATED_INITIALIZER; - (instancetype)init;
@end @end

View file

@ -26,12 +26,13 @@
@synthesize degradationPreference = _degradationPreference; @synthesize degradationPreference = _degradationPreference;
- (instancetype)init { - (instancetype)init {
return [super init]; webrtc::RtpParameters nativeParameters;
return [self initWithNativeParameters:nativeParameters];
} }
- (instancetype)initWithNativeParameters: - (instancetype)initWithNativeParameters:
(const webrtc::RtpParameters &)nativeParameters { (const webrtc::RtpParameters &)nativeParameters {
if (self = [self init]) { if (self = [super init]) {
_transactionId = [NSString stringForStdString:nativeParameters.transaction_id]; _transactionId = [NSString stringForStdString:nativeParameters.transaction_id];
_rtcp = _rtcp =
[[RTC_OBJC_TYPE(RTCRtcpParameters) alloc] initWithNativeParameters:nativeParameters.rtcp]; [[RTC_OBJC_TYPE(RTCRtcpParameters) alloc] initWithNativeParameters:nativeParameters.rtcp];