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/files/file_util.h" | 10 #include "base/files/file_util.h" |
(...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
373 // Create default WASAPI output stream which plays out in stereo using | 373 // Create default WASAPI output stream which plays out in stereo using |
374 // the shared mixing rate. The default buffer size is 10ms. | 374 // the shared mixing rate. The default buffer size is 10ms. |
375 AudioOutputStreamWrapper aosw(audio_manager.get()); | 375 AudioOutputStreamWrapper aosw(audio_manager.get()); |
376 AudioOutputStream* aos = aosw.Create(); | 376 AudioOutputStream* aos = aosw.Create(); |
377 EXPECT_TRUE(aos->Open()); | 377 EXPECT_TRUE(aos->Open()); |
378 | 378 |
379 // Derive the expected size in bytes of each packet. | 379 // Derive the expected size in bytes of each packet. |
380 uint32 bytes_per_packet = aosw.channels() * aosw.samples_per_packet() * | 380 uint32 bytes_per_packet = aosw.channels() * aosw.samples_per_packet() * |
381 (aosw.bits_per_sample() / 8); | 381 (aosw.bits_per_sample() / 8); |
382 | 382 |
383 // Wait for the first callback and verify its parameters. | 383 // Wait for the first callback and verify its parameters. Ignore any |
| 384 // subsequent callbacks that might arrive. |
384 EXPECT_CALL(source, OnMoreData(NotNull(), HasValidDelay(bytes_per_packet))) | 385 EXPECT_CALL(source, OnMoreData(NotNull(), HasValidDelay(bytes_per_packet))) |
385 .WillOnce(DoAll(QuitLoop(loop.task_runner()), | 386 .WillOnce(DoAll(QuitLoop(loop.task_runner()), |
386 Return(aosw.samples_per_packet()))); | 387 Return(aosw.samples_per_packet()))) |
| 388 .WillRepeatedly(Return(0)); |
387 | 389 |
388 aos->Start(&source); | 390 aos->Start(&source); |
389 loop.PostDelayedTask(FROM_HERE, base::MessageLoop::QuitWhenIdleClosure(), | 391 loop.PostDelayedTask(FROM_HERE, base::MessageLoop::QuitWhenIdleClosure(), |
390 TestTimeouts::action_timeout()); | 392 TestTimeouts::action_timeout()); |
391 loop.Run(); | 393 loop.Run(); |
392 aos->Stop(); | 394 aos->Stop(); |
393 aos->Close(); | 395 aos->Close(); |
394 } | 396 } |
395 | 397 |
396 // This test is intended for manual tests and should only be enabled | 398 // This test is intended for manual tests and should only be enabled |
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
615 | 617 |
616 aos->Start(&source); | 618 aos->Start(&source); |
617 loop.PostDelayedTask(FROM_HERE, base::MessageLoop::QuitWhenIdleClosure(), | 619 loop.PostDelayedTask(FROM_HERE, base::MessageLoop::QuitWhenIdleClosure(), |
618 TestTimeouts::action_timeout()); | 620 TestTimeouts::action_timeout()); |
619 loop.Run(); | 621 loop.Run(); |
620 aos->Stop(); | 622 aos->Stop(); |
621 aos->Close(); | 623 aos->Close(); |
622 } | 624 } |
623 | 625 |
624 } // namespace media | 626 } // namespace media |
OLD | NEW |