mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-01-30 18:31:08 +00:00
Bug 1019579: Check remote tracks immediately on SRD success. r=drno
MozReview-Commit-ID: B1gL2RJSszN --HG-- extra : rebase_source : 2609742ea748e4f4f10a1dd2f1313f68fdf0e07c
This commit is contained in:
parent
de01c6c54d
commit
bf8a5a183d
@ -184,7 +184,7 @@ var commandsCheckLargeXfer = [
|
||||
|
||||
function addInitialDataChannel(chain) {
|
||||
chain.insertBefore('PC_LOCAL_CREATE_OFFER', commandsCreateDataChannel);
|
||||
chain.insertBefore('PC_LOCAL_CHECK_MEDIA_TRACKS', commandsWaitForDataChannel);
|
||||
chain.insertBefore('PC_LOCAL_WAIT_FOR_MEDIA_FLOW', commandsWaitForDataChannel);
|
||||
chain.removeAfter('PC_REMOTE_CHECK_ICE_CONNECTIONS');
|
||||
chain.append(commandsCheckLargeXfer);
|
||||
chain.append(commandsCheckDataChannel);
|
||||
|
@ -409,6 +409,7 @@ function(peer, desc, stateExpected) {
|
||||
|
||||
var stateChanged = peer.setRemoteDescription(desc).then(() => {
|
||||
peer.setRemoteDescDate = new Date();
|
||||
peer.checkMediaTracks();
|
||||
});
|
||||
|
||||
return Promise.all([eventFired, stateChanged]);
|
||||
@ -1129,28 +1130,24 @@ PeerConnectionWrapper.prototype = {
|
||||
observedTrackInfoById[track.id] = expectedTrackInfoById[track.id];
|
||||
},
|
||||
|
||||
isTrackOnPC: function(track) {
|
||||
return this._pc.getRemoteStreams().some(stream => {
|
||||
return stream.getTracks().some(pcTrack => pcTrack.id == track.id);
|
||||
});
|
||||
},
|
||||
|
||||
allExpectedTracksAreObserved: function(expected, observed) {
|
||||
return Object.keys(expected).every(trackId => observed[trackId]);
|
||||
},
|
||||
|
||||
setupTrackEventHandler: function() {
|
||||
var resolveAllTrackEventsDone;
|
||||
|
||||
// checkMediaTracks waits on this promise later on in the test.
|
||||
this.allTrackEventsDonePromise =
|
||||
new Promise(resolve => resolveAllTrackEventsDone = resolve);
|
||||
|
||||
this._pc.addEventListener('track', event => {
|
||||
info(this + ": 'ontrack' event fired for " + JSON.stringify(event.track));
|
||||
|
||||
this.checkTrackIsExpected(event.track,
|
||||
this.expectedRemoteTrackInfoById,
|
||||
this.observedRemoteTrackInfoById);
|
||||
|
||||
if (this.allExpectedTracksAreObserved(this.expectedRemoteTrackInfoById,
|
||||
this.observedRemoteTrackInfoById)) {
|
||||
resolveAllTrackEventsDone();
|
||||
}
|
||||
ok(this.isTrackOnPC(event.track), "Found track " + event.track.id);
|
||||
|
||||
this.ensureMediaElement(event.track, event.streams[0], 'remote');
|
||||
});
|
||||
@ -1332,9 +1329,6 @@ PeerConnectionWrapper.prototype = {
|
||||
|
||||
/**
|
||||
* Checks that we are getting the media tracks we expect.
|
||||
*
|
||||
* @param {object} constraints
|
||||
* The media constraints of the remote peer connection object
|
||||
*/
|
||||
checkMediaTracks : function() {
|
||||
this.checkLocalMediaTracks();
|
||||
@ -1342,13 +1336,11 @@ PeerConnectionWrapper.prototype = {
|
||||
info(this + " Checking remote tracks " +
|
||||
JSON.stringify(this.expectedRemoteTrackInfoById));
|
||||
|
||||
// No tracks are expected
|
||||
if (this.allExpectedTracksAreObserved(this.expectedRemoteTrackInfoById,
|
||||
this.observedRemoteTrackInfoById)) {
|
||||
return;
|
||||
}
|
||||
|
||||
return timerGuard(this.allTrackEventsDonePromise, 60000, "The expected ontrack events never fired");
|
||||
ok(this.allExpectedTracksAreObserved(this.expectedRemoteTrackInfoById,
|
||||
this.observedRemoteTrackInfoById),
|
||||
"All expected tracks have been observed"
|
||||
+ "\nexpected: " + JSON.stringify(this.expectedRemoteTrackInfoById)
|
||||
+ "\nobserved: " + JSON.stringify(this.observedRemoteTrackInfoById));
|
||||
},
|
||||
|
||||
checkMsids: function() {
|
||||
@ -1374,7 +1366,11 @@ PeerConnectionWrapper.prototype = {
|
||||
|
||||
rollbackRemoteTracksIfNotNegotiated: function() {
|
||||
Object.keys(this.observedRemoteTrackInfoById).forEach(
|
||||
id => delete this.observedRemoteTrackInfoById[id]);
|
||||
id => {
|
||||
if (!this.observedRemoteTrackInfoById[id].negotiated) {
|
||||
delete this.observedRemoteTrackInfoById[id];
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -379,6 +379,7 @@ var commandsPeerConnectionOfferAnswer = [
|
||||
})
|
||||
.then(() => test.pcLocal.markRemoteTracksAsNegotiated());
|
||||
},
|
||||
|
||||
function PC_REMOTE_SANE_LOCAL_SDP(test) {
|
||||
test.pcRemote.localRequiresTrickleIce =
|
||||
sdputils.verifySdp(test._remote_answer, "answer",
|
||||
@ -413,14 +414,6 @@ var commandsPeerConnectionOfferAnswer = [
|
||||
return waitForAnIceCandidate(test.pcRemote);
|
||||
},
|
||||
|
||||
function PC_LOCAL_CHECK_MEDIA_TRACKS(test) {
|
||||
return test.pcLocal.checkMediaTracks();
|
||||
},
|
||||
|
||||
function PC_REMOTE_CHECK_MEDIA_TRACKS(test) {
|
||||
return test.pcRemote.checkMediaTracks();
|
||||
},
|
||||
|
||||
function PC_LOCAL_WAIT_FOR_MEDIA_FLOW(test) {
|
||||
return test.pcLocal.waitForMediaFlow();
|
||||
},
|
||||
|
@ -18,8 +18,8 @@
|
||||
commandsCreateDataChannel,
|
||||
commandsCheckDataChannel);
|
||||
|
||||
// Insert before the second PC_LOCAL_CHECK_MEDIA_TRACKS
|
||||
test.chain.insertBefore('PC_LOCAL_CHECK_MEDIA_TRACKS',
|
||||
// Insert before the second PC_LOCAL_WAIT_FOR_MEDIA_FLOW
|
||||
test.chain.insertBefore('PC_LOCAL_WAIT_FOR_MEDIA_FLOW',
|
||||
commandsWaitForDataChannel,
|
||||
false,
|
||||
1);
|
||||
|
@ -29,8 +29,8 @@
|
||||
),
|
||||
commandsCheckDataChannel);
|
||||
|
||||
// Insert before the second PC_LOCAL_CHECK_MEDIA_TRACKS
|
||||
test.chain.insertBefore('PC_LOCAL_CHECK_MEDIA_TRACKS',
|
||||
// Insert before the second PC_LOCAL_WAIT_FOR_MEDIA_FLOW
|
||||
test.chain.insertBefore('PC_LOCAL_WAIT_FOR_MEDIA_FLOW',
|
||||
commandsWaitForDataChannel,
|
||||
false,
|
||||
1);
|
||||
|
Loading…
x
Reference in New Issue
Block a user