[ObjC] Change default sdpSemantics to NotSpecified.

The default value of sdpSemantics is about to change from PlanB to
UnifiedPlan. In order not to cause subtle bugs by applications that
depend on the default value being PlanB, we are temporarily making the
default NotSpecified. Constructing with NotSpecified causes the C++
layer to crash (https://webrtc-review.googlesource.com/c/src/+/242968).
This is in accordance to the publically announced plans:
https://groups.google.com/u/1/g/discuss-webrtc/c/SdoVP02eUIk

Bug: webrtc:11121
Change-Id: Idbb8fd0f5c224311cf1f25ac2832800124ed14d4
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/246060
Reviewed-by: Peter Hanspers <peterhanspers@webrtc.org>
Commit-Queue: Henrik Boström <hbos@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#35678}
This commit is contained in:
Henrik Boström 2022-01-12 17:46:03 +01:00 committed by WebRTC LUCI CQ
parent 26cf22af46
commit 766c80b256
3 changed files with 31 additions and 12 deletions

View file

@ -63,8 +63,15 @@ typedef NS_ENUM(NSInteger, RTCEncryptionKeyType) {
/** Represents the chosen SDP semantics for the RTCPeerConnection. */ /** Represents the chosen SDP semantics for the RTCPeerConnection. */
typedef NS_ENUM(NSInteger, RTCSdpSemantics) { typedef NS_ENUM(NSInteger, RTCSdpSemantics) {
// TODO(https://crbug.com/webrtc/13528): Remove support for Plan B.
RTCSdpSemanticsPlanB, RTCSdpSemanticsPlanB,
RTCSdpSemanticsUnifiedPlan, RTCSdpSemanticsUnifiedPlan,
// The default sdpSemantics value is about to change to Unified Plan. During
// a short transition period, NotSpecified is used to ensure clients that
// don't set sdpSemantics are aware of the change by CHECK-crashing.
// TODO(https://crbug.com/webrtc/11121): When the default has changed to
// UnifiedPlan, delete NotSpecified.
RTCSdpSemanticsNotSpecified,
}; };
NS_ASSUME_NONNULL_BEGIN NS_ASSUME_NONNULL_BEGIN
@ -161,9 +168,10 @@ RTC_OBJC_EXPORT
*/ */
@property(nonatomic, copy, nullable) NSNumber *iceCheckMinInterval; @property(nonatomic, copy, nullable) NSNumber *iceCheckMinInterval;
/** Configure the SDP semantics used by this PeerConnection. Note that the /** Configure the SDP semantics used by this PeerConnection. The WebRTC 1.0
* WebRTC 1.0 specification requires UnifiedPlan semantics. The * specification requires RTCSdpSemanticsUnifiedPlan semantics and the
* RTCRtpTransceiver API is only available with UnifiedPlan semantics. * RtpTransceiver API is only available in Unified Plan. RTCSdpSemanticsPlanB
* is being deprecated and will be removed at a future date.
* *
* PlanB will cause RTCPeerConnection to create offers and answers with at * PlanB will cause RTCPeerConnection to create offers and answers with at
* most one audio and one video m= section with multiple RTCRtpSenders and * most one audio and one video m= section with multiple RTCRtpSenders and
@ -174,14 +182,18 @@ RTC_OBJC_EXPORT
* UnifiedPlan will cause RTCPeerConnection to create offers and answers with * UnifiedPlan will cause RTCPeerConnection to create offers and answers with
* multiple m= sections where each m= section maps to one RTCRtpSender and one * multiple m= sections where each m= section maps to one RTCRtpSender and one
* RTCRtpReceiver (an RTCRtpTransceiver), either both audio or both * RTCRtpReceiver (an RTCRtpTransceiver), either both audio or both
* video. This will also cause RTCPeerConnection) to ignore all but the first a=ssrc * video. This will also cause RTCPeerConnection) to ignore all but the first
* lines that form a Plan B stream. * a=ssrc lines that form a Plan B stream.
* *
* For users who wish to send multiple audio/video streams and need to stay * For users who have to interwork with legacy WebRTC implementations, it
* interoperable with legacy WebRTC implementations or use legacy APIs, * is possible to specify PlanB until the code is finally removed
* specify PlanB. * (https://crbug.com/webrtc/13528).
* *
* For all other users, specify UnifiedPlan. * The default SdpSemantics value is about to change to UnifiedPlan. During a
* short transition period, NotSpecified is used to ensure clients that don't
* set SdpSemantics are aware of the change by CHECK-crashing.
* TODO(https://crbug.com/webrtc/11121): When the default has changed to
* UnifiedPlan, delete NotSpecified.
*/ */
@property(nonatomic, assign) RTCSdpSemantics sdpSemantics; @property(nonatomic, assign) RTCSdpSemantics sdpSemantics;

View file

@ -68,7 +68,7 @@
- (instancetype)init { - (instancetype)init {
// Copy defaults. // Copy defaults.
webrtc::PeerConnectionInterface::RTCConfiguration config; webrtc::PeerConnectionInterface::RTCConfiguration config;
config.sdp_semantics = webrtc::SdpSemantics::kPlanB_DEPRECATED; config.sdp_semantics = webrtc::SdpSemantics::kNotSpecified;
return [self initWithNativeConfiguration:config]; return [self initWithNativeConfiguration:config];
} }
@ -525,6 +525,8 @@
return webrtc::SdpSemantics::kPlanB_DEPRECATED; return webrtc::SdpSemantics::kPlanB_DEPRECATED;
case RTCSdpSemanticsUnifiedPlan: case RTCSdpSemanticsUnifiedPlan:
return webrtc::SdpSemantics::kUnifiedPlan; return webrtc::SdpSemantics::kUnifiedPlan;
case RTCSdpSemanticsNotSpecified:
return webrtc::SdpSemantics::kNotSpecified;
} }
} }
@ -535,8 +537,7 @@
case webrtc::SdpSemantics::kUnifiedPlan: case webrtc::SdpSemantics::kUnifiedPlan:
return RTCSdpSemanticsUnifiedPlan; return RTCSdpSemanticsUnifiedPlan;
case webrtc::SdpSemantics::kNotSpecified: case webrtc::SdpSemantics::kNotSpecified:
RTC_DCHECK_NOTREACHED(); return RTCSdpSemanticsNotSpecified;
return RTCSdpSemanticsUnifiedPlan;
} }
} }
@ -546,6 +547,8 @@
return @"PLAN_B"; return @"PLAN_B";
case RTCSdpSemanticsUnifiedPlan: case RTCSdpSemanticsUnifiedPlan:
return @"UNIFIED_PLAN"; return @"UNIFIED_PLAN";
case RTCSdpSemanticsNotSpecified:
return @"NOT_SPECIFIED";
} }
} }

