| OLD | NEW |
| 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 <stddef.h> | 5 #include <stddef.h> |
| 6 #include <stdint.h> | 6 #include <stdint.h> |
| 7 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
| (...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 194 for (size_t i = 0; i < audio_packet_.size(); ++i) { | 194 for (size_t i = 0; i < audio_packet_.size(); ++i) { |
| 195 value += factor; | 195 value += factor; |
| 196 audio_packet_[i] = value % 100; | 196 audio_packet_[i] = value % 100; |
| 197 } | 197 } |
| 198 CopyPacketToAudioBus(); | 198 CopyPacketToAudioBus(); |
| 199 } | 199 } |
| 200 | 200 |
| 201 void OnData(media::AudioBus* data) { | 201 void OnData(media::AudioBus* data) { |
| 202 auto* writer = | 202 auto* writer = |
| 203 static_cast<AudioInputController::SyncWriter*>(recognizer_.get()); | 203 static_cast<AudioInputController::SyncWriter*>(recognizer_.get()); |
| 204 writer->Write(data, 0.0, false, 0); | 204 writer->Write(data, 0.0, false, base::TimeDelta(), base::TimeTicks::Now()); |
| 205 } | 205 } |
| 206 | 206 |
| 207 void WaitForAudioThreadToPostDeviceInfo() { | 207 void WaitForAudioThreadToPostDeviceInfo() { |
| 208 media::WaitableMessageLoopEvent event; | 208 media::WaitableMessageLoopEvent event; |
| 209 audio_thread_.task_runner()->PostTaskAndReply( | 209 audio_thread_.task_runner()->PostTaskAndReply( |
| 210 FROM_HERE, base::Bind(&base::DoNothing), event.GetClosure()); | 210 FROM_HERE, base::Bind(&base::DoNothing), event.GetClosure()); |
| 211 // Runs the loop and waits for the |audio_thread_| to call event's closure, | 211 // Runs the loop and waits for the |audio_thread_| to call event's closure, |
| 212 // which means AudioSystem reply containing device parameters is already | 212 // which means AudioSystem reply containing device parameters is already |
| 213 // queued on the main thread. | 213 // queued on the main thread. |
| 214 event.RunAndWait(); | 214 event.RunAndWait(); |
| (...skipping 421 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 636 | 636 |
| 637 EXPECT_EQ(SPEECH_RECOGNITION_ERROR_NONE, error_); | 637 EXPECT_EQ(SPEECH_RECOGNITION_ERROR_NONE, error_); |
| 638 EXPECT_FALSE(audio_ended_); | 638 EXPECT_FALSE(audio_ended_); |
| 639 EXPECT_FALSE(recognition_ended_); | 639 EXPECT_FALSE(recognition_ended_); |
| 640 recognizer_->AbortRecognition(); | 640 recognizer_->AbortRecognition(); |
| 641 base::RunLoop().RunUntilIdle(); | 641 base::RunLoop().RunUntilIdle(); |
| 642 CheckFinalEventsConsistency(); | 642 CheckFinalEventsConsistency(); |
| 643 } | 643 } |
| 644 | 644 |
| 645 } // namespace content | 645 } // namespace content |
| OLD | NEW |