Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /** | 1 /** |
| 2 * Copyright (c) 2012 The Chromium Authors. All rights reserved. | 2 * Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 3 * Use of this source code is governed by a BSD-style license that can be | 3 * Use of this source code is governed by a BSD-style license that can be |
| 4 * found in the LICENSE file. | 4 * found in the LICENSE file. |
| 5 */ | 5 */ |
| 6 | 6 |
| 7 /** | 7 /** |
| 8 * The ID of the video tag from which frames are captured. | 8 * The ID of the video tag from which frames are captured. |
| 9 * @private | 9 * @private |
| 10 */ | 10 */ |
| (...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 183 } | 183 } |
| 184 | 184 |
| 185 /** | 185 /** |
| 186 * Send the frames to the remote PyWebSocket server. Use setTimeout to regularly | 186 * Send the frames to the remote PyWebSocket server. Use setTimeout to regularly |
| 187 * try to send the frames. | 187 * try to send the frames. |
| 188 */ | 188 */ |
| 189 function sendFrames() { | 189 function sendFrames() { |
| 190 if (!gWebSocketOpened) { | 190 if (!gWebSocketOpened) { |
| 191 console.log('WebSocket connection is not yet open'); | 191 console.log('WebSocket connection is not yet open'); |
| 192 setTimeout(function() { sendFrames(); }, 100); | 192 setTimeout(function() { sendFrames(); }, 100); |
| 193 return; | |
|
kjellander_chromium
2014/04/07 14:59:58
Just curious, why is this needed?
phoglund_chromium
2014/04/08 09:29:00
The point of this code is "if the websocket is not
| |
| 193 } | 194 } |
| 194 | 195 |
| 195 progressBar = document.getElementById('progress-bar'); | 196 progressBar = document.getElementById('progress-bar'); |
| 196 if (gFrames.length > 0) { | 197 if (gFrames.length > 0) { |
| 197 var frame = gFrames.shift(); | 198 var frame = gFrames.shift(); |
| 198 gWebSocket.send(frame); | 199 gWebSocket.send(frame); |
| 199 gFrameCounter++; | 200 gFrameCounter++; |
| 200 setTimeout(function() { sendFrames(); }, 100); | 201 setTimeout(function() { sendFrames(); }, 100); |
| 201 | 202 |
| 202 var totalNumFrames = gFrameCounter + gFrames.length; | 203 var totalNumFrames = gFrameCounter + gFrames.length; |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 264 /** | 265 /** |
| 265 * @private | 266 * @private |
| 266 */ | 267 */ |
| 267 function prepareProgressBar_() { | 268 function prepareProgressBar_() { |
| 268 document.body.innerHTML = | 269 document.body.innerHTML = |
| 269 '<html><body>' + | 270 '<html><body>' + |
| 270 '<p id="progress-bar" style="position: absolute; top: 50%; left: 40%;">' + | 271 '<p id="progress-bar" style="position: absolute; top: 50%; left: 40%;">' + |
| 271 'Preparing to send frames.</p>' + | 272 'Preparing to send frames.</p>' + |
| 272 '</body></html>'; | 273 '</body></html>'; |
| 273 } | 274 } |
| OLD | NEW |