| 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) { |
| 11 failTest('Error: ' + errorMsg + '\nScript: ' + url + |
| 12 '\nLine: ' + lineNumber + '\nColumn: ' + column + |
| 13 '\nStackTrace: ' + errorObj); |
| 14 } |
| 15 |
| 10 var gFirstConnection = null; | 16 var gFirstConnection = null; |
| 11 var gSecondConnection = null; | 17 var gSecondConnection = null; |
| 12 var gTestWithoutMsid = false; | 18 var gTestWithoutMsid = false; |
| 13 var gLocalStream = null; | 19 var gLocalStream = null; |
| 14 var gSentTones = ''; | 20 var gSentTones = ''; |
| 15 | 21 |
| 16 var gRemoteStreams = {}; | 22 var gRemoteStreams = {}; |
| 17 | 23 |
| 18 // Default transform functions, overridden by some test cases. | 24 // Default transform functions, overridden by some test cases. |
| 19 var transformSdp = function(sdp) { return sdp; }; | 25 var transformSdp = function(sdp) { return sdp; }; |
| (...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 275 function callWithSctpDataAndMedia() { | 281 function callWithSctpDataAndMedia() { |
| 276 createConnections({optional: [{DtlsSrtpKeyAgreement: true}]}); | 282 createConnections({optional: [{DtlsSrtpKeyAgreement: true}]}); |
| 277 setupSctpDataChannel({reliable: true}); | 283 setupSctpDataChannel({reliable: true}); |
| 278 navigator.webkitGetUserMedia({audio: true, video: true}, | 284 navigator.webkitGetUserMedia({audio: true, video: true}, |
| 279 addStreamToBothConnectionsAndNegotiate, | 285 addStreamToBothConnectionsAndNegotiate, |
| 280 printGetUserMediaError); | 286 printGetUserMediaError); |
| 281 waitForVideo('remote-view-1'); | 287 waitForVideo('remote-view-1'); |
| 282 waitForVideo('remote-view-2'); | 288 waitForVideo('remote-view-2'); |
| 283 } | 289 } |
| 284 | 290 |
| 285 | |
| 286 // Test call with a data channel and later add audio and video. | 291 // Test call with a data channel and later add audio and video. |
| 287 function callWithDataAndLaterAddMedia() { | 292 function callWithDataAndLaterAddMedia() { |
| 288 createConnections({optional:[{RtpDataChannels: true}]}); | 293 createConnections({optional:[{RtpDataChannels: true}]}); |
| 289 setupDataChannel({reliable: false}); | 294 setupDataChannel({reliable: false}); |
| 290 negotiate(); | 295 negotiate(); |
| 291 | 296 |
| 292 // Set an event handler for when the data channel has been closed. | 297 // Set an event handler for when the data channel has been closed. |
| 293 setAllEventsOccuredHandler(function() { | 298 setAllEventsOccuredHandler(function() { |
| 294 // When the video is flowing the test is done. | 299 // When the video is flowing the test is done. |
| 295 setAllEventsOccuredHandler(reportTestSuccess); | 300 setAllEventsOccuredHandler(reportTestSuccess); |
| (...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 621 } | 626 } |
| 622 | 627 |
| 623 // When |firstDataChannel| receive a message, send message back. | 628 // When |firstDataChannel| receive a message, send message back. |
| 624 // initiate a new offer/answer exchange to complete the closure. | 629 // initiate a new offer/answer exchange to complete the closure. |
| 625 firstDataChannel.onmessage = function(event) { | 630 firstDataChannel.onmessage = function(event) { |
| 626 assertEquals('open', firstDataChannel.readyState); | 631 assertEquals('open', firstDataChannel.readyState); |
| 627 assertEquals(event.data, sendDataString); | 632 assertEquals(event.data, sendDataString); |
| 628 firstDataChannel.send(sendDataString); | 633 firstDataChannel.send(sendDataString); |
| 629 } | 634 } |
| 630 | 635 |
| 631 | |
| 632 // Event handler for when |gSecondConnection| receive a new dataChannel. | 636 // Event handler for when |gSecondConnection| receive a new dataChannel. |
| 633 gSecondConnection.ondatachannel = function (event) { | 637 gSecondConnection.ondatachannel = function (event) { |
| 634 var secondDataChannel = event.channel; | 638 var secondDataChannel = event.channel; |
| 635 secondDataChannel.onopen = function() { | 639 secondDataChannel.onopen = function() { |
| 636 secondDataChannel.send(sendDataString); | 640 secondDataChannel.send(sendDataString); |
| 637 } | 641 } |
| 638 | 642 |
| 639 // When |secondDataChannel| receive a message, close the channel and | 643 // When |secondDataChannel| receive a message, close the channel and |
| 640 // initiate a new offer/answer exchange to complete the closure. | 644 // initiate a new offer/answer exchange to complete the closure. |
| 641 secondDataChannel.onmessage = function(event) { | 645 secondDataChannel.onmessage = function(event) { |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 796 receiveOffer(offer.sdp, caller, callee); | 800 receiveOffer(offer.sdp, caller, callee); |
| 797 }, onLocalDescriptionError); | 801 }, onLocalDescriptionError); |
| 798 } | 802 } |
| 799 | 803 |
| 800 function receiveOffer(offerSdp, caller, callee) { | 804 function receiveOffer(offerSdp, caller, callee) { |
| 801 console.log("Receiving offer..."); | 805 console.log("Receiving offer..."); |
| 802 offerSdp = transformRemoteSdp(offerSdp); | 806 offerSdp = transformRemoteSdp(offerSdp); |
| 803 | 807 |
| 804 var parsedOffer = new RTCSessionDescription({ type: 'offer', | 808 var parsedOffer = new RTCSessionDescription({ type: 'offer', |
| 805 sdp: offerSdp }); | 809 sdp: offerSdp }); |
| 806 callee.setRemoteDescription(parsedOffer, function() {}, | 810 callee.setRemoteDescription(parsedOffer, |
| 811 function() { |
| 812 assertEquals('have-remote-offer', |
| 813 callee.signalingState); |
| 814 callee.createAnswer( |
| 815 function (answer) { |
| 816 onAnswerCreated(answer, caller, callee); |
| 817 }); |
| 818 }, |
| 807 onRemoteDescriptionError); | 819 onRemoteDescriptionError); |
| 808 callee.createAnswer(function (answer) { | |
| 809 onAnswerCreated(answer, caller, callee); | |
| 810 }); | |
| 811 assertEquals('have-remote-offer', callee.signalingState); | |
| 812 } | 820 } |
| 813 | 821 |
| 814 function removeMsid(offerSdp) { | 822 function removeMsid(offerSdp) { |
| 815 offerSdp = offerSdp.replace(/a=msid-semantic.*\r\n/g, ''); | 823 offerSdp = offerSdp.replace(/a=msid-semantic.*\r\n/g, ''); |
| 816 offerSdp = offerSdp.replace('a=mid:audio\r\n', ''); | 824 offerSdp = offerSdp.replace('a=mid:audio\r\n', ''); |
| 817 offerSdp = offerSdp.replace('a=mid:video\r\n', ''); | 825 offerSdp = offerSdp.replace('a=mid:video\r\n', ''); |
| 818 offerSdp = offerSdp.replace(/a=ssrc.*\r\n/g, ''); | 826 offerSdp = offerSdp.replace(/a=ssrc.*\r\n/g, ''); |
| 819 return offerSdp; | 827 return offerSdp; |
| 820 } | 828 } |
| 821 | 829 |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 928 <td><canvas width="320" height="240" id="remote-view-2-canvas" | 936 <td><canvas width="320" height="240" id="remote-view-2-canvas" |
| 929 style="display:none"></canvas></td> | 937 style="display:none"></canvas></td> |
| 930 <td><canvas width="320" height="240" id="remote-view-3-canvas" | 938 <td><canvas width="320" height="240" id="remote-view-3-canvas" |
| 931 style="display:none"></canvas></td> | 939 style="display:none"></canvas></td> |
| 932 <td><canvas width="320" height="240" id="remote-view-4-canvas" | 940 <td><canvas width="320" height="240" id="remote-view-4-canvas" |
| 933 style="display:none"></canvas></td> | 941 style="display:none"></canvas></td> |
| 934 </tr> | 942 </tr> |
| 935 </table> | 943 </table> |
| 936 </body> | 944 </body> |
| 937 </html> | 945 </html> |
| OLD | NEW |