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. |
161 // The stream sent from pc4 to pc3 is cloned from the stream received on pc2 | 161 // The stream sent from pc1 to pc2 is cloned from the stream received on pc2 |
phoglund_chromium
2015/03/26 09:59:15
Nit: pull up comment to previous line.
| |
162 // to test that cloning of remote video tracks works as intended. | 162 // to test that cloning of remote video tracks works as intended and is sent |
163 // back to pc1. | |
163 function callAndForwardRemoteStream(constraints) { | 164 function callAndForwardRemoteStream(constraints) { |
164 createConnections(null); | 165 createConnections(null); |
165 navigator.webkitGetUserMedia(constraints, | 166 navigator.webkitGetUserMedia(constraints, |
166 addStreamToBothConnectionsAndNegotiate, | 167 addStreamToTheFirstConnectionAndNegotiate, |
167 printGetUserMediaError); | 168 printGetUserMediaError); |
168 var gotRemoteStream1 = false; | 169 var onRemoteStream2 = function() { |
169 var gotRemoteStream2 = false; | 170 // Video has been detected to be playing in pc2. Clone the received |
170 | 171 // stream and send it back to pc1. |
171 var onRemoteStream1 = function() { | 172 gSecondConnection.addStream(gRemoteStreams['remote-view-2'].clone()); |
172 gotRemoteStream1 = true; | 173 negotiate(); |
173 maybeCallEstablished(); | |
174 } | 174 } |
175 | 175 |
176 var onRemoteStream2 = function() { | 176 // Wait for remove video to be playing in pc2. Once video is playing, |
177 gotRemoteStream2 = true; | 177 // forward the remove stream from pc2 to pc1. |
178 maybeCallEstablished(); | 178 detectVideoPlaying('remote-view-2', onRemoteStream2); |
179 } | |
180 | 179 |
181 var maybeCallEstablished = function() { | 180 // Wait for video to be forwarded back to connection 1. |
182 if (gotRemoteStream1 && gotRemoteStream2) { | 181 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 } | 182 } |
204 | 183 |
205 // First makes a call between pc1 and pc2, and then construct a new media | 184 // 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 | 185 // stream using the remote audio and video tracks, connect the new media |
207 // stream to a video element. These operations should not crash Chrome. | 186 // stream to a video element. These operations should not crash Chrome. |
208 function ConnectChromiumSinkToRemoteAudioTrack() { | 187 function ConnectChromiumSinkToRemoteAudioTrack() { |
209 createConnections(null); | 188 createConnections(null); |
210 navigator.webkitGetUserMedia({audio: true, video: true}, | 189 navigator.webkitGetUserMedia({audio: true, video: true}, |
211 addStreamToBothConnectionsAndNegotiate, | 190 addStreamToBothConnectionsAndNegotiate, |
212 printGetUserMediaError); | 191 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" | 934 <td><canvas width="320" height="240" id="remote-view-2-canvas" |
956 style="display:none"></canvas></td> | 935 style="display:none"></canvas></td> |
957 <td><canvas width="320" height="240" id="remote-view-3-canvas" | 936 <td><canvas width="320" height="240" id="remote-view-3-canvas" |
958 style="display:none"></canvas></td> | 937 style="display:none"></canvas></td> |
959 <td><canvas width="320" height="240" id="remote-view-4-canvas" | 938 <td><canvas width="320" height="240" id="remote-view-4-canvas" |
960 style="display:none"></canvas></td> | 939 style="display:none"></canvas></td> |
961 </tr> | 940 </tr> |
962 </table> | 941 </table> |
963 </body> | 942 </body> |
964 </html> | 943 </html> |
OLD | NEW |