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

Side by Side Diff: content/browser/speech/speech_recognizer_impl.cc

Issue 2665163002: Refactor AudioInputController and split stat by stream type. (Closed)
Patch Set: Compile Created 3 years, 10 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
« no previous file with comments | « content/browser/speech/speech_recognizer_impl.h ('k') | media/audio/audio_file_writer.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 #include "content/browser/speech/speech_recognizer_impl.h" 5 #include "content/browser/speech/speech_recognizer_impl.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include <algorithm>
10
9 #include "base/bind.h" 11 #include "base/bind.h"
10 #include "base/macros.h" 12 #include "base/macros.h"
11 #include "base/time/time.h" 13 #include "base/time/time.h"
12 #include "build/build_config.h" 14 #include "build/build_config.h"
13 #include "content/browser/browser_main_loop.h" 15 #include "content/browser/browser_main_loop.h"
14 #include "content/browser/media/media_internals.h" 16 #include "content/browser/media/media_internals.h"
15 #include "content/browser/speech/audio_buffer.h" 17 #include "content/browser/speech/audio_buffer.h"
16 #include "content/public/browser/speech_recognition_event_listener.h" 18 #include "content/public/browser/speech_recognition_event_listener.h"
19 #include "media/audio/audio_file_writer.h"
17 #include "media/base/audio_converter.h" 20 #include "media/base/audio_converter.h"
18 21
19 #if defined(OS_WIN) 22 #if defined(OS_WIN)
20 #include "media/audio/win/core_audio_util_win.h" 23 #include "media/audio/win/core_audio_util_win.h"
21 #endif 24 #endif
22 25
23 using media::AudioBus; 26 using media::AudioBus;
24 using media::AudioConverter; 27 using media::AudioConverter;
25 using media::AudioInputController; 28 using media::AudioInputController;
26 using media::AudioManager; 29 using media::AudioManager;
(...skipping 555 matching lines...) Expand 10 before | Expand all | Expand 10 after
582 DVLOG(1) << "SRI::input_parameters: " 585 DVLOG(1) << "SRI::input_parameters: "
583 << input_parameters.AsHumanReadableString(); 586 << input_parameters.AsHumanReadableString();
584 } 587 }
585 588
586 // Create an audio converter which converts data between native input format 589 // Create an audio converter which converts data between native input format
587 // and WebSpeech specific output format. 590 // and WebSpeech specific output format.
588 audio_converter_.reset( 591 audio_converter_.reset(
589 new OnDataConverter(input_parameters, output_parameters)); 592 new OnDataConverter(input_parameters, output_parameters));
590 593
591 audio_controller_ = AudioInputController::Create( 594 audio_controller_ = AudioInputController::Create(
592 audio_manager, this, this, input_parameters, device_id_, NULL); 595 audio_manager, this, this, nullptr, nullptr, input_parameters, device_id_,
596 /*agc_is_enabled*/ false);
593 597
594 if (!audio_controller_.get()) { 598 if (!audio_controller_.get()) {
595 return Abort( 599 return Abort(
596 SpeechRecognitionError(SPEECH_RECOGNITION_ERROR_AUDIO_CAPTURE)); 600 SpeechRecognitionError(SPEECH_RECOGNITION_ERROR_AUDIO_CAPTURE));
597 } 601 }
598 602
599 audio_log_->OnCreated(0, input_parameters, device_id_); 603 audio_log_->OnCreated(0, input_parameters, device_id_);
600 604
601 // The endpointer needs to estimate the environment/background noise before 605 // The endpointer needs to estimate the environment/background noise before
602 // starting to treat the audio as user input. We wait in the state 606 // starting to treat the audio as user input. We wait in the state
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after
840 engine_error(SPEECH_RECOGNITION_ERROR_NONE) { 844 engine_error(SPEECH_RECOGNITION_ERROR_NONE) {
841 } 845 }
842 846
843 SpeechRecognizerImpl::FSMEventArgs::FSMEventArgs(const FSMEventArgs& other) = 847 SpeechRecognizerImpl::FSMEventArgs::FSMEventArgs(const FSMEventArgs& other) =
844 default; 848 default;
845 849
846 SpeechRecognizerImpl::FSMEventArgs::~FSMEventArgs() { 850 SpeechRecognizerImpl::FSMEventArgs::~FSMEventArgs() {
847 } 851 }
848 852
849 } // namespace content 853 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/speech/speech_recognizer_impl.h ('k') | media/audio/audio_file_writer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698