Skip to content

Commit

Permalink
Remove mediaConstraints from createOffer() and createAnswer().
Browse files Browse the repository at this point in the history
Part of removing non-standard mediaConstraints
(go/deprecating-media-constraints).

Based on insignificant usage numbers in UMA, mediaConstraints are
removed from these methods. It's still possible to use the callback
based versions of createOffer() and createAnswer(), but if you want
offer options you have to use spec-compliant RTCOfferOptions.

While mediaConstraints are still parseable by other APIs (such as the
RTCPeerConnection constructor), there is no longer any use case where
the offer/answer options are being passed down as mediaConstraints, so
we can safely remove the ability to parse these constraints rather than
just ignoring them. I hardly think anyone is passing down IceRestart
to the PC constructor, for instance.

Bug: 1315582
Change-Id: If8d828c74ecc6794101e35dbc8b7ad105a096002
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3634478
Commit-Queue: Henrik Boström <hbos@chromium.org>
Reviewed-by: Alex Rudenko <alexrudenko@chromium.org>
Reviewed-by: Ari Chivukula <arichiv@chromium.org>
Reviewed-by: Harald Alvestrand <hta@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1001020}
  • Loading branch information
henbos authored and Chromium LUCI CQ committed May 9, 2022
1 parent 396f5bd commit 276b4b0
Show file tree
Hide file tree
Showing 20 changed files with 47 additions and 426 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -788,7 +788,6 @@ experimental domain Audits
RTCConstraintEnableDtlsSrtpFalse
RTCConstraintEnableDtlsSrtpTrue
RTCPeerConnectionComplexPlanBSdpUsingDefaultSdpSemantics
RTCPeerConnectionLegacyCreateWithMediaConstraints
RTCPeerConnectionSdpSemanticsPlanB
RtcpMuxPolicyNegotiate
RTPDataChannel
Expand Down
6 changes: 3 additions & 3 deletions third_party/blink/public/mojom/web_feature/web_feature.mojom
Original file line number Diff line number Diff line change
Expand Up @@ -695,10 +695,10 @@ enum WebFeature {
kRTCPeerConnectionConstructorCompliant = 1042,
kRTCPeerConnectionCreateOfferLegacyFailureCallback = 1044,
kRTCPeerConnectionCreateOfferLegacyConstraints = 1045,
kRTCPeerConnectionCreateOfferLegacyOfferOptions = 1046,
kOBSOLETE_RTCPeerConnectionCreateOfferLegacyOfferOptions = 1046,
kRTCPeerConnectionCreateOfferLegacyCompliant = 1047,
kRTCPeerConnectionCreateAnswerLegacyFailureCallback = 1049,
kRTCPeerConnectionCreateAnswerLegacyConstraints = 1050,
kOBSOLETE_RTCPeerConnectionCreateAnswerLegacyConstraints = 1050,
kRTCPeerConnectionCreateAnswerLegacyCompliant = 1051,
kRTCPeerConnectionSetLocalDescriptionLegacyNoSuccessCallback = 1052,
kRTCPeerConnectionSetLocalDescriptionLegacyNoFailureCallback = 1053,
Expand Down Expand Up @@ -3523,7 +3523,7 @@ enum WebFeature {
kExplicitOverflowVisibleOnReplacedElementWithObjectProp = 4202,
kPrivateNetworkAccessNullIpAddress = 4203,
kOBSOLETE_LegacyConstraintGoogScreencastMinBitrate = 4204,
kRTCPeerConnectionLegacyCreateWithMediaConstraints = 4205,
kOBSOLETE_RTCPeerConnectionLegacyCreateWithMediaConstraints = 4205,
kClientHintsSaveData = 4206,
kLegacyConstraintGoogIPv6 = 4207,
kOBSOLETE_LegacyConstraintGoogSuspendBelowMinBitrate = 4208,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -215,10 +215,6 @@ const DeprecationInfo GetDeprecationInfo(WebFeature feature) {
feature,
DeprecationIssueType::
kRTCPeerConnectionComplexPlanBSdpUsingDefaultSdpSemantics);
case WebFeature::kRTCPeerConnectionLegacyCreateWithMediaConstraints:
return DeprecationInfo::WithTranslation(
feature, DeprecationIssueType::
kRTCPeerConnectionLegacyCreateWithMediaConstraints);
case WebFeature::kRTCPeerConnectionSdpSemanticsPlanB:
return DeprecationInfo::WithTranslation(
feature, DeprecationIssueType::kRTCPeerConnectionSdpSemanticsPlanB);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -602,11 +602,6 @@ void AuditsIssue::ReportDeprecationIssue(ExecutionContext* execution_context,
type = protocol::Audits::DeprecationIssueTypeEnum::
RTCPeerConnectionComplexPlanBSdpUsingDefaultSdpSemantics;
break;
case DeprecationIssueType::
kRTCPeerConnectionLegacyCreateWithMediaConstraints:
type = protocol::Audits::DeprecationIssueTypeEnum::
RTCPeerConnectionLegacyCreateWithMediaConstraints;
break;
case DeprecationIssueType::kRTCPeerConnectionSdpSemanticsPlanB:
type = protocol::Audits::DeprecationIssueTypeEnum::
RTCPeerConnectionSdpSemanticsPlanB;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@ enum class DeprecationIssueType {
kRTCConstraintEnableDtlsSrtpFalse,
kRTCConstraintEnableDtlsSrtpTrue,
kRTCPeerConnectionComplexPlanBSdpUsingDefaultSdpSemantics,
kRTCPeerConnectionLegacyCreateWithMediaConstraints,
kRTCPeerConnectionSdpSemanticsPlanB,
kRtcpMuxPolicyNegotiate,
kRTPDataChannel,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,16 +115,6 @@ const char kDAEchoCancellation[] = "googDAEchoCancellation";
// Google-specific constraint keys for a local video source (getUserMedia).
const char kNoiseReduction[] = "googNoiseReduction";

// Legacy RTCPeerConnection createOffer() and createAnswer() constraints.
// Legacy versions of the attributes in the spec only used with callback-based
// versions of the spec APIs.
// TODO(https://crbug.com/1315572): Remove these as part of removing the
// callback-based versions.
const char kOfferToReceiveAudio[] = "OfferToReceiveAudio";
const char kOfferToReceiveVideo[] = "OfferToReceiveVideo";
const char kVoiceActivityDetection[] = "VoiceActivityDetection";
const char kIceRestart[] = "IceRestart";

// Legacy RTCPeerConnection constructor constraints.

// DtlsSrtpKeyAgreement and RtpDataChannels are already ignored, except when
Expand Down Expand Up @@ -351,30 +341,6 @@ static void ParseOldStyleNames(
result.goog_da_echo_cancellation.SetExact(ToBoolean(constraint.value_));
} else if (constraint.name_.Equals(kNoiseReduction)) {
result.goog_noise_reduction.SetExact(ToBoolean(constraint.value_));
} else if (constraint.name_.Equals(kOfferToReceiveAudio)) {
// This constraint has formerly been defined both as a boolean
// and as an integer. Allow both forms.
if (constraint.value_.Equals("true"))
result.offer_to_receive_audio.SetExact(1);
else if (constraint.value_.Equals("false"))
result.offer_to_receive_audio.SetExact(0);
else
result.offer_to_receive_audio.SetExact(
atoi(constraint.value_.Utf8().c_str()));
} else if (constraint.name_.Equals(kOfferToReceiveVideo)) {
// This constraint has formerly been defined both as a boolean
// and as an integer. Allow both forms.
if (constraint.value_.Equals("true"))
result.offer_to_receive_video.SetExact(1);
else if (constraint.value_.Equals("false"))
result.offer_to_receive_video.SetExact(0);
else
result.offer_to_receive_video.SetExact(
atoi(constraint.value_.Utf8().c_str()));
} else if (constraint.name_.Equals(kVoiceActivityDetection)) {
result.voice_activity_detection.SetExact(ToBoolean(constraint.value_));
} else if (constraint.name_.Equals(kIceRestart)) {
result.ice_restart.SetExact(ToBoolean(constraint.value_));
} else if (constraint.name_.Equals(kEnableDtlsSrtp)) {
bool value = ToBoolean(constraint.value_);
if (value) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -274,22 +274,12 @@ bool MockRTCPeerConnectionHandlerPlatform::Initialize(
return true;
}

Vector<std::unique_ptr<RTCRtpTransceiverPlatform>>
MockRTCPeerConnectionHandlerPlatform::CreateOffer(RTCSessionDescriptionRequest*,
const MediaConstraints&) {
return {};
}

Vector<std::unique_ptr<RTCRtpTransceiverPlatform>>
MockRTCPeerConnectionHandlerPlatform::CreateOffer(RTCSessionDescriptionRequest*,
RTCOfferOptionsPlatform*) {
return {};
}

void MockRTCPeerConnectionHandlerPlatform::CreateAnswer(
RTCSessionDescriptionRequest*,
const MediaConstraints&) {}

void MockRTCPeerConnectionHandlerPlatform::CreateAnswer(
RTCSessionDescriptionRequest*,
RTCAnswerOptionsPlatform*) {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,14 +93,9 @@ class MockRTCPeerConnectionHandlerPlatform : public RTCPeerConnectionHandler {
void Close() override;
void CloseAndUnregister() override;

Vector<std::unique_ptr<RTCRtpTransceiverPlatform>> CreateOffer(
RTCSessionDescriptionRequest*,
const MediaConstraints&) override;
Vector<std::unique_ptr<RTCRtpTransceiverPlatform>> CreateOffer(
RTCSessionDescriptionRequest*,
RTCOfferOptionsPlatform*) override;
void CreateAnswer(RTCSessionDescriptionRequest*,
const MediaConstraints&) override;
void CreateAnswer(RTCSessionDescriptionRequest*,
RTCAnswerOptionsPlatform*) override;
void SetLocalDescription(RTCVoidRequest*) override;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -814,21 +814,9 @@ void PeerConnectionTracker::TrackCreateOffer(
"options: {" + SerializeOfferOptions(options) + "}");
}

void PeerConnectionTracker::TrackCreateOffer(
RTCPeerConnectionHandler* pc_handler,
const MediaConstraints& constraints) {
DCHECK_CALLED_ON_VALID_THREAD(main_thread_);
int id = GetLocalIDForHandler(pc_handler);
if (id == -1)
return;
SendPeerConnectionUpdate(
id, "createOffer",
"constraints: {" + SerializeMediaConstraints(constraints) + "}");
}

void PeerConnectionTracker::TrackCreateAnswer(
RTCPeerConnectionHandler* pc_handler,
blink::RTCAnswerOptionsPlatform* options) {
RTCAnswerOptionsPlatform* options) {
DCHECK_CALLED_ON_VALID_THREAD(main_thread_);
int id = GetLocalIDForHandler(pc_handler);
if (id == -1)
Expand All @@ -837,18 +825,6 @@ void PeerConnectionTracker::TrackCreateAnswer(
id, "createAnswer", "options: {" + SerializeAnswerOptions(options) + "}");
}

void PeerConnectionTracker::TrackCreateAnswer(
RTCPeerConnectionHandler* pc_handler,
const MediaConstraints& constraints) {
DCHECK_CALLED_ON_VALID_THREAD(main_thread_);
int id = GetLocalIDForHandler(pc_handler);
if (id == -1)
return;
SendPeerConnectionUpdate(
id, "createAnswer",
"constraints: {" + SerializeMediaConstraints(constraints) + "}");
}

void PeerConnectionTracker::TrackSetSessionDescription(
RTCPeerConnectionHandler* pc_handler,
const String& sdp,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,13 +124,8 @@ class MODULES_EXPORT PeerConnectionTracker
// the |constraints| is the media constraints used to create the offer/answer.
virtual void TrackCreateOffer(RTCPeerConnectionHandler* pc_handler,
RTCOfferOptionsPlatform* options);
// TODO(hta): Get rid of the version below.
virtual void TrackCreateOffer(RTCPeerConnectionHandler* pc_handler,
const MediaConstraints& options);
virtual void TrackCreateAnswer(RTCPeerConnectionHandler* pc_handler,
blink::RTCAnswerOptionsPlatform* options);
virtual void TrackCreateAnswer(RTCPeerConnectionHandler* pc_handler,
const MediaConstraints& constraints);

// Sends an update when setLocalDescription or setRemoteDescription is called.
virtual void TrackSetSessionDescription(RTCPeerConnectionHandler* pc_handler,
Expand Down

0 comments on commit 276b4b0

Please sign in to comment.