| OLD | NEW |
| 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 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 addStreamToTheFirstConnectionAndNegotiate, printGetUserMediaError); | 149 addStreamToTheFirstConnectionAndNegotiate, printGetUserMediaError); |
| 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, and then makes a call between pc3 | 159 // First makes a call between pc1 and pc2 where a stream is sent from pc1 to |
| 160 // and pc4. The stream sent from pc3 to pc4 is the stream received on pc1. | 160 // pc2. The stream sent from pc1 to pc2 is cloned from the stream received on |
| 161 // The stream sent from pc4 to pc3 is cloned from the stream received on pc2 | 161 // pc2 to test that cloning of remote video tracks works as intended and is |
| 162 // to test that cloning of remote video tracks works as intended. | 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 addStreamToBothConnectionsAndNegotiate, | 166 addStreamToTheFirstConnectionAndNegotiate, |
| 167 printGetUserMediaError); | 167 printGetUserMediaError); |
| 168 var gotRemoteStream1 = false; | 168 var onRemoteStream2 = function() { |
| 169 var gotRemoteStream2 = false; | 169 // Video has been detected to be playing in pc2. Clone the received |
| 170 | 170 // stream and send it back to pc1. |
| 171 var onRemoteStream1 = function() { | 171 gSecondConnection.addStream(gRemoteStreams['remote-view-2'].clone()); |
| 172 gotRemoteStream1 = true; | 172 negotiate(); |
| 173 maybeCallEstablished(); | |
| 174 } | 173 } |
| 175 | 174 |
| 176 var onRemoteStream2 = function() { | 175 // Wait for remove video to be playing in pc2. Once video is playing, |
| 177 gotRemoteStream2 = true; | 176 // forward the remove stream from pc2 to pc1. |
| 178 maybeCallEstablished(); | 177 detectVideoPlaying('remote-view-2', onRemoteStream2); |
| 179 } | |
| 180 | 178 |
| 181 var maybeCallEstablished = function() { | 179 // Wait for video to be forwarded back to connection 1. |
| 182 if (gotRemoteStream1 && gotRemoteStream2) { | 180 waitForVideo('remote-view-1'); |
| 183 onCallEstablished(); | |
| 184 } | |
| 185 } | |
| 186 | |
| 187 var onCallEstablished = function() { | |
| 188 thirdConnection = createConnection(null, 'remote-view-3'); | |
| 189 thirdConnection.addStream(gRemoteStreams['remote-view-1']); | |
| 190 | |
| 191 fourthConnection = createConnection(null, 'remote-view-4'); | |
| 192 fourthConnection.addStream(gRemoteStreams['remote-view-2'].clone()); | |
| 193 | |
| 194 negotiateBetween(thirdConnection, fourthConnection); | |
| 195 | |
| 196 waitForVideo('remote-view-3'); | |
| 197 waitForVideo('remote-view-4'); | |
| 198 } | |
| 199 | |
| 200 // Do the forwarding after we have received video. | |
| 201 detectVideoPlaying('remote-view-1', onRemoteStream1); | |
| 202 detectVideoPlaying('remote-view-2', onRemoteStream2); | |
| 203 } | 181 } |
| 204 | 182 |
| 205 // First makes a call between pc1 and pc2, and then construct a new media | 183 // First makes a call between pc1 and pc2, and then construct a new media |
| 206 // stream using the remote audio and video tracks, connect the new media | 184 // stream using the remote audio and video tracks, connect the new media |
| 207 // stream to a video element. These operations should not crash Chrome. | 185 // stream to a video element. These operations should not crash Chrome. |
| 208 function ConnectChromiumSinkToRemoteAudioTrack() { | 186 function ConnectChromiumSinkToRemoteAudioTrack() { |
| 209 createConnections(null); | 187 createConnections(null); |
| 210 navigator.webkitGetUserMedia({audio: true, video: true}, | 188 navigator.webkitGetUserMedia({audio: true, video: true}, |
| 211 addStreamToBothConnectionsAndNegotiate, | 189 addStreamToBothConnectionsAndNegotiate, |
| 212 printGetUserMediaError); | 190 printGetUserMediaError); |
| (...skipping 742 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 955 <td><canvas width="320" height="240" id="remote-view-2-canvas" | 933 <td><canvas width="320" height="240" id="remote-view-2-canvas" |
| 956 style="display:none"></canvas></td> | 934 style="display:none"></canvas></td> |
| 957 <td><canvas width="320" height="240" id="remote-view-3-canvas" | 935 <td><canvas width="320" height="240" id="remote-view-3-canvas" |
| 958 style="display:none"></canvas></td> | 936 style="display:none"></canvas></td> |
| 959 <td><canvas width="320" height="240" id="remote-view-4-canvas" | 937 <td><canvas width="320" height="240" id="remote-view-4-canvas" |
| 960 style="display:none"></canvas></td> | 938 style="display:none"></canvas></td> |
| 961 </tr> | 939 </tr> |
| 962 </table> | 940 </table> |
| 963 </body> | 941 </body> |
| 964 </html> | 942 </html> |
| OLD | NEW |