OLD | NEW |
1 <html> | 1 <html> |
2 <head> | 2 <head> |
3 <script type="text/javascript"> | 3 <script type="text/javascript"> |
4 $ = function(id) { | 4 $ = function(id) { |
5 return document.getElementById(id); | 5 return document.getElementById(id); |
6 }; | 6 }; |
7 | 7 |
8 // These must match with how the video and canvas tags are declared in html. | 8 // These must match with how the video and canvas tags are declared in html. |
9 const VIDEO_TAG_WIDTH = 320; | 9 const VIDEO_TAG_WIDTH = 320; |
10 const VIDEO_TAG_HEIGHT = 240; | 10 const VIDEO_TAG_HEIGHT = 240; |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 // Only the first connection is sending here. | 42 // Only the first connection is sending here. |
43 waitForVideo('remote-view-2'); | 43 waitForVideo('remote-view-2'); |
44 } | 44 } |
45 | 45 |
46 // Test that we can setup call with an audio and video track and | 46 // Test that we can setup call with an audio and video track and |
47 // simulate that the remote peer don't support MSID. | 47 // simulate that the remote peer don't support MSID. |
48 function callWithoutMsidAndBundle() { | 48 function callWithoutMsidAndBundle() { |
49 createConnections(null); | 49 createConnections(null); |
50 gTestWithoutMsidAndBundle = true; | 50 gTestWithoutMsidAndBundle = true; |
51 navigator.webkitGetUserMedia({audio:true, video:true}, | 51 navigator.webkitGetUserMedia({audio:true, video:true}, |
52 addStreamToBothConnectionsAndNegotiate, printGetUserMediaError); | 52 addStreamToBothConnectionsAndNegotiate, printGetUserMediaError); |
53 // TODO(phoglund): this should work but it doesn't! http://crbug.com/177443. | 53 waitForVideo('remote-view-1'); |
54 // waitForVideo('remote-view-1'); | |
55 waitForVideo('remote-view-2'); | 54 waitForVideo('remote-view-2'); |
56 } | 55 } |
57 | 56 |
58 // Test only a data channel. | 57 // Test only a data channel. |
59 function callWithDataOnly() { | 58 function callWithDataOnly() { |
60 createConnections({optional:[{RtpDataChannels: true}]}); | 59 createConnections({optional:[{RtpDataChannels: true}]}); |
61 setupDataChannel(); | 60 setupDataChannel(); |
62 gFirstConnection.createOffer(onOfferCreated); | 61 gFirstConnection.createOffer(onOfferCreated); |
63 } | 62 } |
64 | 63 |
65 // Test call with audio, video and a data channel. | 64 // Test call with audio, video and a data channel. |
66 function callWithDataAndMedia() { | 65 function callWithDataAndMedia() { |
67 createConnections({optional:[{RtpDataChannels: true}]}); | 66 createConnections({optional:[{RtpDataChannels: true}]}); |
68 setupDataChannel(); | 67 setupDataChannel(); |
69 navigator.webkitGetUserMedia({audio:true, video:true}, | 68 navigator.webkitGetUserMedia({audio:true, video:true}, |
70 addStreamToBothConnectionsAndNegotiate, | 69 addStreamToBothConnectionsAndNegotiate, |
71 printGetUserMediaError); | 70 printGetUserMediaError); |
72 waitForVideo('remote-view-1'); | 71 waitForVideo('remote-view-1'); |
73 waitForVideo('remote-view-2'); | 72 waitForVideo('remote-view-2'); |
74 } | 73 } |
75 | 74 |
76 // Test call with a data channel and later add audio and video. | 75 // Test call with a data channel and later add audio and video. |
77 function callWithDataAndLaterAddMedia() { | 76 function callWithDataAndLaterAddMedia() { |
78 // TODO(perkj): This is needed for now until | |
79 // https://code.google.com/p/webrtc/issues/detail?id=1203 is fixed. | |
80 gTestWithoutMsidAndBundle = true; | |
81 | |
82 createConnections({optional:[{RtpDataChannels: true}]}); | 77 createConnections({optional:[{RtpDataChannels: true}]}); |
83 setupDataChannel(); | 78 setupDataChannel(); |
84 gFirstConnection.createOffer(onOfferCreated); | 79 gFirstConnection.createOffer(onOfferCreated); |
85 | 80 |
86 navigator.webkitGetUserMedia({audio:true, video:true}, | 81 navigator.webkitGetUserMedia({audio:true, video:true}, |
87 addStreamToBothConnectionsAndNegotiate, printGetUserMediaError); | 82 addStreamToBothConnectionsAndNegotiate, printGetUserMediaError); |
88 waitForVideo('remote-view-1'); | 83 waitForVideo('remote-view-1'); |
89 waitForVideo('remote-view-2'); | 84 waitForVideo('remote-view-2'); |
90 } | 85 } |
91 | 86 |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
236 offerSdp = offerSdp.replace('a=group:BUNDLE audio video\r\n', ''); | 231 offerSdp = offerSdp.replace('a=group:BUNDLE audio video\r\n', ''); |
237 offerSdp = offerSdp.replace('a=mid:audio\r\n', ''); | 232 offerSdp = offerSdp.replace('a=mid:audio\r\n', ''); |
238 offerSdp = offerSdp.replace('a=mid:video\r\n', ''); | 233 offerSdp = offerSdp.replace('a=mid:video\r\n', ''); |
239 offerSdp = offerSdp.replace(/a=ssrc.*\r\n/g, ''); | 234 offerSdp = offerSdp.replace(/a=ssrc.*\r\n/g, ''); |
240 return offerSdp; | 235 return offerSdp; |
241 } | 236 } |
242 | 237 |
243 function onAnswerCreated(answer) { | 238 function onAnswerCreated(answer) { |
244 gSecondConnection.setLocalDescription(answer); | 239 gSecondConnection.setLocalDescription(answer); |
245 expectEquals('stable', gSecondConnection.signalingState); | 240 expectEquals('stable', gSecondConnection.signalingState); |
246 handleAnswer(answer.sdp); | 241 receiveAnswer(answer.sdp); |
247 } | 242 } |
248 | 243 |
249 function handleAnswer(answerSdp) { | 244 function receiveAnswer(answerSdp) { |
| 245 if (gTestWithoutMsidAndBundle) { |
| 246 answerSdp = removeMsidAndBundle(answerSdp); |
| 247 } |
250 var parsedAnswer = new RTCSessionDescription({ type: 'answer', | 248 var parsedAnswer = new RTCSessionDescription({ type: 'answer', |
251 sdp: answerSdp }); | 249 sdp: answerSdp }); |
252 gFirstConnection.setRemoteDescription(parsedAnswer); | 250 gFirstConnection.setRemoteDescription(parsedAnswer); |
253 expectEquals('stable', gFirstConnection.signalingState); | 251 expectEquals('stable', gFirstConnection.signalingState); |
254 } | 252 } |
255 | 253 |
256 function onIceCandidateToFirst(event) { | 254 function onIceCandidateToFirst(event) { |
257 if (event.candidate) { | 255 if (event.candidate) { |
258 var candidate = new RTCIceCandidate(event.candidate); | 256 var candidate = new RTCIceCandidate(event.candidate); |
259 gSecondConnection.addIceCandidate(candidate); | 257 gSecondConnection.addIceCandidate(candidate); |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
355 autoplay="autoplay"></video></td> | 353 autoplay="autoplay"></video></td> |
356 <!-- Canvases are named after their corresponding video elements. --> | 354 <!-- Canvases are named after their corresponding video elements. --> |
357 <td><canvas width="320" height="240" id="remote-view-1-canvas" | 355 <td><canvas width="320" height="240" id="remote-view-1-canvas" |
358 style="display:none"></canvas></td> | 356 style="display:none"></canvas></td> |
359 <td><canvas width="320" height="240" id="remote-view-2-canvas"> | 357 <td><canvas width="320" height="240" id="remote-view-2-canvas"> |
360 style="display:none"></canvas></td> | 358 style="display:none"></canvas></td> |
361 </tr> | 359 </tr> |
362 </table> | 360 </table> |
363 </body> | 361 </body> |
364 </html> | 362 </html> |
OLD | NEW |