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 /** | 7 /** |
8 * Used as a shortcut. Moved to the top of the page due to race conditions. | 8 * Used as a shortcut. Moved to the top of the page due to race conditions. |
9 * @param {string} id is a case-sensitive string representing the unique ID of | 9 * @param {string} id is a case-sensitive string representing the unique ID of |
10 * the element being sought. | 10 * the element being sought. |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 createDtmfSenderOnPeerConnection(); | 110 createDtmfSenderOnPeerConnection(); |
111 } | 111 } |
112 | 112 |
113 function insertDtmfFromHere() { | 113 function insertDtmfFromHere() { |
114 var tones = $('dtmf-tones').value; | 114 var tones = $('dtmf-tones').value; |
115 var duration = $('dtmf-tones-duration').value; | 115 var duration = $('dtmf-tones-duration').value; |
116 var gap = $('dtmf-tones-gap').value; | 116 var gap = $('dtmf-tones-gap').value; |
117 insertDtmfOnSender(tones, duration, gap); | 117 insertDtmfOnSender(tones, duration, gap); |
118 } | 118 } |
119 | 119 |
120 function forceOpusChanged() { | 120 function forceIsacChanged() { |
121 var forceOpus = $('force-opus').checked; | 121 var forceIsac = $('force-isac').checked; |
122 if (forceOpus) { | 122 if (forceIsac) { |
123 forceOpus_(); | 123 forceIsac_(); |
124 } else { | 124 } else { |
125 dontTouchSdp_(); | 125 dontTouchSdp_(); |
126 } | 126 } |
127 } | 127 } |
128 | 128 |
129 /** | 129 /** |
130 * Updates the constraints in the getusermedia-constraints text box with a | 130 * Updates the constraints in the getusermedia-constraints text box with a |
131 * MediaStreamConstraints string. This string is created based on the status of | 131 * MediaStreamConstraints string. This string is created based on the status of |
132 * the checkboxes for audio and video. If device enumeration is supported and | 132 * the checkboxes for audio and video. If device enumeration is supported and |
133 * device source id's are not null they will be added to the constraints string. | 133 * device source id's are not null they will be added to the constraints string. |
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
325 | 325 |
326 // TODO(phoglund): We need to swap the a= lines too. I don't think this | 326 // TODO(phoglund): We need to swap the a= lines too. I don't think this |
327 // should be needed but it apparently is right now. | 327 // should be needed but it apparently is right now. |
328 return swapSdpLines_(sdp, | 328 return swapSdpLines_(sdp, |
329 'a=rtpmap:103 ISAC/16000', | 329 'a=rtpmap:103 ISAC/16000', |
330 'a=rtpmap:111 opus/48000'); | 330 'a=rtpmap:111 opus/48000'); |
331 }); | 331 }); |
332 } | 332 } |
333 | 333 |
334 /** @private */ | 334 /** @private */ |
335 function forceOpus_() { | 335 function forceIsac_() { |
336 setOutgoingSdpTransform(function(sdp) { | 336 setOutgoingSdpTransform(function(sdp) { |
337 // Remove all other codecs (not the video codecs though). | 337 // Remove all other codecs (not the video codecs though). |
338 sdp = sdp.replace(/m=audio (\d+) RTP\/SAVPF.*\r\n/g, | 338 sdp = sdp.replace(/m=audio (\d+) RTP\/SAVPF.*\r\n/g, |
339 'm=audio $1 RTP/SAVPF 111\r\n'); | 339 'm=audio $1 RTP/SAVPF 104\r\n'); |
340 sdp = sdp.replace(/a=rtpmap:(?!111)\d{1,3} (?!VP8|red|ulpfec).*\r\n/g, ''); | 340 sdp = sdp.replace('a=fmtp:111 minptime=10', 'a=fmtp:104 minptime=10'); |
| 341 sdp = sdp.replace(/a=rtpmap:(?!104)\d{1,3} (?!VP8|red|ulpfec).*\r\n/g, ''); |
341 return sdp; | 342 return sdp; |
342 }); | 343 }); |
343 } | 344 } |
344 | 345 |
345 /** @private */ | 346 /** @private */ |
346 function dontTouchSdp_() { | 347 function dontTouchSdp_() { |
347 setOutgoingSdpTransform(function(sdp) { return sdp; }); | 348 setOutgoingSdpTransform(function(sdp) { return sdp; }); |
348 } | 349 } |
349 | 350 |
350 /** @private */ | 351 /** @private */ |
351 function hookupDataChannelCallbacks_() { | 352 function hookupDataChannelCallbacks_() { |
352 setDataCallbacks(function(status) { | 353 setDataCallbacks(function(status) { |
353 $('data-channel-status').value = status; | 354 $('data-channel-status').value = status; |
354 }, | 355 }, |
355 function(data_message) { | 356 function(data_message) { |
356 debug('Received ' + data_message.data); | 357 debug('Received ' + data_message.data); |
357 $('data-channel-receive').value = | 358 $('data-channel-receive').value = |
358 data_message.data + '\n' + $('data-channel-receive').value; | 359 data_message.data + '\n' + $('data-channel-receive').value; |
359 }); | 360 }); |
360 } | 361 } |
361 | 362 |
362 /** @private */ | 363 /** @private */ |
363 function hookupDtmfSenderCallback_() { | 364 function hookupDtmfSenderCallback_() { |
364 setOnToneChange(function(tone) { | 365 setOnToneChange(function(tone) { |
365 debug('Sent DTMF tone: ' + tone.tone); | 366 debug('Sent DTMF tone: ' + tone.tone); |
366 $('dtmf-tones-sent').value = | 367 $('dtmf-tones-sent').value = |
367 tone.tone + '\n' + $('dtmf-tones-sent').value; | 368 tone.tone + '\n' + $('dtmf-tones-sent').value; |
368 }); | 369 }); |
369 } | 370 } |
OLD | NEW |