| 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. MediaStreamAudioTrack::Configure() will remain pending until the first |
| 465 // audio buffer is received. When the audio source is a DSP for always-on |
| 466 // detection, no audio sample is sent until the DSP detects a potential |
| 467 // hotword trigger. Thus, Configure would remain pending indefinitely if we |
| 468 // were to wait here. See https://crbug.com/616203 |
| 465 }; | 469 }; |
| 466 | 470 |
| 467 /** | 471 /** |
| 468 * Handle a MS_CONFIGURED message from the plugin. | 472 * Handle a MS_CONFIGURED message from the plugin. |
| 469 * The plugin sends this message after successfully configuring the audio input | 473 * The plugin sends this message after successfully configuring the audio input |
| 470 * stream. | 474 * stream. |
| 471 * @private | 475 * @private |
| 472 */ | 476 */ |
| 473 NaClManager.prototype.handleMsConfigured_ = function() { | 477 NaClManager.prototype.handleMsConfigured_ = function() { |
| 474 if (this.recognizerState_ != ManagerState_.LOADING) { | 478 if (this.recognizerState_ != ManagerState_.LOADING) { |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 588 break; | 592 break; |
| 589 } | 593 } |
| 590 } | 594 } |
| 591 }; | 595 }; |
| 592 | 596 |
| 593 return { | 597 return { |
| 594 NaClManager: NaClManager | 598 NaClManager: NaClManager |
| 595 }; | 599 }; |
| 596 | 600 |
| 597 }); | 601 }); |
| OLD | NEW |