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

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

Issue 11198018: Move ChannelLayout into media namespace. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Fixes. Created 8 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
« no previous file with comments | « content/browser/speech/speech_recognizer.h ('k') | content/common/media/audio_param_traits.cc » ('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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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.h" 5 #include "content/browser/speech/speech_recognizer.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/time.h" 9 #include "base/time.h"
10 #include "content/browser/browser_main_loop.h" 10 #include "content/browser/browser_main_loop.h"
11 #include "content/browser/speech/audio_buffer.h" 11 #include "content/browser/speech/audio_buffer.h"
12 #include "content/browser/speech/google_one_shot_remote_engine.h" 12 #include "content/browser/speech/google_one_shot_remote_engine.h"
13 #include "content/public/browser/browser_thread.h" 13 #include "content/public/browser/browser_thread.h"
14 #include "content/public/browser/speech_recognition_event_listener.h" 14 #include "content/public/browser/speech_recognition_event_listener.h"
15 #include "content/public/common/speech_recognition_error.h" 15 #include "content/public/common/speech_recognition_error.h"
16 #include "content/public/common/speech_recognition_grammar.h" 16 #include "content/public/common/speech_recognition_grammar.h"
17 #include "content/public/common/speech_recognition_result.h" 17 #include "content/public/common/speech_recognition_result.h"
18 #include "net/url_request/url_request_context_getter.h" 18 #include "net/url_request/url_request_context_getter.h"
19 19
20 using content::BrowserMainLoop; 20 using content::BrowserMainLoop;
21 using content::BrowserThread; 21 using content::BrowserThread;
22 using content::SpeechRecognitionError; 22 using content::SpeechRecognitionError;
23 using content::SpeechRecognitionEventListener; 23 using content::SpeechRecognitionEventListener;
24 using content::SpeechRecognitionGrammar; 24 using content::SpeechRecognitionGrammar;
25 using content::SpeechRecognitionResult; 25 using content::SpeechRecognitionResult;
26 using media::AudioInputController; 26 using media::AudioInputController;
27 using media::AudioManager; 27 using media::AudioManager;
28 using media::AudioParameters; 28 using media::AudioParameters;
29 using media::ChannelLayout;
29 30
30 namespace { 31 namespace {
31 32
32 // The following constants are related to the volume level indicator shown in 33 // The following constants are related to the volume level indicator shown in
33 // the UI for recorded audio. 34 // the UI for recorded audio.
34 // Multiplier used when new volume is greater than previous level. 35 // Multiplier used when new volume is greater than previous level.
35 const float kUpSmoothingFactor = 1.0f; 36 const float kUpSmoothingFactor = 1.0f;
36 // Multiplier used when new volume is lesser than previous level. 37 // Multiplier used when new volume is lesser than previous level.
37 const float kDownSmoothingFactor = 0.7f; 38 const float kDownSmoothingFactor = 0.7f;
38 // RMS dB value of a maximum (unclipped) sine wave for int16 samples. 39 // RMS dB value of a maximum (unclipped) sine wave for int16 samples.
(...skipping 23 matching lines...) Expand all
62 } 63 }
63 64
64 void KeepAudioControllerRefcountedForDtor(scoped_refptr<AudioInputController>) { 65 void KeepAudioControllerRefcountedForDtor(scoped_refptr<AudioInputController>) {
65 } 66 }
66 67
67 } // namespace 68 } // namespace
68 69
69 namespace speech { 70 namespace speech {
70 71
71 const int SpeechRecognizer::kAudioSampleRate = 16000; 72 const int SpeechRecognizer::kAudioSampleRate = 16000;
72 const ChannelLayout SpeechRecognizer::kChannelLayout = CHANNEL_LAYOUT_MONO; 73 const ChannelLayout SpeechRecognizer::kChannelLayout =
74 media::CHANNEL_LAYOUT_MONO;
73 const int SpeechRecognizer::kNumBitsPerAudioSample = 16; 75 const int SpeechRecognizer::kNumBitsPerAudioSample = 16;
74 const int SpeechRecognizer::kNoSpeechTimeoutMs = 8000; 76 const int SpeechRecognizer::kNoSpeechTimeoutMs = 8000;
75 const int SpeechRecognizer::kEndpointerEstimationTimeMs = 300; 77 const int SpeechRecognizer::kEndpointerEstimationTimeMs = 300;
76 media::AudioManager* SpeechRecognizer::audio_manager_for_tests_ = NULL; 78 media::AudioManager* SpeechRecognizer::audio_manager_for_tests_ = NULL;
77 79
78 COMPILE_ASSERT(SpeechRecognizer::kNumBitsPerAudioSample % 8 == 0, 80 COMPILE_ASSERT(SpeechRecognizer::kNumBitsPerAudioSample % 8 == 0,
79 kNumBitsPerAudioSample_must_be_a_multiple_of_8); 81 kNumBitsPerAudioSample_must_be_a_multiple_of_8);
80 82
81 SpeechRecognizer::SpeechRecognizer( 83 SpeechRecognizer::SpeechRecognizer(
82 SpeechRecognitionEventListener* listener, 84 SpeechRecognitionEventListener* listener,
(...skipping 575 matching lines...) Expand 10 before | Expand all | Expand 10 after
658 : event(event_value), 660 : event(event_value),
659 audio_error_code(0), 661 audio_error_code(0),
660 audio_data(NULL), 662 audio_data(NULL),
661 engine_error(content::SPEECH_RECOGNITION_ERROR_NONE) { 663 engine_error(content::SPEECH_RECOGNITION_ERROR_NONE) {
662 } 664 }
663 665
664 SpeechRecognizer::FSMEventArgs::~FSMEventArgs() { 666 SpeechRecognizer::FSMEventArgs::~FSMEventArgs() {
665 } 667 }
666 668
667 } // namespace speech 669 } // namespace speech
OLDNEW
« no previous file with comments | « content/browser/speech/speech_recognizer.h ('k') | content/common/media/audio_param_traits.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698