View file

@ -42,6 +42,7 @@
[[RTC_OBJC_TYPE(RTCIceServer) alloc] initWithURLStrings:urlStrings]; [[RTC_OBJC_TYPE(RTCIceServer) alloc] initWithURLStrings:urlStrings];
RTC_OBJC_TYPE(RTCConfiguration) *config = [[RTC_OBJC_TYPE(RTCConfiguration) alloc] init]; RTC_OBJC_TYPE(RTCConfiguration) *config = [[RTC_OBJC_TYPE(RTCConfiguration) alloc] init];
config.sdpSemantics = RTCSdpSemanticsUnifiedPlan;
config.iceServers = @[ server ]; config.iceServers = @[ server ];
config.iceTransportPolicy = RTCIceTransportPolicyRelay; config.iceTransportPolicy = RTCIceTransportPolicyRelay;
config.bundlePolicy = RTCBundlePolicyMaxBundle; config.bundlePolicy = RTCBundlePolicyMaxBundle;
@ -121,6 +122,7 @@
[[RTC_OBJC_TYPE(RTCIceServer) alloc] initWithURLStrings:urlStrings]; [[RTC_OBJC_TYPE(RTCIceServer) alloc] initWithURLStrings:urlStrings];
RTC_OBJC_TYPE(RTCConfiguration) *config = [[RTC_OBJC_TYPE(RTCConfiguration) alloc] init]; RTC_OBJC_TYPE(RTCConfiguration) *config = [[RTC_OBJC_TYPE(RTCConfiguration) alloc] init];
config.sdpSemantics = RTCSdpSemanticsUnifiedPlan;
config.iceServers = @[ server ]; config.iceServers = @[ server ];
RTC_OBJC_TYPE(RTCMediaConstraints) *contraints = RTC_OBJC_TYPE(RTCMediaConstraints) *contraints =
[[RTC_OBJC_TYPE(RTCMediaConstraints) alloc] initWithMandatoryConstraints:@{} [[RTC_OBJC_TYPE(RTCMediaConstraints) alloc] initWithMandatoryConstraints:@{}
@ -145,6 +147,7 @@
[[RTC_OBJC_TYPE(RTCPeerConnectionFactory) alloc] init]; [[RTC_OBJC_TYPE(RTCPeerConnectionFactory) alloc] init];
RTC_OBJC_TYPE(RTCConfiguration) *config = [[RTC_OBJC_TYPE(RTCConfiguration) alloc] init]; RTC_OBJC_TYPE(RTCConfiguration) *config = [[RTC_OBJC_TYPE(RTCConfiguration) alloc] init];
config.sdpSemantics = RTCSdpSemanticsUnifiedPlan;
RTC_OBJC_TYPE(RTCMediaConstraints) *contraints = RTC_OBJC_TYPE(RTCMediaConstraints) *contraints =
[[RTC_OBJC_TYPE(RTCMediaConstraints) alloc] initWithMandatoryConstraints:@{} [[RTC_OBJC_TYPE(RTCMediaConstraints) alloc] initWithMandatoryConstraints:@{}
optionalConstraints:nil]; optionalConstraints:nil];
@ -175,6 +178,7 @@
[[RTC_OBJC_TYPE(RTCPeerConnectionFactory) alloc] init]; [[RTC_OBJC_TYPE(RTCPeerConnectionFactory) alloc] init];
RTC_OBJC_TYPE(RTCConfiguration) *config = [[RTC_OBJC_TYPE(RTCConfiguration) alloc] init]; RTC_OBJC_TYPE(RTCConfiguration) *config = [[RTC_OBJC_TYPE(RTCConfiguration) alloc] init];
config.sdpSemantics = RTCSdpSemanticsUnifiedPlan;
RTC_OBJC_TYPE(RTCMediaConstraints) *contraints = RTC_OBJC_TYPE(RTCMediaConstraints) *contraints =
[[RTC_OBJC_TYPE(RTCMediaConstraints) alloc] initWithMandatoryConstraints:@{} [[RTC_OBJC_TYPE(RTCMediaConstraints) alloc] initWithMandatoryConstraints:@{}
optionalConstraints:nil]; optionalConstraints:nil];