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 465 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
476 file_name = kSpeechFile_16b_s_44k; | 476 file_name = kSpeechFile_16b_s_44k; |
477 } else if (aosw.sample_rate() == 96000) { | 477 } else if (aosw.sample_rate() == 96000) { |
478 // Use 48kHz file at 96kHz as well. Will sound like Donald Duck. | 478 // Use 48kHz file at 96kHz as well. Will sound like Donald Duck. |
479 file_name = kSpeechFile_16b_s_48k; | 479 file_name = kSpeechFile_16b_s_48k; |
480 } else { | 480 } else { |
481 FAIL() << "This test supports 44.1, 48kHz and 96kHz only."; | 481 FAIL() << "This test supports 44.1, 48kHz and 96kHz only."; |
482 return; | 482 return; |
483 } | 483 } |
484 ReadFromFileAudioSource file_source(file_name); | 484 ReadFromFileAudioSource file_source(file_name); |
485 | 485 |
486 LOG(INFO) << "File name : " << file_name.c_str(); | 486 VLOG(0) << "File name : " << file_name.c_str(); |
487 LOG(INFO) << "Sample rate : " << aosw.sample_rate(); | 487 VLOG(0) << "Sample rate : " << aosw.sample_rate(); |
488 LOG(INFO) << "Bits per sample: " << aosw.bits_per_sample(); | 488 VLOG(0) << "Bits per sample: " << aosw.bits_per_sample(); |
489 LOG(INFO) << "#channels : " << aosw.channels(); | 489 VLOG(0) << "#channels : " << aosw.channels(); |
490 LOG(INFO) << "File size : " << file_source.file_size(); | 490 VLOG(0) << "File size : " << file_source.file_size(); |
491 LOG(INFO) << "#file segments : " << kNumFileSegments; | 491 VLOG(0) << "#file segments : " << kNumFileSegments; |
492 LOG(INFO) << ">> Listen to the stereo file while playing..."; | 492 VLOG(0) << ">> Listen to the stereo file while playing..."; |
493 | 493 |
494 for (int i = 0; i < kNumFileSegments; i++) { | 494 for (int i = 0; i < kNumFileSegments; i++) { |
495 // Each segment will start with a short (~20ms) block of zeros, hence | 495 // Each segment will start with a short (~20ms) block of zeros, hence |
496 // some short glitches might be heard in this test if kNumFileSegments | 496 // some short glitches might be heard in this test if kNumFileSegments |
497 // is larger than one. The exact length of the silence period depends on | 497 // is larger than one. The exact length of the silence period depends on |
498 // the selected sample rate. | 498 // the selected sample rate. |
499 aos->Start(&file_source); | 499 aos->Start(&file_source); |
500 base::PlatformThread::Sleep( | 500 base::PlatformThread::Sleep( |
501 base::TimeDelta::FromMilliseconds(kFileDurationMs / kNumFileSegments)); | 501 base::TimeDelta::FromMilliseconds(kFileDurationMs / kNumFileSegments)); |
502 aos->Stop(); | 502 aos->Stop(); |
503 } | 503 } |
504 | 504 |
505 LOG(INFO) << ">> Stereo file playout has stopped."; | 505 VLOG(0) << ">> Stereo file playout has stopped."; |
506 aos->Close(); | 506 aos->Close(); |
507 } | 507 } |
508 | 508 |
509 // Verify that we can open the output stream in exclusive mode using a | 509 // Verify that we can open the output stream in exclusive mode using a |
510 // certain set of audio parameters and a sample rate of 48kHz. | 510 // certain set of audio parameters and a sample rate of 48kHz. |
511 // The expected outcomes of each setting in this test has been derived | 511 // The expected outcomes of each setting in this test has been derived |
512 // manually using log outputs (--v=1). | 512 // manually using log outputs (--v=1). |
513 TEST(WASAPIAudioOutputStreamTest, ExclusiveModeBufferSizesAt48kHz) { | 513 TEST(WASAPIAudioOutputStreamTest, ExclusiveModeBufferSizesAt48kHz) { |
514 if (!ExclusiveModeIsEnabled()) | 514 if (!ExclusiveModeIsEnabled()) |
515 return; | 515 return; |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
693 | 693 |
694 aos->Start(&source); | 694 aos->Start(&source); |
695 loop.PostDelayedTask(FROM_HERE, base::MessageLoop::QuitClosure(), | 695 loop.PostDelayedTask(FROM_HERE, base::MessageLoop::QuitClosure(), |
696 TestTimeouts::action_timeout()); | 696 TestTimeouts::action_timeout()); |
697 loop.Run(); | 697 loop.Run(); |
698 aos->Stop(); | 698 aos->Stop(); |
699 aos->Close(); | 699 aos->Close(); |
700 } | 700 } |
701 | 701 |
702 } // namespace media | 702 } // namespace media |
OLD | NEW |