Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 cr.define('hotword', function() { | 5 cr.define('hotword', function() { |
| 6 'use strict'; | 6 'use strict'; |
| 7 | 7 |
| 8 /** | 8 /** |
| 9 * Class used to manage the state of the NaCl recognizer plugin. Handles all | 9 * Class used to manage the state of the NaCl recognizer plugin. Handles all |
| 10 * control of the NaCl plugin, including creation, start, stop, trigger, and | 10 * control of the NaCl plugin, including creation, start, stop, trigger, and |
| (...skipping 442 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 453 /** | 453 /** |
| 454 * Handle a MODEL_LOADED message from the plugin. | 454 * Handle a MODEL_LOADED message from the plugin. |
| 455 * The plugin sends this message after successfully loading the language model. | 455 * The plugin sends this message after successfully loading the language model. |
| 456 * @private | 456 * @private |
| 457 */ | 457 */ |
| 458 NaClManager.prototype.handleModelLoaded_ = function() { | 458 NaClManager.prototype.handleModelLoaded_ = function() { |
| 459 if (this.recognizerState_ != ManagerState_.LOADING) { | 459 if (this.recognizerState_ != ManagerState_.LOADING) { |
| 460 return; | 460 return; |
| 461 } | 461 } |
| 462 this.sendDataToPlugin_(this.stream_.getAudioTracks()[0]); | 462 this.sendDataToPlugin_(this.stream_.getAudioTracks()[0]); |
| 463 this.waitForMessage_(hotword.constants.TimeoutMs.LONG, | 463 // The plugin will send a MS_CONFIGURED, but don't set a timeout waiting for |
| 464 hotword.constants.NaClPlugin.MS_CONFIGURED); | 464 // it. After the recent MediaStreamAudioTrack refactoring, the behavior of |
|
Matt Giuca
2016/09/08 03:50:45
The code should describe what it is *now*, not ref
| |
| 465 // MediaStreamAudioTrack::Configure() changed where it remains pending until | |
| 466 // the first audio buffer is received. When the audio source is a DSP for | |
| 467 // always-on detection, no audio sample is sent until the DSP detects a | |
| 468 // potential hotword trigger. Thus, Configure may remain pending indefinitely. | |
| 469 // See crbug.com/616203 for more info. | |
| 465 }; | 470 }; |
| 466 | 471 |
| 467 /** | 472 /** |
| 468 * Handle a MS_CONFIGURED message from the plugin. | 473 * Handle a MS_CONFIGURED message from the plugin. |
| 469 * The plugin sends this message after successfully configuring the audio input | 474 * The plugin sends this message after successfully configuring the audio input |
| 470 * stream. | 475 * stream. |
| 471 * @private | 476 * @private |
| 472 */ | 477 */ |
| 473 NaClManager.prototype.handleMsConfigured_ = function() { | 478 NaClManager.prototype.handleMsConfigured_ = function() { |
| 474 if (this.recognizerState_ != ManagerState_.LOADING) { | 479 if (this.recognizerState_ != ManagerState_.LOADING) { |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 588 break; | 593 break; |
| 589 } | 594 } |
| 590 } | 595 } |
| 591 }; | 596 }; |
| 592 | 597 |
| 593 return { | 598 return { |
| 594 NaClManager: NaClManager | 599 NaClManager: NaClManager |
| 595 }; | 600 }; |
| 596 | 601 |
| 597 }); | 602 }); |
| OLD | NEW |