Backed out 3 changesets (bug 1232082) for wpt bustage in rtcpeerconnection-idl.html

Backed out changeset ec89afa7163c (bug 1232082)
Backed out changeset 47de4d036349 (bug 1232082)
Backed out changeset a595577a8247 (bug 1232082)

--HG--
extra : commitid : 6KuHiKS94jA
This commit is contained in:
Wes Kocher 2016-01-12 11:07:51 -08:00
Родитель 241c9dbf7c
Коммит cadac86336
11 изменённых файлов: 53 добавлений и 152 удалений

Просмотреть файл

@ -449,9 +449,6 @@ const kEventConstructors = {
return new RTCPeerConnectionIceEvent(aName, aProps);
},
},
RTCTrackEvent: {
// Difficult to test required arguments.
},
ScrollAreaEvent: { create: function (aName, aProps) {
var e = document.createEvent("scrollareaevent");
e.initScrollAreaEvent(aName, aProps.bubbles, aProps.cancelable,

Просмотреть файл

@ -405,9 +405,8 @@ RTCPeerConnection.prototype = {
"InvalidStateError");
}
this.makeGetterSetterEH("ontrack");
this.makeLegacyGetterSetterEH("onaddstream", "Use peerConnection.ontrack instead.");
this.makeLegacyGetterSetterEH("onaddtrack", "Use peerConnection.ontrack instead.");
this.makeGetterSetterEH("onaddstream");
this.makeGetterSetterEH("onaddtrack");
this.makeGetterSetterEH("onicecandidate");
this.makeGetterSetterEH("onnegotiationneeded");
this.makeGetterSetterEH("onsignalingstatechange");
@ -664,18 +663,6 @@ RTCPeerConnection.prototype = {
});
},
makeLegacyGetterSetterEH: function(name, msg) {
Object.defineProperty(this, name,
{
get:function() { return this.getEH(name); },
set:function(h) {
this.logWarning(name + " is deprecated! " + msg,
null, 0);
return this.setEH(name, h);
}
});
},
_addIdentityAssertion: function(sdpPromise, origin) {
if (!this._localIdp.enabled) {
return sdpPromise;
@ -1366,16 +1353,15 @@ PeerConnectionObserver.prototype = {
// STUN requests.
handleIceConnectionStateChange: function(iceConnectionState) {
let pc = this._dompc;
if (pc.iceConnectionState === 'new') {
if (this._dompc.iceConnectionState === 'new') {
var checking_histogram = Services.telemetry.getHistogramById("WEBRTC_ICE_CHECKING_RATE");
if (iceConnectionState === 'checking') {
checking_histogram.add(true);
} else if (iceConnectionState === 'failed') {
checking_histogram.add(false);
}
} else if (pc.iceConnectionState === 'checking') {
var success_histogram = Services.telemetry.getHistogramById(pc._isLoop ?
} else if (this._dompc.iceConnectionState === 'checking') {
var success_histogram = Services.telemetry.getHistogramById(this._dompc._isLoop ?
"LOOP_ICE_SUCCESS_RATE" : "WEBRTC_ICE_SUCCESS_RATE");
if (iceConnectionState === 'completed' ||
iceConnectionState === 'connected') {
@ -1386,10 +1372,10 @@ PeerConnectionObserver.prototype = {
}
if (iceConnectionState === 'failed') {
pc.logError("ICE failed, see about:webrtc for more details", null, 0);
this._dompc.logError("ICE failed, see about:webrtc for more details", null, 0);
}
pc.changeIceConnectionState(iceConnectionState);
this._dompc.changeIceConnectionState(iceConnectionState);
},
// This method is responsible for updating iceGatheringState. This
@ -1444,11 +1430,11 @@ PeerConnectionObserver.prototype = {
},
onGetStatsSuccess: function(dict) {
let pc = this._dompc;
let chromeobj = new RTCStatsReport(pc._win, dict);
let webidlobj = pc._win.RTCStatsReport._create(pc._win, chromeobj);
let chromeobj = new RTCStatsReport(this._dompc._win, dict);
let webidlobj = this._dompc._win.RTCStatsReport._create(this._dompc._win,
chromeobj);
chromeobj.makeStatsPublic();
pc._onGetStatsSuccess(webidlobj);
this._dompc._onGetStatsSuccess(webidlobj);
},
onGetStatsError: function(code, message) {
@ -1461,34 +1447,20 @@ PeerConnectionObserver.prototype = {
this.dispatchEvent(ev);
},
onRemoveStream: function(stream) {
onRemoveStream: function(stream, type) {
this.dispatchEvent(new this._dompc._win.MediaStreamEvent("removestream",
{ stream: stream }));
},
onAddTrack: function(track, streams) {
let pc = this._dompc;
let receiver = pc._win.RTCRtpReceiver._create(pc._win,
new RTCRtpReceiver(this,
track));
pc._receivers.push(receiver);
let ev = new pc._win.RTCTrackEvent("track",
{ receiver: receiver,
track: track,
streams: streams });
this.dispatchEvent(ev);
// Fire legacy event as well for a little bit.
ev = new pc._win.MediaStreamTrackEvent("addtrack", { track: track });
onAddTrack: function(track) {
let ev = new this._dompc._win.MediaStreamTrackEvent("addtrack",
{ track: track });
this.dispatchEvent(ev);
},
onRemoveTrack: function(track) {
let pc = this._dompc;
let i = pc._receivers.findIndex(receiver => receiver.track == track);
if (i >= 0) {
pc._receivers.splice(i, 1);
}
onRemoveTrack: function(track, type) {
this.dispatchEvent(new this._dompc._win.MediaStreamTrackEvent("removetrack",
{ track: track }));
},
onReplaceTrackSuccess: function() {
@ -1562,7 +1534,7 @@ RTCRtpSender.prototype = {
};
function RTCRtpReceiver(pc, track) {
this._pc = pc;
this.pc = pc;
this.track = track;
}
RTCRtpReceiver.prototype = {

Просмотреть файл

@ -1393,9 +1393,6 @@ PeerConnectionWrapper.prototype = {
var rtpStatsKey = Object.keys(stats)
.find(key => !stats[key].isRemote && stats[key].type.endsWith("boundrtp"));
ok(rtpStatsKey, "Should have RTP stats for track " + track.id);
if (!rtpStatsKey) {
return false;
}
var rtp = stats[rtpStatsKey];
var nrPackets = rtp[rtp.type == "outboundrtp" ? "packetsSent"
: "packetsReceived"];
@ -1404,12 +1401,21 @@ PeerConnectionWrapper.prototype = {
return nrPackets > 0;
};
return new Promise(resolve => {
info("Checking RTP packet flow for track " + track.id);
var retry = () => this._pc.getStats(track)
.then(stats => hasFlow(stats)? ok(true, "RTP flowing for track " + track.id) :
wait(200).then(retry));
return retry();
var waitForFlow = () => {
this._pc.getStats(track).then(stats => {
if (hasFlow(stats)) {
ok(true, "RTP flowing for track " + track.id);
resolve();
} else {
wait(200).then(waitForFlow);
}
});
};
waitForFlow();
});
},
/**

Просмотреть файл

@ -15,33 +15,19 @@
var pc1 = new RTCPeerConnection();
var pc2 = new RTCPeerConnection();
var add = (pc, can, failed) => can && pc.addIceCandidate(can).catch(failed);
pc1.onicecandidate = e => add(pc2, e.candidate, generateErrorCallback());
pc2.onicecandidate = e => add(pc1, e.candidate, generateErrorCallback());
var pc2_haveRemoteOffer = new Promise(resolve => pc2.onsignalingstatechange =
e => (e.target.signalingState == "have-remote-offer") && resolve());
var pc1_stable = new Promise(resolve => pc1.onsignalingstatechange =
e => (e.target.signalingState == "stable") && resolve());
function mustThrowWith(msg, reason, f) {
try {
f();
ok(false, msg + " must throw");
} catch (e) {
is(e.name, reason, msg + " must throw: " + e.message);
}
};
pc1.onicecandidate = e => pc2_haveRemoteOffer.then(() => !e.candidate ||
pc2.addIceCandidate(e.candidate)).catch(generateErrorCallback());
pc2.onicecandidate = e => pc1_stable.then(() => !e.candidate ||
pc1.addIceCandidate(e.candidate)).catch(generateErrorCallback());
var v1, v2;
var delivered = new Promise(resolve => pc2.ontrack = e => {
// Test RTCTrackEvent here.
ok(e.streams.length > 0, "has streams");
ok(e.streams[0].getTracks().some(track => track == e.track), "has track");
ok(pc2.getReceivers().some(receiver => receiver == e.receiver), "has receiver");
if (e.streams[0].getTracks().length == 2) {
// Test RTCTrackEvent required args here.
mustThrowWith("RTCTrackEvent wo/required args",
"TypeError", () => new RTCTrackEvent("track", {}));
v2.srcObject = e.streams[0];
resolve();
}
});
var delivered = new Promise(resolve =>
pc2.onaddstream = e => resolve(v2.srcObject = e.stream));
runNetworkTest(function() {
v1 = createMediaElement('video', 'v1');
@ -51,7 +37,7 @@
is(v2.currentTime, 0, "v2.currentTime is zero at outset");
navigator.mediaDevices.getUserMedia({ video: true, audio: true })
.then(stream => (v1.srcObject = stream).getTracks().forEach(t => pc1.addTrack(t, stream)))
.then(stream => pc1.addStream(v1.srcObject = stream))
.then(() => pc1.createOffer({})) // check that createOffer accepts arg.
.then(offer => pc1.setLocalDescription(offer))
.then(() => pc2.setRemoteDescription(pc1.localDescription))

Просмотреть файл

@ -19,13 +19,6 @@
.some(sn => sn.track == t))) // that's being sent over |pc|.
}
function allRemoteStreamsHaveReceiver(pc) {
return pc.getRemoteStreams()
.every(s => s.getTracks() // Every remote stream,
.some(t => pc.getReceivers() // should have some track,
.some(sn => sn.track == t))) // that's being received over |pc|.
}
function replacetest(wrapper) {
var pc = wrapper._pc;
var oldSenderCount = pc.getSenders().length;
@ -33,9 +26,7 @@
var oldTrack = sender.track;
ok(sender, "We have a sender for video");
ok(allLocalStreamsHaveSender(pc),
"Shouldn't have any local streams without a corresponding sender");
ok(allRemoteStreamsHaveReceiver(pc),
"Shouldn't have any remote streams without a corresponding receiver");
"Shouldn't have any streams without a corresponding sender");
var newTrack;
var audiotrack;

Просмотреть файл

@ -997,8 +997,6 @@ var interfaceNamesInGlobalScope =
"RTCSessionDescription",
// IMPORTANT: Do not change this list without review from a DOM peer!
"RTCStatsReport",
// IMPORTANT: Do not change this list without review from a DOM peer!
"RTCTrackEvent",
// IMPORTANT: Do not change this list without review from a DOM peer!
"Screen",
// IMPORTANT: Do not change this list without review from a DOM peer!

Просмотреть файл

@ -42,6 +42,6 @@ interface PeerConnectionObserver
/* Changes to MediaStreamTracks */
void onAddStream(MediaStream stream);
void onRemoveStream(MediaStream stream);
void onAddTrack(MediaStreamTrack track, sequence<MediaStream> streams);
void onAddTrack(MediaStreamTrack track);
void onRemoveTrack(MediaStreamTrack track);
};

Просмотреть файл

@ -141,9 +141,8 @@ interface RTCPeerConnection : EventTarget {
attribute EventHandler onnegotiationneeded;
attribute EventHandler onicecandidate;
attribute EventHandler onsignalingstatechange;
attribute EventHandler onaddstream; // obsolete
attribute EventHandler onaddtrack; // obsolete
attribute EventHandler ontrack; // replaces onaddtrack and onaddstream.
attribute EventHandler onaddstream;
attribute EventHandler onaddtrack; // replaces onaddstream; see AddTrackEvent
attribute EventHandler onremovestream;
attribute EventHandler oniceconnectionstatechange;

Просмотреть файл

@ -1,27 +0,0 @@
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/.
*
* The origin of this IDL file is
* http://w3c.github.io/webrtc-pc/#idl-def-RTCTrackEvent
*/
dictionary RTCTrackEventInit : EventInit {
required RTCRtpReceiver receiver;
required MediaStreamTrack track;
sequence<MediaStream> streams = [];
};
[Pref="media.peerconnection.enabled",
Constructor(DOMString type, RTCTrackEventInit eventInitDict)]
interface RTCTrackEvent : Event {
readonly attribute RTCRtpReceiver receiver;
readonly attribute MediaStreamTrack track;
// TODO: Use FrozenArray once available. (Bug 1236777)
// readonly attribute FrozenArray<MediaStream> streams;
[Frozen, Cached, Pure]
readonly attribute sequence<MediaStream> streams; // workaround
};

Просмотреть файл

@ -836,7 +836,6 @@ if CONFIG['MOZ_WEBRTC']:
'MediaStreamTrackEvent.webidl',
'RTCDataChannelEvent.webidl',
'RTCPeerConnectionIceEvent.webidl',
'RTCTrackEvent.webidl',
]
if CONFIG['MOZ_WEBSPEECH']:

Просмотреть файл

@ -187,7 +187,6 @@ public:
virtual void NotifyTracksAvailable(DOMMediaStream* aStream) override
{
MOZ_ASSERT(NS_IsMainThread());
MOZ_ASSERT(aStream);
PeerConnectionWrapper wrapper(mPcHandle);
@ -201,13 +200,6 @@ public:
std::string streamId = PeerConnectionImpl::GetStreamId(*aStream);
bool notifyStream = true;
Sequence<OwningNonNull<DOMMediaStream>> streams;
if (!streams.AppendElement(OwningNonNull<DOMMediaStream>(*aStream),
fallible)) {
MOZ_ASSERT(false);
return;
}
for (size_t i = 0; i < tracks.Length(); i++) {
std::string trackId;
// This is the first chance we get to set the string track id on this
@ -239,7 +231,7 @@ public:
JSErrorResult jrv;
CSFLogInfo(logTag, "Calling OnAddTrack(%s)", trackId.c_str());
mObserver->OnAddTrack(*tracks[i], streams, jrv);
mObserver->OnAddTrack(*tracks[i], jrv);
if (jrv.Failed()) {
CSFLogError(logTag, ": OnAddTrack(%u) failed! Error: %u",
static_cast<unsigned>(i),
@ -1868,31 +1860,19 @@ PeerConnectionImpl::SetRemoteDescription(int32_t action, const char* aSDP)
mJsepSession->GetRemoteTracksRemoved();
for (auto i = removedTracks.begin(); i != removedTracks.end(); ++i) {
const std::string& streamId = (*i)->GetStreamId();
const std::string& trackId = (*i)->GetTrackId();
RefPtr<RemoteSourceStreamInfo> info = mMedia->GetRemoteStreamById(streamId);
RefPtr<RemoteSourceStreamInfo> info =
mMedia->GetRemoteStreamById((*i)->GetStreamId());
if (!info) {
MOZ_ASSERT(false, "A stream/track was removed that wasn't in PCMedia. "
"This is a bug.");
continue;
}
mMedia->RemoveRemoteTrack(streamId, trackId);
DOMMediaStream* stream = info->GetMediaStream();
nsTArray<RefPtr<MediaStreamTrack>> tracks;
stream->GetTracks(tracks);
for (auto& track : tracks) {
if (PeerConnectionImpl::GetTrackId(*track) == trackId) {
pco->OnRemoveTrack(*track, jrv);
break;
}
}
mMedia->RemoveRemoteTrack((*i)->GetStreamId(), (*i)->GetTrackId());
// We might be holding the last ref, but that's ok.
if (!info->GetTrackCount()) {
pco->OnRemoveStream(*stream, jrv);
pco->OnRemoveStream(*info->GetMediaStream(), jrv);
}
}