Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(416)

Side by Side Diff: content/test/data/media/peerconnection-call.html

Issue 1138073003: Endowing WebRTC DTMF test with better resistance to gc(). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 <html> 1 <html>
2 <head> 2 <head>
3 <script type="text/javascript" src="webrtc_test_utilities.js"></script> 3 <script type="text/javascript" src="webrtc_test_utilities.js"></script>
4 <script type="text/javascript" src="webrtc_test_audio.js"></script> 4 <script type="text/javascript" src="webrtc_test_audio.js"></script>
5 <script type="text/javascript"> 5 <script type="text/javascript">
6 $ = function(id) { 6 $ = function(id) {
7 return document.getElementById(id); 7 return document.getElementById(id);
8 }; 8 };
9 9
10 window.onerror = function(errorMsg, url, lineNumber, column, errorObj) { 10 window.onerror = function(errorMsg, url, lineNumber, column, errorObj) {
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 150
151 var onCallEstablished = function() { 151 var onCallEstablished = function() {
152 ensureAudioPlaying(gSecondConnection, beLenient); 152 ensureAudioPlaying(gSecondConnection, beLenient);
153 }; 153 };
154 154
155 waitForConnectionToStabilize(gFirstConnection, onCallEstablished); 155 waitForConnectionToStabilize(gFirstConnection, onCallEstablished);
156 }); 156 });
157 } 157 }
158 158
159 // First makes a call between pc1 and pc2 where a stream is sent from pc1 to 159 // First makes a call between pc1 and pc2 where a stream is sent from pc1 to
160 // pc2. The stream sent from pc1 to pc2 is cloned from the stream received on 160 // pc2. The stream sent from pc1 to pc2 is cloned from the stream received on
161 // pc2 to test that cloning of remote video tracks works as intended and is 161 // pc2 to test that cloning of remote video tracks works as intended and is
162 // sent back to pc1. 162 // sent back to pc1.
163 function callAndForwardRemoteStream(constraints) { 163 function callAndForwardRemoteStream(constraints) {
164 createConnections(null); 164 createConnections(null);
165 navigator.webkitGetUserMedia(constraints, 165 navigator.webkitGetUserMedia(constraints,
166 addStreamToTheFirstConnectionAndNegotiate, 166 addStreamToTheFirstConnectionAndNegotiate,
167 printGetUserMediaError); 167 printGetUserMediaError);
168 var onRemoteStream2 = function() { 168 var onRemoteStream2 = function() {
169 // Video has been detected to be playing in pc2. Clone the received 169 // Video has been detected to be playing in pc2. Clone the received
170 // stream and send it back to pc1. 170 // stream and send it back to pc1.
171 gSecondConnection.addStream(gRemoteStreams['remote-view-2'].clone()); 171 gSecondConnection.addStream(gRemoteStreams['remote-view-2'].clone());
172 negotiate(); 172 negotiate();
173 } 173 }
174 174
175 // Wait for remove video to be playing in pc2. Once video is playing, 175 // Wait for remove video to be playing in pc2. Once video is playing,
176 // forward the remove stream from pc2 to pc1. 176 // forward the remove stream from pc2 to pc1.
177 detectVideoPlaying('remote-view-2', onRemoteStream2); 177 detectVideoPlaying('remote-view-2', onRemoteStream2);
178 178
179 // Wait for video to be forwarded back to connection 1. 179 // Wait for video to be forwarded back to connection 1.
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
324 waitForVideo('remote-view-2'); 324 waitForVideo('remote-view-2');
325 }); 325 });
326 } 326 }
327 327
328 // Test that we can setup call and send DTMF. 328 // Test that we can setup call and send DTMF.
329 function callAndSendDtmf(tones) { 329 function callAndSendDtmf(tones) {
330 createConnections(null); 330 createConnections(null);
331 navigator.webkitGetUserMedia({audio: true, video: true}, 331 navigator.webkitGetUserMedia({audio: true, video: true},
332 addStreamToBothConnectionsAndNegotiate, printGetUserMediaError); 332 addStreamToBothConnectionsAndNegotiate, printGetUserMediaError);
333 var onCallEstablished = function() { 333 var onCallEstablished = function() {
334 // Send DTMF tones. 334 // Send DTMF tones. Allocate the sender in the window to keep it from
335 // being garbage collected. https://crbug.com/486654.
335 var localAudioTrack = gLocalStream.getAudioTracks()[0]; 336 var localAudioTrack = gLocalStream.getAudioTracks()[0];
336 var dtmfSender = gFirstConnection.createDTMFSender(localAudioTrack); 337 window.dtmfSender = gFirstConnection.createDTMFSender(localAudioTrack);
337 dtmfSender.ontonechange = onToneChange; 338 window.dtmfSender.ontonechange = onToneChange;
338 dtmfSender.insertDTMF(tones); 339 window.dtmfSender.insertDTMF(tones);
339 // Wait for the DTMF tones callback. 340 // Wait for the DTMF tones callback.
340 addExpectedEvent(); 341 addExpectedEvent();
341 var waitDtmf = setInterval(function() { 342 var waitDtmf = setInterval(function() {
342 if (gSentTones == tones) { 343 if (gSentTones == tones) {
343 clearInterval(waitDtmf); 344 clearInterval(waitDtmf);
344 eventOccured(); 345 eventOccured();
345 } 346 }
346 }, 100); 347 }, 100);
347 } 348 }
348 349
(...skipping 584 matching lines...) Expand 10 before | Expand all | Expand 10 after
933 <td><canvas width="320" height="240" id="remote-view-2-canvas" 934 <td><canvas width="320" height="240" id="remote-view-2-canvas"
934 style="display:none"></canvas></td> 935 style="display:none"></canvas></td>
935 <td><canvas width="320" height="240" id="remote-view-3-canvas" 936 <td><canvas width="320" height="240" id="remote-view-3-canvas"
936 style="display:none"></canvas></td> 937 style="display:none"></canvas></td>
937 <td><canvas width="320" height="240" id="remote-view-4-canvas" 938 <td><canvas width="320" height="240" id="remote-view-4-canvas"
938 style="display:none"></canvas></td> 939 style="display:none"></canvas></td>
939 </tr> 940 </tr>
940 </table> 941 </table>
941 </body> 942 </body>
942 </html> 943 </html>
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698