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 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
236 }; | 236 }; |
237 | 237 |
238 // Convenience method which creates a default AudioOutputStream object. | 238 // Convenience method which creates a default AudioOutputStream object. |
239 static AudioOutputStream* CreateDefaultAudioOutputStream( | 239 static AudioOutputStream* CreateDefaultAudioOutputStream( |
240 AudioManager* audio_manager) { | 240 AudioManager* audio_manager) { |
241 AudioOutputStreamWrapper aosw(audio_manager); | 241 AudioOutputStreamWrapper aosw(audio_manager); |
242 AudioOutputStream* aos = aosw.Create(); | 242 AudioOutputStream* aos = aosw.Create(); |
243 return aos; | 243 return aos; |
244 } | 244 } |
245 | 245 |
| 246 TEST(WASAPIAudioOutputStreamTest, HardwareChannelCount) { |
| 247 scoped_ptr<AudioManager> audio_manager(AudioManager::Create()); |
| 248 if (!CanRunAudioTests(audio_manager.get())) |
| 249 return; |
| 250 |
| 251 ScopedCOMInitializer com_init(ScopedCOMInitializer::kMTA); |
| 252 |
| 253 int channel_count = WASAPIAudioOutputStream::HardwareChannelCount(); |
| 254 EXPECT_GE(channel_count, 0); |
| 255 } |
| 256 |
246 // Verify that we can retrieve the current hardware/mixing sample rate | 257 // Verify that we can retrieve the current hardware/mixing sample rate |
247 // for all supported device roles. The ERole enumeration defines constants | 258 // for all supported device roles. The ERole enumeration defines constants |
248 // that indicate the role that the system/user has assigned to an audio | 259 // that indicate the role that the system/user has assigned to an audio |
249 // endpoint device. | 260 // endpoint device. |
250 // TODO(henrika): modify this test when we support full device enumeration. | 261 // TODO(henrika): modify this test when we support full device enumeration. |
251 TEST(WinAudioOutputTest, WASAPIAudioOutputStreamTestHardwareSampleRate) { | 262 TEST(WASAPIAudioOutputStreamTest, HardwareSampleRate) { |
252 // Skip this test in exclusive mode since the resulting rate is only utilized | 263 // Skip this test in exclusive mode since the resulting rate is only utilized |
253 // for shared mode streams. | 264 // for shared mode streams. |
254 scoped_ptr<AudioManager> audio_manager(AudioManager::Create()); | 265 scoped_ptr<AudioManager> audio_manager(AudioManager::Create()); |
255 if (!CanRunAudioTests(audio_manager.get()) || ExclusiveModeIsEnabled()) | 266 if (!CanRunAudioTests(audio_manager.get()) || ExclusiveModeIsEnabled()) |
256 return; | 267 return; |
257 | 268 |
258 ScopedCOMInitializer com_init(ScopedCOMInitializer::kMTA); | 269 ScopedCOMInitializer com_init(ScopedCOMInitializer::kMTA); |
259 | 270 |
260 // Default device intended for games, system notification sounds, | 271 // Default device intended for games, system notification sounds, |
261 // and voice commands. | 272 // and voice commands. |
262 int fs = static_cast<int>( | 273 int fs = static_cast<int>( |
263 WASAPIAudioOutputStream::HardwareSampleRate(eConsole)); | 274 WASAPIAudioOutputStream::HardwareSampleRate(eConsole)); |
264 EXPECT_GE(fs, 0); | 275 EXPECT_GE(fs, 0); |
265 | 276 |
266 // Default communication device intended for e.g. VoIP communication. | 277 // Default communication device intended for e.g. VoIP communication. |
267 fs = static_cast<int>( | 278 fs = static_cast<int>( |
268 WASAPIAudioOutputStream::HardwareSampleRate(eCommunications)); | 279 WASAPIAudioOutputStream::HardwareSampleRate(eCommunications)); |
269 EXPECT_GE(fs, 0); | 280 EXPECT_GE(fs, 0); |
270 | 281 |
271 // Multimedia device for music, movies and live music recording. | 282 // Multimedia device for music, movies and live music recording. |
272 fs = static_cast<int>( | 283 fs = static_cast<int>( |
273 WASAPIAudioOutputStream::HardwareSampleRate(eMultimedia)); | 284 WASAPIAudioOutputStream::HardwareSampleRate(eMultimedia)); |
274 EXPECT_GE(fs, 0); | 285 EXPECT_GE(fs, 0); |
275 } | 286 } |
276 | 287 |
277 // Test Create(), Close() calling sequence. | 288 // Test Create(), Close() calling sequence. |
278 TEST(WinAudioOutputTest, WASAPIAudioOutputStreamTestCreateAndClose) { | 289 TEST(WASAPIAudioOutputStreamTest, CreateAndClose) { |
279 scoped_ptr<AudioManager> audio_manager(AudioManager::Create()); | 290 scoped_ptr<AudioManager> audio_manager(AudioManager::Create()); |
280 if (!CanRunAudioTests(audio_manager.get())) | 291 if (!CanRunAudioTests(audio_manager.get())) |
281 return; | 292 return; |
282 AudioOutputStream* aos = CreateDefaultAudioOutputStream(audio_manager.get()); | 293 AudioOutputStream* aos = CreateDefaultAudioOutputStream(audio_manager.get()); |
283 aos->Close(); | 294 aos->Close(); |
284 } | 295 } |
285 | 296 |
286 // Test Open(), Close() calling sequence. | 297 // Test Open(), Close() calling sequence. |
287 TEST(WinAudioOutputTest, WASAPIAudioOutputStreamTestOpenAndClose) { | 298 TEST(WASAPIAudioOutputStreamTest, OpenAndClose) { |
288 scoped_ptr<AudioManager> audio_manager(AudioManager::Create()); | 299 scoped_ptr<AudioManager> audio_manager(AudioManager::Create()); |
289 if (!CanRunAudioTests(audio_manager.get())) | 300 if (!CanRunAudioTests(audio_manager.get())) |
290 return; | 301 return; |
291 AudioOutputStream* aos = CreateDefaultAudioOutputStream(audio_manager.get()); | 302 AudioOutputStream* aos = CreateDefaultAudioOutputStream(audio_manager.get()); |
292 EXPECT_TRUE(aos->Open()); | 303 EXPECT_TRUE(aos->Open()); |
293 aos->Close(); | 304 aos->Close(); |
294 } | 305 } |
295 | 306 |
296 // Test Open(), Start(), Close() calling sequence. | 307 // Test Open(), Start(), Close() calling sequence. |
297 TEST(WinAudioOutputTest, WASAPIAudioOutputStreamTestOpenStartAndClose) { | 308 TEST(WASAPIAudioOutputStreamTest, OpenStartAndClose) { |
298 scoped_ptr<AudioManager> audio_manager(AudioManager::Create()); | 309 scoped_ptr<AudioManager> audio_manager(AudioManager::Create()); |
299 if (!CanRunAudioTests(audio_manager.get())) | 310 if (!CanRunAudioTests(audio_manager.get())) |
300 return; | 311 return; |
301 AudioOutputStream* aos = CreateDefaultAudioOutputStream(audio_manager.get()); | 312 AudioOutputStream* aos = CreateDefaultAudioOutputStream(audio_manager.get()); |
302 EXPECT_TRUE(aos->Open()); | 313 EXPECT_TRUE(aos->Open()); |
303 MockAudioSourceCallback source; | 314 MockAudioSourceCallback source; |
304 EXPECT_CALL(source, OnError(aos, _)) | 315 EXPECT_CALL(source, OnError(aos, _)) |
305 .Times(0); | 316 .Times(0); |
306 aos->Start(&source); | 317 aos->Start(&source); |
307 aos->Close(); | 318 aos->Close(); |
308 } | 319 } |
309 | 320 |
310 // Test Open(), Start(), Stop(), Close() calling sequence. | 321 // Test Open(), Start(), Stop(), Close() calling sequence. |
311 TEST(WinAudioOutputTest, WASAPIAudioOutputStreamTestOpenStartStopAndClose) { | 322 TEST(WASAPIAudioOutputStreamTest, OpenStartStopAndClose) { |
312 scoped_ptr<AudioManager> audio_manager(AudioManager::Create()); | 323 scoped_ptr<AudioManager> audio_manager(AudioManager::Create()); |
313 if (!CanRunAudioTests(audio_manager.get())) | 324 if (!CanRunAudioTests(audio_manager.get())) |
314 return; | 325 return; |
315 AudioOutputStream* aos = CreateDefaultAudioOutputStream(audio_manager.get()); | 326 AudioOutputStream* aos = CreateDefaultAudioOutputStream(audio_manager.get()); |
316 EXPECT_TRUE(aos->Open()); | 327 EXPECT_TRUE(aos->Open()); |
317 MockAudioSourceCallback source; | 328 MockAudioSourceCallback source; |
318 EXPECT_CALL(source, OnError(aos, _)) | 329 EXPECT_CALL(source, OnError(aos, _)) |
319 .Times(0); | 330 .Times(0); |
320 aos->Start(&source); | 331 aos->Start(&source); |
321 aos->Stop(); | 332 aos->Stop(); |
322 aos->Close(); | 333 aos->Close(); |
323 } | 334 } |
324 | 335 |
325 // Test SetVolume(), GetVolume() | 336 // Test SetVolume(), GetVolume() |
326 TEST(WinAudioOutputTest, WASAPIAudioOutputStreamTestVolume) { | 337 TEST(WASAPIAudioOutputStreamTest, Volume) { |
327 scoped_ptr<AudioManager> audio_manager(AudioManager::Create()); | 338 scoped_ptr<AudioManager> audio_manager(AudioManager::Create()); |
328 if (!CanRunAudioTests(audio_manager.get())) | 339 if (!CanRunAudioTests(audio_manager.get())) |
329 return; | 340 return; |
330 AudioOutputStream* aos = CreateDefaultAudioOutputStream(audio_manager.get()); | 341 AudioOutputStream* aos = CreateDefaultAudioOutputStream(audio_manager.get()); |
331 | 342 |
332 // Initial volume should be full volume (1.0). | 343 // Initial volume should be full volume (1.0). |
333 double volume = 0.0; | 344 double volume = 0.0; |
334 aos->GetVolume(&volume); | 345 aos->GetVolume(&volume); |
335 EXPECT_EQ(1.0, volume); | 346 EXPECT_EQ(1.0, volume); |
336 | 347 |
(...skipping 16 matching lines...) Expand all Loading... |
353 EXPECT_EQ(1.0, volume); | 364 EXPECT_EQ(1.0, volume); |
354 | 365 |
355 aos->SetVolume(-0.5); | 366 aos->SetVolume(-0.5); |
356 aos->GetVolume(&volume); | 367 aos->GetVolume(&volume); |
357 EXPECT_EQ(1.0, volume); | 368 EXPECT_EQ(1.0, volume); |
358 | 369 |
359 aos->Close(); | 370 aos->Close(); |
360 } | 371 } |
361 | 372 |
362 // Test some additional calling sequences. | 373 // Test some additional calling sequences. |
363 TEST(WinAudioOutputTest, WASAPIAudioOutputStreamTestMiscCallingSequences) { | 374 TEST(WASAPIAudioOutputStreamTest, MiscCallingSequences) { |
364 scoped_ptr<AudioManager> audio_manager(AudioManager::Create()); | 375 scoped_ptr<AudioManager> audio_manager(AudioManager::Create()); |
365 if (!CanRunAudioTests(audio_manager.get())) | 376 if (!CanRunAudioTests(audio_manager.get())) |
366 return; | 377 return; |
367 | 378 |
368 AudioOutputStream* aos = CreateDefaultAudioOutputStream(audio_manager.get()); | 379 AudioOutputStream* aos = CreateDefaultAudioOutputStream(audio_manager.get()); |
369 WASAPIAudioOutputStream* waos = static_cast<WASAPIAudioOutputStream*>(aos); | 380 WASAPIAudioOutputStream* waos = static_cast<WASAPIAudioOutputStream*>(aos); |
370 | 381 |
371 // Open(), Open() is a valid calling sequence (second call does nothing). | 382 // Open(), Open() is a valid calling sequence (second call does nothing). |
372 EXPECT_TRUE(aos->Open()); | 383 EXPECT_TRUE(aos->Open()); |
373 EXPECT_TRUE(aos->Open()); | 384 EXPECT_TRUE(aos->Open()); |
(...skipping 19 matching lines...) Expand all Loading... |
393 EXPECT_FALSE(waos->started()); | 404 EXPECT_FALSE(waos->started()); |
394 aos->Start(&source); | 405 aos->Start(&source); |
395 EXPECT_TRUE(waos->started()); | 406 EXPECT_TRUE(waos->started()); |
396 aos->Stop(); | 407 aos->Stop(); |
397 EXPECT_FALSE(waos->started()); | 408 EXPECT_FALSE(waos->started()); |
398 | 409 |
399 aos->Close(); | 410 aos->Close(); |
400 } | 411 } |
401 | 412 |
402 // Use default packet size (10ms) and verify that rendering starts. | 413 // Use default packet size (10ms) and verify that rendering starts. |
403 TEST(WinAudioOutputTest, WASAPIAudioOutputStreamTestPacketSizeInMilliseconds) { | 414 TEST(WASAPIAudioOutputStreamTest, PacketSizeInMilliseconds) { |
404 scoped_ptr<AudioManager> audio_manager(AudioManager::Create()); | 415 scoped_ptr<AudioManager> audio_manager(AudioManager::Create()); |
405 if (!CanRunAudioTests(audio_manager.get())) | 416 if (!CanRunAudioTests(audio_manager.get())) |
406 return; | 417 return; |
407 | 418 |
408 MessageLoopForUI loop; | 419 MessageLoopForUI loop; |
409 MockAudioSourceCallback source; | 420 MockAudioSourceCallback source; |
410 | 421 |
411 // Create default WASAPI output stream which plays out in stereo using | 422 // Create default WASAPI output stream which plays out in stereo using |
412 // the shared mixing rate. The default buffer size is 10ms. | 423 // the shared mixing rate. The default buffer size is 10ms. |
413 AudioOutputStreamWrapper aosw(audio_manager.get()); | 424 AudioOutputStreamWrapper aosw(audio_manager.get()); |
(...skipping 17 matching lines...) Expand all Loading... |
431 aos->Start(&source); | 442 aos->Start(&source); |
432 loop.PostDelayedTask(FROM_HERE, MessageLoop::QuitClosure(), | 443 loop.PostDelayedTask(FROM_HERE, MessageLoop::QuitClosure(), |
433 TestTimeouts::action_timeout()); | 444 TestTimeouts::action_timeout()); |
434 loop.Run(); | 445 loop.Run(); |
435 aos->Stop(); | 446 aos->Stop(); |
436 aos->Close(); | 447 aos->Close(); |
437 } | 448 } |
438 | 449 |
439 // Use a fixed packets size (independent of sample rate) and verify | 450 // Use a fixed packets size (independent of sample rate) and verify |
440 // that rendering starts. | 451 // that rendering starts. |
441 TEST(WinAudioOutputTest, WASAPIAudioOutputStreamTestPacketSizeInSamples) { | 452 TEST(WASAPIAudioOutputStreamTest, PacketSizeInSamples) { |
442 scoped_ptr<AudioManager> audio_manager(AudioManager::Create()); | 453 scoped_ptr<AudioManager> audio_manager(AudioManager::Create()); |
443 if (!CanRunAudioTests(audio_manager.get())) | 454 if (!CanRunAudioTests(audio_manager.get())) |
444 return; | 455 return; |
445 | 456 |
446 MessageLoopForUI loop; | 457 MessageLoopForUI loop; |
447 MockAudioSourceCallback source; | 458 MockAudioSourceCallback source; |
448 | 459 |
449 // Create default WASAPI output stream which plays out in stereo using | 460 // Create default WASAPI output stream which plays out in stereo using |
450 // the shared mixing rate. The buffer size is set to 1024 samples. | 461 // the shared mixing rate. The buffer size is set to 1024 samples. |
451 AudioOutputStreamWrapper aosw(audio_manager.get()); | 462 AudioOutputStreamWrapper aosw(audio_manager.get()); |
(...skipping 16 matching lines...) Expand all Loading... |
468 .WillRepeatedly(Return(bytes_per_packet)); | 479 .WillRepeatedly(Return(bytes_per_packet)); |
469 | 480 |
470 aos->Start(&source); | 481 aos->Start(&source); |
471 loop.PostDelayedTask(FROM_HERE, MessageLoop::QuitClosure(), | 482 loop.PostDelayedTask(FROM_HERE, MessageLoop::QuitClosure(), |
472 TestTimeouts::action_timeout()); | 483 TestTimeouts::action_timeout()); |
473 loop.Run(); | 484 loop.Run(); |
474 aos->Stop(); | 485 aos->Stop(); |
475 aos->Close(); | 486 aos->Close(); |
476 } | 487 } |
477 | 488 |
478 TEST(WinAudioOutputTest, WASAPIAudioOutputStreamTestMono) { | 489 TEST(WASAPIAudioOutputStreamTest, Mono) { |
479 scoped_ptr<AudioManager> audio_manager(AudioManager::Create()); | 490 scoped_ptr<AudioManager> audio_manager(AudioManager::Create()); |
480 if (!CanRunAudioTests(audio_manager.get())) | 491 if (!CanRunAudioTests(audio_manager.get())) |
481 return; | 492 return; |
482 | 493 |
483 MessageLoopForUI loop; | 494 MessageLoopForUI loop; |
484 MockAudioSourceCallback source; | 495 MockAudioSourceCallback source; |
485 | 496 |
486 // Create default WASAPI output stream which plays out in *mono* using | 497 // Create default WASAPI output stream which plays out in *mono* using |
487 // the shared mixing rate. The default buffer size is 10ms. | 498 // the shared mixing rate. The default buffer size is 10ms. |
488 AudioOutputStreamWrapper aosw(audio_manager.get()); | 499 AudioOutputStreamWrapper aosw(audio_manager.get()); |
(...skipping 29 matching lines...) Expand all Loading... |
518 aos->Close(); | 529 aos->Close(); |
519 } | 530 } |
520 | 531 |
521 // This test is intended for manual tests and should only be enabled | 532 // This test is intended for manual tests and should only be enabled |
522 // when it is required to store the captured data on a local file. | 533 // when it is required to store the captured data on a local file. |
523 // By default, GTest will print out YOU HAVE 1 DISABLED TEST. | 534 // By default, GTest will print out YOU HAVE 1 DISABLED TEST. |
524 // To include disabled tests in test execution, just invoke the test program | 535 // To include disabled tests in test execution, just invoke the test program |
525 // with --gtest_also_run_disabled_tests or set the GTEST_ALSO_RUN_DISABLED_TESTS | 536 // with --gtest_also_run_disabled_tests or set the GTEST_ALSO_RUN_DISABLED_TESTS |
526 // environment variable to a value greater than 0. | 537 // environment variable to a value greater than 0. |
527 // The test files are approximately 20 seconds long. | 538 // The test files are approximately 20 seconds long. |
528 TEST(WinAudioOutputTest, DISABLED_WASAPIAudioOutputStreamReadFromFile) { | 539 TEST(WASAPIAudioOutputStreamTest, DISABLED_ReadFromFile) { |
529 scoped_ptr<AudioManager> audio_manager(AudioManager::Create()); | 540 scoped_ptr<AudioManager> audio_manager(AudioManager::Create()); |
530 if (!CanRunAudioTests(audio_manager.get())) | 541 if (!CanRunAudioTests(audio_manager.get())) |
531 return; | 542 return; |
532 | 543 |
533 AudioOutputStreamWrapper aosw(audio_manager.get()); | 544 AudioOutputStreamWrapper aosw(audio_manager.get()); |
534 AudioOutputStream* aos = aosw.Create(); | 545 AudioOutputStream* aos = aosw.Create(); |
535 EXPECT_TRUE(aos->Open()); | 546 EXPECT_TRUE(aos->Open()); |
536 | 547 |
537 std::string file_name; | 548 std::string file_name; |
538 if (aosw.sample_rate() == 48000) { | 549 if (aosw.sample_rate() == 48000) { |
(...skipping 27 matching lines...) Expand all Loading... |
566 } | 577 } |
567 | 578 |
568 LOG(INFO) << ">> File playout has stopped."; | 579 LOG(INFO) << ">> File playout has stopped."; |
569 aos->Close(); | 580 aos->Close(); |
570 } | 581 } |
571 | 582 |
572 // Verify that we can open the output stream in exclusive mode using a | 583 // Verify that we can open the output stream in exclusive mode using a |
573 // certain set of audio parameters and a sample rate of 48kHz. | 584 // certain set of audio parameters and a sample rate of 48kHz. |
574 // The expected outcomes of each setting in this test has been derived | 585 // The expected outcomes of each setting in this test has been derived |
575 // manually using log outputs (--v=1). | 586 // manually using log outputs (--v=1). |
576 TEST(WinAudioOutputTest, WASAPIExclusiveModeBufferSizesAt48kHz) { | 587 TEST(WASAPIAudioOutputStreamTest, ExclusiveModeBufferSizesAt48kHz) { |
577 if (!ExclusiveModeIsEnabled()) | 588 if (!ExclusiveModeIsEnabled()) |
578 return; | 589 return; |
579 | 590 |
580 scoped_ptr<AudioManager> audio_manager(AudioManager::Create()); | 591 scoped_ptr<AudioManager> audio_manager(AudioManager::Create()); |
581 if (!CanRunAudioTests(audio_manager.get())) | 592 if (!CanRunAudioTests(audio_manager.get())) |
582 return; | 593 return; |
583 | 594 |
584 AudioOutputStreamWrapper aosw(audio_manager.get()); | 595 AudioOutputStreamWrapper aosw(audio_manager.get()); |
585 | 596 |
586 // 10ms @ 48kHz shall work. | 597 // 10ms @ 48kHz shall work. |
(...skipping 30 matching lines...) Expand all Loading... |
617 // 3.3333ms @ 48kHz <=> smallest possible buffer size we can use. | 628 // 3.3333ms @ 48kHz <=> smallest possible buffer size we can use. |
618 aos = aosw.Create(48000, 160); | 629 aos = aosw.Create(48000, 160); |
619 EXPECT_TRUE(aos->Open()); | 630 EXPECT_TRUE(aos->Open()); |
620 aos->Close(); | 631 aos->Close(); |
621 } | 632 } |
622 | 633 |
623 // Verify that we can open the output stream in exclusive mode using a | 634 // Verify that we can open the output stream in exclusive mode using a |
624 // certain set of audio parameters and a sample rate of 44.1kHz. | 635 // certain set of audio parameters and a sample rate of 44.1kHz. |
625 // The expected outcomes of each setting in this test has been derived | 636 // The expected outcomes of each setting in this test has been derived |
626 // manually using log outputs (--v=1). | 637 // manually using log outputs (--v=1). |
627 TEST(WinAudioOutputTest, WASAPIExclusiveModeBufferSizesAt44kHz) { | 638 TEST(WASAPIAudioOutputStreamTest, ExclusiveModeBufferSizesAt44kHz) { |
628 if (!ExclusiveModeIsEnabled()) | 639 if (!ExclusiveModeIsEnabled()) |
629 return; | 640 return; |
630 | 641 |
631 scoped_ptr<AudioManager> audio_manager(AudioManager::Create()); | 642 scoped_ptr<AudioManager> audio_manager(AudioManager::Create()); |
632 if (!CanRunAudioTests(audio_manager.get())) | 643 if (!CanRunAudioTests(audio_manager.get())) |
633 return; | 644 return; |
634 | 645 |
635 AudioOutputStreamWrapper aosw(audio_manager.get()); | 646 AudioOutputStreamWrapper aosw(audio_manager.get()); |
636 | 647 |
637 // 10ms @ 44.1kHz does not work due to misalignment. | 648 // 10ms @ 44.1kHz does not work due to misalignment. |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
675 aos->Close(); | 686 aos->Close(); |
676 | 687 |
677 // 3.6281ms @ 44.1kHz <=> smallest possible buffer size we can use. | 688 // 3.6281ms @ 44.1kHz <=> smallest possible buffer size we can use. |
678 aos = aosw.Create(44100, 160); | 689 aos = aosw.Create(44100, 160); |
679 EXPECT_TRUE(aos->Open()); | 690 EXPECT_TRUE(aos->Open()); |
680 aos->Close(); | 691 aos->Close(); |
681 } | 692 } |
682 | 693 |
683 // Verify that we can open and start the output stream in exclusive mode at | 694 // Verify that we can open and start the output stream in exclusive mode at |
684 // the lowest possible delay at 48kHz. | 695 // the lowest possible delay at 48kHz. |
685 TEST(WinAudioOutputTest, WASAPIExclusiveModeMinBufferSizeAt48kHz) { | 696 TEST(WASAPIAudioOutputStreamTest, ExclusiveModeMinBufferSizeAt48kHz) { |
686 if (!ExclusiveModeIsEnabled()) | 697 if (!ExclusiveModeIsEnabled()) |
687 return; | 698 return; |
688 | 699 |
689 scoped_ptr<AudioManager> audio_manager(AudioManager::Create()); | 700 scoped_ptr<AudioManager> audio_manager(AudioManager::Create()); |
690 if (!CanRunAudioTests(audio_manager.get())) | 701 if (!CanRunAudioTests(audio_manager.get())) |
691 return; | 702 return; |
692 | 703 |
693 MessageLoopForUI loop; | 704 MessageLoopForUI loop; |
694 MockAudioSourceCallback source; | 705 MockAudioSourceCallback source; |
695 | 706 |
(...skipping 21 matching lines...) Expand all Loading... |
717 aos->Start(&source); | 728 aos->Start(&source); |
718 loop.PostDelayedTask(FROM_HERE, MessageLoop::QuitClosure(), | 729 loop.PostDelayedTask(FROM_HERE, MessageLoop::QuitClosure(), |
719 TestTimeouts::action_timeout()); | 730 TestTimeouts::action_timeout()); |
720 loop.Run(); | 731 loop.Run(); |
721 aos->Stop(); | 732 aos->Stop(); |
722 aos->Close(); | 733 aos->Close(); |
723 } | 734 } |
724 | 735 |
725 // Verify that we can open and start the output stream in exclusive mode at | 736 // Verify that we can open and start the output stream in exclusive mode at |
726 // the lowest possible delay at 44.1kHz. | 737 // the lowest possible delay at 44.1kHz. |
727 TEST(WinAudioOutputTest, WASAPIExclusiveModeMinBufferSizeAt44kHz) { | 738 TEST(WASAPIAudioOutputStreamTest, ExclusiveModeMinBufferSizeAt44kHz) { |
728 if (!ExclusiveModeIsEnabled()) | 739 if (!ExclusiveModeIsEnabled()) |
729 return; | 740 return; |
730 | 741 |
731 scoped_ptr<AudioManager> audio_manager(AudioManager::Create()); | 742 scoped_ptr<AudioManager> audio_manager(AudioManager::Create()); |
732 if (!CanRunAudioTests(audio_manager.get())) | 743 if (!CanRunAudioTests(audio_manager.get())) |
733 return; | 744 return; |
734 | 745 |
735 MessageLoopForUI loop; | 746 MessageLoopForUI loop; |
736 MockAudioSourceCallback source; | 747 MockAudioSourceCallback source; |
737 | 748 |
(...skipping 20 matching lines...) Expand all Loading... |
758 | 769 |
759 aos->Start(&source); | 770 aos->Start(&source); |
760 loop.PostDelayedTask(FROM_HERE, MessageLoop::QuitClosure(), | 771 loop.PostDelayedTask(FROM_HERE, MessageLoop::QuitClosure(), |
761 TestTimeouts::action_timeout()); | 772 TestTimeouts::action_timeout()); |
762 loop.Run(); | 773 loop.Run(); |
763 aos->Stop(); | 774 aos->Stop(); |
764 aos->Close(); | 775 aos->Close(); |
765 } | 776 } |
766 | 777 |
767 } // namespace media | 778 } // namespace media |
OLD | NEW |