Index: content/test/data/media/peerconnection-call.html |
diff --git a/content/test/data/media/peerconnection-call.html b/content/test/data/media/peerconnection-call.html |
index 511380dfe2ea2ef41f55f9e2a42013534c522f4f..dc2e53e8a93e11b9821009ae1e31156f188aa2aa 100644 |
--- a/content/test/data/media/peerconnection-call.html |
+++ b/content/test/data/media/peerconnection-call.html |
@@ -159,7 +159,7 @@ |
waitForVideo('remote-view-2'); |
}); |
} |
- |
+ |
// Test that we can setup call with an audio and video track and |
// simulate that the remote peer don't support MSID. |
function callWithoutMsidAndBundle() { |
@@ -325,49 +325,76 @@ |
offerOptions); |
} |
- function enableRemoteVideo(peerConnection, enabled) { |
- remoteStream = peerConnection.getRemoteStreams()[0]; |
- remoteVideoTrack = remoteStream.getVideoTracks()[0]; |
- remoteVideoTrack.enabled = enabled; |
- } |
+ function ensureAudioPlaying(beLenient) { |
+ addExpectedEvent(); |
- function enableRemoteAudio(peerConnection, enabled) { |
- remoteStream = peerConnection.getRemoteStreams()[0]; |
- remoteAudioTrack = remoteStream.getAudioTracks()[0]; |
- remoteAudioTrack.enabled = enabled; |
+ // Gather 50 samples per second for 2 seconds. |
+ gatherAudioLevelSamples(gSecondConnection, 100, 50, function(samples) { |
+ verifyAudioIsPlaying(samples, beLenient); |
+ eventOccured(); |
+ }); |
} |
function callAndEnsureAudioIsPlaying(beLenient, constraints) { |
createConnections(null); |
+ |
+ // Add the local stream to gFirstConnection to play one-way audio. |
navigator.webkitGetUserMedia(constraints, |
- addStreamToBothConnectionsAndNegotiate, printGetUserMediaError); |
+ addStreamToTheFirstConnectionAndNegotiate, printGetUserMediaError); |
- // Wait until we have gathered samples and can conclude if audio is playing. |
- addExpectedEvent(); |
var onCallEstablished = function() { |
- // Gather 50 samples per second for 2 seconds. |
- gatherAudioLevelSamples(gSecondConnection, 100, 50, function(samples) { |
- verifyAudioIsPlaying(samples, beLenient); |
- eventOccured(); |
- }); |
+ ensureAudioPlaying(beLenient); |
}; |
waitForConnectionToStabilize(gFirstConnection, onCallEstablished); |
} |
- function callAndEnsureAudioTrackMutingWorks(beLenient) { |
+ function enableRemoteVideo(peerConnection, enabled) { |
+ remoteStream = peerConnection.getRemoteStreams()[0]; |
+ remoteStream.getVideoTracks()[0].enabled = enabled; |
perkj_chrome
2014/08/14 08:53:41
nit add assert that stream 0 and video track 0 exi
phoglund_chromium
2014/08/25 09:41:45
I think that will be a lot of code that doesn't ma
perkj_chrome
2014/08/25 12:05:47
Acknowledged.
|
+ } |
+ |
+ function enableRemoteAudio(peerConnection, enabled) { |
+ remoteStream = peerConnection.getRemoteStreams()[0]; |
+ remoteStream.getAudioTracks()[0].enabled = enabled; |
+ } |
+ |
+ function enableLocalVideo(peerConnection, enabled) { |
+ localStream = peerConnection.getLocalStreams()[0]; |
+ localStream.getVideoTracks()[0].enabled = enabled; |
+ } |
+ |
+ function enableLocalAudio(peerConnection, enabled) { |
+ localStream = peerConnection.getLocalStreams()[0]; |
+ localStream.getAudioTracks()[0].enabled = enabled; |
+ } |
+ |
+ function ensureSilence() { |
+ setTimeout(function() { |
+ gatherAudioLevelSamples(gSecondConnection, 100, 50, function(samples) { |
+ verifyIsSilent(samples); |
+ reportTestSuccess(); |
perkj_chrome
2014/08/14 08:53:41
Why reportTextSuccess? Why not add addExpectedEven
phoglund_chromium
2014/08/25 09:41:45
Done.
|
+ }); |
+ }, 500); |
+ } |
+ |
+ function callAndEnsureRemoteAudioTrackMutingWorks(beLenient) { |
callAndEnsureAudioIsPlaying(beLenient, {audio: true, video: true}); |
setAllEventsOccuredHandler(function() { |
- // Call is up, now mute the track and check everything goes silent (give |
- // it a small delay though, we don't expect it to happen instantly). |
+ // Call is up, now mute the remote track and check we stop playing out |
+ // audio (after a small delay, we don't expect it to happen instantly). |
enableRemoteAudio(gSecondConnection, false); |
+ ensureSilence(); |
perkj_chrome
2014/08/14 08:53:42
ie - change ensureSilence and call setAllEventsOcc
phoglund_chromium
2014/08/25 09:41:45
Done.
|
+ }); |
+ } |
- setTimeout(function() { |
- gatherAudioLevelSamples(gSecondConnection, 100, 50, function(samples) { |
- verifyIsSilent(samples); |
- reportTestSuccess(); |
- }); |
- }, 500); |
+ function callAndEnsureLocalAudioTrackMutingWorks(beLenient) { |
+ callAndEnsureAudioIsPlaying(beLenient, {audio: true, video: true}); |
+ setAllEventsOccuredHandler(function() { |
+ // Call is up, now mute the local track of the sending side and ensure |
+ // the receiving side stops receiving audio. |
+ enableLocalAudio(gFirstConnection, false); |
+ ensureSilence(); |
}); |
} |
@@ -394,6 +421,24 @@ |
}); |
} |
+ function callAndEnsureLocalVideoMutingDoesntMuteAudio(beLenient) { |
+ callAndEnsureAudioIsPlaying(beLenient, {audio: true, video: true}); |
perkj_chrome
2014/08/14 08:53:42
The problem we had is that the media player expect
phoglund_chromium
2014/08/14 09:17:37
Yes. I tried that, and it repros, but the problem
|
+ setAllEventsOccuredHandler(function() { |
+ setAllEventsOccuredHandler(reportTestSuccess); |
+ enableLocalVideo(gFirstConnection, false); |
+ ensureAudioPlaying(beLenient); |
+ }); |
+ } |
+ |
+ function callAndEnsureRemoteVideoMutingDoesntMuteAudio(beLenient) { |
+ callAndEnsureAudioIsPlaying(beLenient, {audio: true, video: true}); |
+ setAllEventsOccuredHandler(function() { |
+ setAllEventsOccuredHandler(reportTestSuccess); |
+ enableRemoteVideo(gSecondConnection, false); |
+ ensureAudioPlaying(beLenient); |
+ }); |
+ } |
+ |
function callAndEnsureVideoTrackMutingWorks() { |
createConnections(null); |
navigator.webkitGetUserMedia({audio: true, video: true}, |
@@ -874,16 +919,16 @@ |
<td>Remote Stream for Connection 4</td> |
</tr> |
<tr> |
- <td><video width="320" height="240" id="local-view" |
- autoplay="autoplay"></video></td> |
- <td><video width="320" height="240" id="remote-view-1" |
- autoplay="autoplay"></video></td> |
- <td><video width="320" height="240" id="remote-view-2" |
- autoplay="autoplay"></video></td> |
- <td><video width="320" height="240" id="remote-view-3" |
- autoplay="autoplay"></video></td> |
- <td><video width="320" height="240" id="remote-view-4" |
- autoplay="autoplay"></video></td> |
+ <td><video width="320" height="240" id="local-view" autoplay muted> |
+ </video></td> |
+ <td><video width="320" height="240" id="remote-view-1" autoplay> |
+ </video></td> |
+ <td><video width="320" height="240" id="remote-view-2" autoplay> |
+ </video></td> |
+ <td><video width="320" height="240" id="remote-view-3" autoplay> |
+ </video></td> |
+ <td><video width="320" height="240" id="remote-view-4" autoplay> |
+ </video></td> |
<!-- Canvases are named after their corresponding video elements. --> |
<td><canvas width="320" height="240" id="remote-view-1-canvas" |
style="display:none"></canvas></td> |