| OLD | NEW |
| 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 <windows.h> | 5 #include <windows.h> |
| 6 #include <mmsystem.h> | 6 #include <mmsystem.h> |
| 7 | 7 |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/environment.h" | 9 #include "base/environment.h" |
| 10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
| (...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 309 | 309 |
| 310 MockAudioInputCallback sink; | 310 MockAudioInputCallback sink; |
| 311 | 311 |
| 312 // Derive the expected size in bytes of each recorded packet. | 312 // Derive the expected size in bytes of each recorded packet. |
| 313 uint32 bytes_per_packet = aisw.channels() * aisw.samples_per_packet() * | 313 uint32 bytes_per_packet = aisw.channels() * aisw.samples_per_packet() * |
| 314 (aisw.bits_per_sample() / 8); | 314 (aisw.bits_per_sample() / 8); |
| 315 | 315 |
| 316 // We use 10ms packets and will run the test until ten packets are received. | 316 // We use 10ms packets and will run the test until ten packets are received. |
| 317 // All should contain valid packets of the same size and a valid delay | 317 // All should contain valid packets of the same size and a valid delay |
| 318 // estimate. | 318 // estimate. |
| 319 EXPECT_CALL(sink, OnData( | 319 EXPECT_CALL(sink, |
| 320 ais, NotNull(), bytes_per_packet, Gt(bytes_per_packet), _)) | 320 OnData(ais, NotNull(), bytes_per_packet, Gt(bytes_per_packet), _)) |
| 321 .Times(AtLeast(10)) | 321 .Times(AtLeast(12)) |
| 322 .WillRepeatedly(CheckCountAndPostQuitTask(&count, 10, &loop)); | 322 .WillRepeatedly(CheckCountAndPostQuitTask(&count, 10, &loop)); |
| 323 ais->Start(&sink); | 323 ais->Start(&sink); |
| 324 loop.Run(); | 324 loop.Run(); |
| 325 ais->Stop(); | 325 ais->Stop(); |
| 326 | 326 |
| 327 // Store current packet size (to be used in the subsequent tests). | 327 // Store current packet size (to be used in the subsequent tests). |
| 328 int samples_per_packet_10ms = aisw.samples_per_packet(); | 328 int samples_per_packet_10ms = aisw.samples_per_packet(); |
| 329 | 329 |
| 330 EXPECT_CALL(sink, OnClose(ais)) | 330 EXPECT_CALL(sink, OnClose(ais)) |
| 331 .Times(1); | 331 .Times(1); |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 396 WriteToFileAudioSink file_sink(file_name); | 396 WriteToFileAudioSink file_sink(file_name); |
| 397 LOG(INFO) << ">> Speak into the default microphone while recording."; | 397 LOG(INFO) << ">> Speak into the default microphone while recording."; |
| 398 ais->Start(&file_sink); | 398 ais->Start(&file_sink); |
| 399 base::PlatformThread::Sleep(TestTimeouts::action_timeout()); | 399 base::PlatformThread::Sleep(TestTimeouts::action_timeout()); |
| 400 ais->Stop(); | 400 ais->Stop(); |
| 401 LOG(INFO) << ">> Recording has stopped."; | 401 LOG(INFO) << ">> Recording has stopped."; |
| 402 ais->Close(); | 402 ais->Close(); |
| 403 } | 403 } |
| 404 | 404 |
| 405 } // namespace media | 405 } // namespace media |
| OLD | NEW |