mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-02 01:48:05 +00:00
Bug 1064223 - Remove support for constraint-like RTCOfferOptions predecessor. r=mt
--HG-- extra : rebase_source : 658c53861ba9ac3f887e92e68b200953bde63947
This commit is contained in:
parent
256da665f0
commit
ed823deab2
@ -679,7 +679,7 @@ RTCPeerConnection.prototype = {
|
||||
options = optionsOrOnSuccess;
|
||||
}
|
||||
return this._legacyCatch(onSuccess, onError, () => {
|
||||
// TODO: Remove old constraint-like RTCOptions support soon (Bug 1064223).
|
||||
// TODO: Remove error on constraint-like RTCOptions next cycle (1197021).
|
||||
// Note that webidl bindings make o.mandatory implicit but not o.optional.
|
||||
function convertLegacyOptions(o) {
|
||||
// Detect (mandatory OR optional) AND no other top-level members.
|
||||
@ -716,10 +716,11 @@ RTCPeerConnection.prototype = {
|
||||
}
|
||||
|
||||
if (options && convertLegacyOptions(options)) {
|
||||
this.logWarning(
|
||||
"Mandatory/optional in createOffer options is deprecated! Use " +
|
||||
this.logError(
|
||||
"Mandatory/optional in createOffer options no longer works! Use " +
|
||||
JSON.stringify(options) + " instead (note the case difference)!",
|
||||
null, 0);
|
||||
options = {};
|
||||
}
|
||||
|
||||
let origin = Cu.getWebIDLCallerPrincipal().origin;
|
||||
|
@ -89,6 +89,7 @@ skip-if = toolkit == 'gonk' || buildapp == 'mulet' # b2g(Bug 960442, video suppo
|
||||
skip-if = toolkit == 'gonk' # B2G emulator is too slow to handle a two-way audio call reliably
|
||||
[test_peerConnection_bug1042791.html]
|
||||
skip-if = buildapp == 'b2g' || buildapp == 'mulet' || os == 'android' # bug 1043403 # Bug 1141029 Mulet parity with B2G Desktop for TC
|
||||
[test_peerConnection_bug1064223.html]
|
||||
[test_peerConnection_capturedVideo.html]
|
||||
tags=capturestream
|
||||
skip-if = toolkit == 'gonk' || buildapp == 'mulet' # b2g(Bug 960442, video support for WebRTC is disabled on b2g)
|
||||
|
@ -1254,62 +1254,6 @@ PeerConnectionWrapper.prototype = {
|
||||
return constraints.reduce((sum, c) => sum + (c[type] ? 1 : 0), 0);
|
||||
},
|
||||
|
||||
/**
|
||||
* Checks for audio in given offer options.
|
||||
*
|
||||
* @param options
|
||||
* The options to be examined.
|
||||
*/
|
||||
audioInOfferOptions : function(options) {
|
||||
if (!options) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
var offerToReceiveAudio = options.offerToReceiveAudio;
|
||||
|
||||
// TODO: Remove tests of old constraint-like RTCOptions soon (Bug 1064223).
|
||||
if (options.mandatory && options.mandatory.OfferToReceiveAudio !== undefined) {
|
||||
offerToReceiveAudio = options.mandatory.OfferToReceiveAudio;
|
||||
} else if (options.optional && options.optional[0] &&
|
||||
options.optional[0].OfferToReceiveAudio !== undefined) {
|
||||
offerToReceiveAudio = options.optional[0].OfferToReceiveAudio;
|
||||
}
|
||||
|
||||
if (offerToReceiveAudio) {
|
||||
return 1;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Checks for video in given offer options.
|
||||
*
|
||||
* @param options
|
||||
* The options to be examined.
|
||||
*/
|
||||
videoInOfferOptions : function(options) {
|
||||
if (!options) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
var offerToReceiveVideo = options.offerToReceiveVideo;
|
||||
|
||||
// TODO: Remove tests of old constraint-like RTCOptions soon (Bug 1064223).
|
||||
if (options.mandatory && options.mandatory.OfferToReceiveVideo !== undefined) {
|
||||
offerToReceiveVideo = options.mandatory.OfferToReceiveVideo;
|
||||
} else if (options.optional && options.optional[0] &&
|
||||
options.optional[0].OfferToReceiveVideo !== undefined) {
|
||||
offerToReceiveVideo = options.optional[0].OfferToReceiveVideo;
|
||||
}
|
||||
|
||||
if (offerToReceiveVideo) {
|
||||
return 1;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
},
|
||||
|
||||
checkLocalMediaTracks : function() {
|
||||
var observed = {};
|
||||
info(this + " Checking local tracks " + JSON.stringify(this.expectedLocalTrackInfoById));
|
||||
@ -1386,7 +1330,7 @@ PeerConnectionWrapper.prototype = {
|
||||
|
||||
var audioTracks =
|
||||
this.countTracksInConstraint('audio', offerConstraintsList) ||
|
||||
this.audioInOfferOptions(offerOptions);
|
||||
((offerOptions && offerOptions.offerToReceiveAudio) ? 1 : 0);
|
||||
|
||||
info("expected audio tracks: " + audioTracks);
|
||||
if (audioTracks == 0) {
|
||||
@ -1401,7 +1345,7 @@ PeerConnectionWrapper.prototype = {
|
||||
|
||||
var videoTracks =
|
||||
this.countTracksInConstraint('video', offerConstraintsList) ||
|
||||
this.videoInOfferOptions(offerOptions);
|
||||
((offerOptions && offerOptions.offerToReceiveVideo) ? 1 : 0);
|
||||
|
||||
info("expected video tracks: " + videoTracks);
|
||||
if (videoTracks == 0) {
|
||||
@ -1767,11 +1711,11 @@ PeerConnectionWrapper.prototype = {
|
||||
// codec mismatch or other unrecoverable negotiation failures.
|
||||
var numAudioTracks =
|
||||
this.countTracksInConstraint('audio', offerConstraintsList) ||
|
||||
this.audioInOfferOptions(offerOptions);
|
||||
((offerOptions && offerOptions.offerToReceiveAudio) ? 1 : 0);
|
||||
|
||||
var numVideoTracks =
|
||||
this.countTracksInConstraint('video', offerConstraintsList) ||
|
||||
this.videoInOfferOptions(offerOptions);
|
||||
((offerOptions && offerOptions.offerToReceiveVideo) ? 1 : 0);
|
||||
|
||||
var numDataTracks = this.dataChannels.length;
|
||||
|
||||
|
@ -0,0 +1,31 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<script type="application/javascript" src="pc.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<pre id="test">
|
||||
<script type="application/javascript">
|
||||
createHTML({
|
||||
bug: "1064223",
|
||||
title: "CreateOffer fails without streams or modern RTCOfferOptions"
|
||||
});
|
||||
|
||||
runNetworkTest(function () {
|
||||
var pc = new mozRTCPeerConnection();
|
||||
var options = { mandatory: { OfferToReceiveVideo: true } }; // obsolete
|
||||
|
||||
pc.createOffer(options).then(() => ok(false, "createOffer must fail"),
|
||||
e => is(e.name, "InternalError",
|
||||
"createOffer must fail"))
|
||||
.catch(e => ok(false, e.message))
|
||||
.then(() => {
|
||||
pc.close();
|
||||
networkTestFinished();
|
||||
})
|
||||
.catch(e => ok(false, e.message));
|
||||
});
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
@ -14,9 +14,7 @@
|
||||
runNetworkTest(function() {
|
||||
var test = new PeerConnectionTest();
|
||||
test.setMediaConstraints([], [{audio: true}]);
|
||||
// TODO: Stop using old constraint-like RTCOptions soon (Bug 1064223).
|
||||
// Watch out for case-difference when fixing: { offerToReceiveAudio: true }
|
||||
test.setOfferOptions({ mandatory: { OfferToReceiveAudio: true } });
|
||||
test.setOfferOptions({ offerToReceiveAudio: true });
|
||||
test.run();
|
||||
});
|
||||
</script>
|
||||
|
@ -14,9 +14,7 @@
|
||||
runNetworkTest(function() {
|
||||
var test = new PeerConnectionTest();
|
||||
test.setMediaConstraints([], [{video: true}]);
|
||||
// TODO: Stop using old constraint-like RTCOptions soon (Bug 1064223).
|
||||
// Watch out for case-difference when fixing: { offerToReceiveVideo: true }
|
||||
test.setOfferOptions({ optional: [{ OfferToReceiveVideo: true }] });
|
||||
test.setOfferOptions({ offerToReceiveVideo: true });
|
||||
test.run();
|
||||
});
|
||||
</script>
|
||||
|
Loading…
Reference in New Issue
Block a user