Skip to content

Commit

Permalink
Use default rtp parameters to init wrappers in iOS
Browse files Browse the repository at this point in the history
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 <[email protected]>
Commit-Queue: Kári Helgason <[email protected]>
Cr-Commit-Position: refs/heads/master@{#33731}
  • Loading branch information
mstyura authored and Commit Bot committed Apr 14, 2021
1 parent 89f3dd5 commit 9aec8c2
Show file tree
Hide file tree
Showing 15 changed files with 30 additions and 20 deletions.
3 changes: 2 additions & 1 deletion sdk/objc/api/peerconnection/RTCRtcpParameters+Private.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ NS_ASSUME_NONNULL_BEGIN
@property(nonatomic, readonly) webrtc::RtcpParameters nativeParameters;

/** Initialize the object with a native RtcpParameters structure. */
- (instancetype)initWithNativeParameters:(const webrtc::RtcpParameters &)nativeParameters;
- (instancetype)initWithNativeParameters:(const webrtc::RtcpParameters &)nativeParameters
NS_DESIGNATED_INITIALIZER;

@end

Expand Down
2 changes: 1 addition & 1 deletion sdk/objc/api/peerconnection/RTCRtcpParameters.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ RTC_OBJC_EXPORT
/** Whether reduced size RTCP is configured or compound RTCP. */
@property(nonatomic, assign) BOOL isReducedSize;

- (instancetype)init NS_DESIGNATED_INITIALIZER;
- (instancetype)init;

@end

Expand Down
5 changes: 3 additions & 2 deletions sdk/objc/api/peerconnection/RTCRtcpParameters.mm
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,12 @@ @implementation RTC_OBJC_TYPE (RTCRtcpParameters)
@synthesize isReducedSize = _isReducedSize;

- (instancetype)init {
return [super init];
webrtc::RtcpParameters nativeParameters;
return [self initWithNativeParameters:nativeParameters];
}

- (instancetype)initWithNativeParameters:(const webrtc::RtcpParameters &)nativeParameters {
if (self = [self init]) {
if (self = [super init]) {
_cname = [NSString stringForStdString:nativeParameters.cname];
_isReducedSize = nativeParameters.reduced_size;
}
Expand Down
3 changes: 2 additions & 1 deletion sdk/objc/api/peerconnection/RTCRtpCodecParameters+Private.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ NS_ASSUME_NONNULL_BEGIN
@property(nonatomic, readonly) webrtc::RtpCodecParameters nativeParameters;

/** Initialize the object with a native RtpCodecParameters structure. */
- (instancetype)initWithNativeParameters:(const webrtc::RtpCodecParameters &)nativeParameters;
- (instancetype)initWithNativeParameters:(const webrtc::RtpCodecParameters &)nativeParameters
NS_DESIGNATED_INITIALIZER;

@end

Expand Down
2 changes: 1 addition & 1 deletion sdk/objc/api/peerconnection/RTCRtpCodecParameters.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ RTC_OBJC_EXPORT
/** The "format specific parameters" field from the "a=fmtp" line in the SDP */
@property(nonatomic, readonly, nonnull) NSDictionary *parameters;

- (instancetype)init NS_DESIGNATED_INITIALIZER;
- (instancetype)init;

@end

Expand Down
5 changes: 3 additions & 2 deletions sdk/objc/api/peerconnection/RTCRtpCodecParameters.mm
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,13 @@ @implementation RTC_OBJC_TYPE (RTCRtpCodecParameters)
@synthesize parameters = _parameters;

- (instancetype)init {
return [super init];
webrtc::RtpCodecParameters nativeParameters;
return [self initWithNativeParameters:nativeParameters];
}

- (instancetype)initWithNativeParameters:
(const webrtc::RtpCodecParameters &)nativeParameters {
if (self = [self init]) {
if (self = [super init]) {
_payloadType = nativeParameters.payload_type;
_name = [NSString stringForStdString:nativeParameters.name];
switch (nativeParameters.kind) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ NS_ASSUME_NONNULL_BEGIN
@property(nonatomic, readonly) webrtc::RtpEncodingParameters nativeParameters;

/** Initialize the object with a native RtpEncodingParameters structure. */
- (instancetype)initWithNativeParameters:(const webrtc::RtpEncodingParameters &)nativeParameters;
- (instancetype)initWithNativeParameters:(const webrtc::RtpEncodingParameters &)nativeParameters
NS_DESIGNATED_INITIALIZER;

@end

Expand Down
2 changes: 1 addition & 1 deletion sdk/objc/api/peerconnection/RTCRtpEncodingParameters.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ RTC_OBJC_EXPORT
/** The relative DiffServ Code Point priority. */
@property(nonatomic, assign) RTCPriority networkPriority;

- (instancetype)init NS_DESIGNATED_INITIALIZER;
- (instancetype)init;

@end

Expand Down
5 changes: 3 additions & 2 deletions sdk/objc/api/peerconnection/RTCRtpEncodingParameters.mm
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,13 @@ @implementation RTC_OBJC_TYPE (RTCRtpEncodingParameters)
@synthesize networkPriority = _networkPriority;

- (instancetype)init {
return [super init];
webrtc::RtpEncodingParameters nativeParameters;
return [self initWithNativeParameters:nativeParameters];
}

- (instancetype)initWithNativeParameters:
(const webrtc::RtpEncodingParameters &)nativeParameters {
if (self = [self init]) {
if (self = [super init]) {
if (!nativeParameters.rid.empty()) {
_rid = [NSString stringForStdString:nativeParameters.rid];
}
Expand Down
3 changes: 2 additions & 1 deletion sdk/objc/api/peerconnection/RTCRtpHeaderExtension+Private.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ NS_ASSUME_NONNULL_BEGIN
@property(nonatomic, readonly) webrtc::RtpExtension nativeParameters;

/** Initialize the object with a native RtpExtension structure. */
- (instancetype)initWithNativeParameters:(const webrtc::RtpExtension &)nativeParameters;
- (instancetype)initWithNativeParameters:(const webrtc::RtpExtension &)nativeParameters
NS_DESIGNATED_INITIALIZER;

@end

Expand Down
2 changes: 1 addition & 1 deletion sdk/objc/api/peerconnection/RTCRtpHeaderExtension.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ RTC_OBJC_EXPORT
/** Whether the header extension is encrypted or not. */
@property(nonatomic, readonly, getter=isEncrypted) BOOL encrypted;

- (instancetype)init NS_DESIGNATED_INITIALIZER;
- (instancetype)init;

@end

Expand Down
5 changes: 3 additions & 2 deletions sdk/objc/api/peerconnection/RTCRtpHeaderExtension.mm
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,12 @@ @implementation RTC_OBJC_TYPE (RTCRtpHeaderExtension)
@synthesize encrypted = _encrypted;

- (instancetype)init {
return [super init];
webrtc::RtpExtension nativeExtension;
return [self initWithNativeParameters:nativeExtension];
}

- (instancetype)initWithNativeParameters:(const webrtc::RtpExtension &)nativeParameters {
if (self = [self init]) {
if (self = [super init]) {
_uri = [NSString stringForStdString:nativeParameters.uri];
_id = nativeParameters.id;
_encrypted = nativeParameters.encrypt;
Expand Down
3 changes: 2 additions & 1 deletion sdk/objc/api/peerconnection/RTCRtpParameters+Private.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ NS_ASSUME_NONNULL_BEGIN
@property(nonatomic, readonly) webrtc::RtpParameters nativeParameters;

/** Initialize the object with a native RtpParameters structure. */
- (instancetype)initWithNativeParameters:(const webrtc::RtpParameters &)nativeParameters;
- (instancetype)initWithNativeParameters:(const webrtc::RtpParameters &)nativeParameters
NS_DESIGNATED_INITIALIZER;

@end

Expand Down
2 changes: 1 addition & 1 deletion sdk/objc/api/peerconnection/RTCRtpParameters.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ RTC_OBJC_EXPORT
*/
@property(nonatomic, copy, nullable) NSNumber *degradationPreference;

- (instancetype)init NS_DESIGNATED_INITIALIZER;
- (instancetype)init;

@end

Expand Down
5 changes: 3 additions & 2 deletions sdk/objc/api/peerconnection/RTCRtpParameters.mm
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,13 @@ @implementation RTC_OBJC_TYPE (RTCRtpParameters)
@synthesize degradationPreference = _degradationPreference;

- (instancetype)init {
return [super init];
webrtc::RtpParameters nativeParameters;
return [self initWithNativeParameters:nativeParameters];
}

- (instancetype)initWithNativeParameters:
(const webrtc::RtpParameters &)nativeParameters {
if (self = [self init]) {
if (self = [super init]) {
_transactionId = [NSString stringForStdString:nativeParameters.transaction_id];
_rtcp =
[[RTC_OBJC_TYPE(RTCRtcpParameters) alloc] initWithNativeParameters:nativeParameters.rtcp];
Expand Down

0 comments on commit 9aec8c2

Please sign in to comment.