Commit f0fc6257 authored by Harald Alvestrand's avatar Harald Alvestrand Committed by Commit Bot

Add counter for constraint EnableRtpDataChannels

This is the first step in removing the feature:
1) Count
2) Deprecate
3) Remove

Bug: webrtc:6625
Change-Id: Icd9ad6afa7cb427340d075680134fc5d85050353
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2270062
Commit-Queue: Harald Alvestrand <hta@chromium.org>
Reviewed-by: default avatarGuido Urdaneta <guidou@chromium.org>
Cr-Commit-Position: refs/heads/master@{#782935}
parent 2d47161a
......@@ -2677,6 +2677,8 @@ enum WebFeature {
kV8Window_ShowSaveFilePicker_Method = 3341,
kV8Window_ShowDirectoryPicker_Method = 3342,
kV8Window_GetOriginPrivateDirectory_Method = 3343,
kRTCConstraintEnableRtpDataChannelsTrue = 3344,
kRTCConstraintEnableRtpDataChannelsFalse = 3345,
// Add new features immediately above this line. Don't change assigned
// numbers of any item, and don't reuse removed slots.
......
......@@ -367,6 +367,14 @@ static void ParseOldStyleNames(
}
result.enable_dtls_srtp.SetExact(ToBoolean(constraint.value_));
} else if (constraint.name_.Equals(kEnableRtpDataChannels)) {
bool value = ToBoolean(constraint.value_);
if (value) {
UseCounter::Count(context,
WebFeature::kRTCConstraintEnableRtpDataChannelsTrue);
} else {
UseCounter::Count(context,
WebFeature::kRTCConstraintEnableRtpDataChannelsFalse);
}
result.enable_rtp_data_channels.SetExact(ToBoolean(constraint.value_));
} else if (constraint.name_.Equals(kEnableDscp)) {
result.enable_dscp.SetExact(ToBoolean(constraint.value_));
......
......@@ -23,6 +23,26 @@ promise_test(t => {
return promise_rejects_dom(t, "InvalidAccessError", pc.setRemoteDescription(sd));
}, 'Local RTP channel, remote offer of SCTP channel');
promise_test(async t => {
var pc = new RTCPeerConnection();
t.add_cleanup(() => pc.close());
pc.createDataChannel('');
offer = await pc.createOffer();
assert_regexp_match(offer.sdp, /m=application .* webrtc-datachannel/);
assert_equals(offer.sdp.match(/a=rtpmap:\d+ google-data/), null);
}, 'Asking for default Data Channels generates appropriate offer');
promise_test(async t => {
const rtpConstraints = { optional: [{ RtpDataChannels: true}]};
var pc = new RTCPeerConnection({}, rtpConstraints);
t.add_cleanup(() => pc.close());
pc.createDataChannel('');
offer = await pc.createOffer();
assert_equals(offer.sdp.match(/m=application .* webrtc-datachannel/), null);
assert_regexp_match(offer.sdp, /a=rtpmap:\d+ google-data/);
}, 'Asking for RTP Data Channels generates appropriate offer');
</script>
</body>
</html>
......@@ -28141,6 +28141,8 @@ Called by update_use_counter_feature_enum.py.-->
<int value="3341" label="V8Window_ShowSaveFilePicker_Method"/>
<int value="3342" label="V8Window_ShowDirectoryPicker_Method"/>
<int value="3343" label="V8Window_GetOriginPrivateDirectory_Method"/>
<int value="3344" label="RTCConstraintEnableRtpDataChannelsTrue"/>
<int value="3345" label="RTCConstraintEnableRtpDataChannelsFalse"/>
</enum>
<enum name="FeaturePolicyAllowlistType">
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment