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 // Public interface towards the other javascript files, such as | 7 // Public interface towards the other javascript files, such as |
8 // message_handling.js. The contract for these functions is described in | 8 // message_handling.js. The contract for these functions is described in |
9 // message_handling.js. | 9 // message_handling.js. |
10 | 10 |
(...skipping 19 matching lines...) Expand all Loading... |
30 } | 30 } |
31 addTestFailure("unknown message received"); | 31 addTestFailure("unknown message received"); |
32 return; | 32 return; |
33 } | 33 } |
34 | 34 |
35 function createPeerConnection(stun_server) { | 35 function createPeerConnection(stun_server) { |
36 servers = {iceServers:[{url:"stun:" + stun_server}]}; | 36 servers = {iceServers:[{url:"stun:" + stun_server}]}; |
37 try { | 37 try { |
38 peerConnection = new webkitRTCPeerConnection(servers, null); | 38 peerConnection = new webkitRTCPeerConnection(servers, null); |
39 } catch (exception) { | 39 } catch (exception) { |
40 failTest('Failed to create peer connection: ' + exception); | 40 // TODO(phoglund): Remove once the URI-requiring revisions are gone. |
| 41 debug('Failed to create connection: maybe we need to fall ' + |
| 42 'back to the old API?'); |
| 43 servers = {iceServers:[{uri:"stun:" + stun_server}]}; |
| 44 try { |
| 45 peerConnection = new webkitRTCPeerConnection(servers, null); |
| 46 debug('Yeah, we could use the old API.'); |
| 47 } catch (exception) { |
| 48 failTest('Failed to create peer connection: ' + exception); |
| 49 } |
41 } | 50 } |
42 peerConnection.onaddstream = addStreamCallback_; | 51 peerConnection.onaddstream = addStreamCallback_; |
43 peerConnection.onremovestream = removeStreamCallback_; | 52 peerConnection.onremovestream = removeStreamCallback_; |
44 peerConnection.onicecandidate = iceCallback_; | 53 peerConnection.onicecandidate = iceCallback_; |
45 return peerConnection; | 54 return peerConnection; |
46 } | 55 } |
47 | 56 |
48 function setupCall(peerConnection) { | 57 function setupCall(peerConnection) { |
49 peerConnection.createOffer( | 58 peerConnection.createOffer( |
50 setLocalAndSendMessage_, | 59 setLocalAndSendMessage_, |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 // This only mean that we have received a valid SDP message with an offer or | 101 // This only mean that we have received a valid SDP message with an offer or |
93 // an answer, it does not mean that audio and video works. | 102 // an answer, it does not mean that audio and video works. |
94 returnToTest('ok-got-remote-stream'); | 103 returnToTest('ok-got-remote-stream'); |
95 } | 104 } |
96 | 105 |
97 /** @private */ | 106 /** @private */ |
98 function removeStreamCallback_(event) { | 107 function removeStreamCallback_(event) { |
99 debug('Call ended.'); | 108 debug('Call ended.'); |
100 document.getElementById("remote-view").src = ''; | 109 document.getElementById("remote-view").src = ''; |
101 } | 110 } |
OLD | NEW |