Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(179)

Side by Side Diff: chrome/browser/resources/whispernet_proxy/js/init.js

Issue 637223011: Redesign the copresence audio handlers. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git/+/master
Patch Set: Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 'use strict'; 5 'use strict';
6 6
7 // Globals holding our encoder and decoder. We will never have more than one 7 // Globals holding our encoder and decoder. We will never have more than one
8 // Global variable that will be used to access this Nacl bridge. 8 // Global variable that will be used to access this Nacl bridge.
9 var whispernetNacl = null; 9 var whispernetNacl = null;
10 10
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 function encodeTokenRequest(token, audible) { 43 function encodeTokenRequest(token, audible) {
44 if (whisperEncoder) { 44 if (whisperEncoder) {
45 whisperEncoder.encode(atob(token), audible, true); 45 whisperEncoder.encode(atob(token), audible, true);
46 } else { 46 } else {
47 console.error('encodeTokenRequest: Whisper not initialized!'); 47 console.error('encodeTokenRequest: Whisper not initialized!');
48 } 48 }
49 } 49 }
50 50
51 /** 51 /**
52 * Sends a request to whispernet to decode samples. 52 * Sends a request to whispernet to decode samples.
53 * @param {ArrayBuffer} samples Array of samples to decode. 53 * @param {ArrayBuffer} samples Array of samples to process.
54 * @param {Object} type Type of decoding to perform.
54 */ 55 */
55 function decodeSamplesRequest(samples) { 56 function decodeSamplesRequest(samples, type) {
56 if (whisperDecoder) { 57 if (whisperDecoder) {
57 whisperDecoder.processSamples(samples); 58 whisperDecoder.processSamples(samples, type);
58 } else { 59 } else {
59 console.error('decodeSamplesRequest: Whisper not initialized!'); 60 console.error('decodeSamplesRequest: Whisper not initialized!');
60 } 61 }
61 } 62 }
62 63
63 /** 64 /**
64 * Sends a request to whispernet to detect broadcast. 65 * Sends a request to whispernet to detect broadcast.
65 */ 66 */
66 function detectBroadcastRequest() { 67 function detectBroadcastRequest() {
67 if (whisperDecoder) { 68 if (whisperDecoder) {
(...skipping 28 matching lines...) Expand all
96 */ 97 */
97 function initWhispernet() { 98 function initWhispernet() {
98 console.log('init: Starting Nacl bridge.'); 99 console.log('init: Starting Nacl bridge.');
99 // TODO(rkc): Figure out how to embed the .nmf and the .pexe into component 100 // TODO(rkc): Figure out how to embed the .nmf and the .pexe into component
100 // resources without having to rename them to .js. 101 // resources without having to rename them to .js.
101 whispernetNacl = new NaclBridge('whispernet_proxy.nmf.png', 102 whispernetNacl = new NaclBridge('whispernet_proxy.nmf.png',
102 onWhispernetLoaded); 103 onWhispernetLoaded);
103 } 104 }
104 105
105 window.addEventListener('DOMContentLoaded', initWhispernet); 106 window.addEventListener('DOMContentLoaded', initWhispernet);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698