OLD | NEW |
1 // Copyright (c) 2010 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/endpointer/endpointer.h" | 5 #include "content/browser/speech/endpointer/endpointer.h" |
6 | 6 |
7 #include "base/time.h" | 7 #include "base/time.h" |
8 | 8 |
9 using base::Time; | 9 using base::Time; |
10 | 10 |
11 namespace { | 11 namespace { |
12 static const int kFrameRate = 50; // 1 frame = 20ms of audio. | 12 static const int kFrameRate = 50; // 1 frame = 20ms of audio. |
13 } | 13 } |
14 | 14 |
15 namespace speech_input { | 15 namespace speech { |
16 | 16 |
17 Endpointer::Endpointer(int sample_rate) | 17 Endpointer::Endpointer(int sample_rate) |
18 : speech_input_possibly_complete_silence_length_us_(-1), | 18 : speech_input_possibly_complete_silence_length_us_(-1), |
19 speech_input_complete_silence_length_us_(-1), | 19 speech_input_complete_silence_length_us_(-1), |
20 audio_frame_time_us_(0), | 20 audio_frame_time_us_(0), |
21 sample_rate_(sample_rate), | 21 sample_rate_(sample_rate), |
22 frame_size_(0) { | 22 frame_size_(0) { |
23 Reset(); | 23 Reset(); |
24 | 24 |
25 frame_size_ = static_cast<int>(sample_rate / static_cast<float>(kFrameRate)); | 25 frame_size_ = static_cast<int>(sample_rate / static_cast<float>(kFrameRate)); |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 speech_input_complete_ = true; | 158 speech_input_complete_ = true; |
159 } | 159 } |
160 } | 160 } |
161 } | 161 } |
162 old_ep_status_ = ep_status; | 162 old_ep_status_ = ep_status; |
163 } | 163 } |
164 return ep_status; | 164 return ep_status; |
165 } | 165 } |
166 | 166 |
167 } // namespace speech | 167 } // namespace speech |
OLD | NEW |