| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 450 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 461 | 461 |
| 462 MockAudioSourceCallback source; | 462 MockAudioSourceCallback source; |
| 463 | 463 |
| 464 // Create default WASAPI output stream which plays out in *mono* using | 464 // Create default WASAPI output stream which plays out in *mono* using |
| 465 // the shared mixing rate. The default buffer size is 10ms. | 465 // the shared mixing rate. The default buffer size is 10ms. |
| 466 AudioOutputStreamWrapper aosw(audio_manager); | 466 AudioOutputStreamWrapper aosw(audio_manager); |
| 467 AudioOutputStream* aos = aosw.Create(CHANNEL_LAYOUT_MONO); | 467 AudioOutputStream* aos = aosw.Create(CHANNEL_LAYOUT_MONO); |
| 468 bool opened; | 468 bool opened; |
| 469 EXPECT_TRUE(opened = aos->Open()); | 469 EXPECT_TRUE(opened = aos->Open()); |
| 470 if (!opened) { | 470 if (!opened) { |
| 471 delete aos; | 471 aos->Close(); |
| 472 return; | 472 return; |
| 473 } | 473 } |
| 474 // Derive the expected size in bytes of each packet. | 474 // Derive the expected size in bytes of each packet. |
| 475 uint32 bytes_per_packet = aosw.channels() * aosw.samples_per_packet() * | 475 uint32 bytes_per_packet = aosw.channels() * aosw.samples_per_packet() * |
| 476 (aosw.bits_per_sample() / 8); | 476 (aosw.bits_per_sample() / 8); |
| 477 | 477 |
| 478 // Set up expected minimum delay estimation. | 478 // Set up expected minimum delay estimation. |
| 479 AudioBuffersState state(0, bytes_per_packet); | 479 AudioBuffersState state(0, bytes_per_packet); |
| 480 | 480 |
| 481 EXPECT_CALL(source, OnMoreData(aos, NotNull(), bytes_per_packet, | 481 EXPECT_CALL(source, OnMoreData(aos, NotNull(), bytes_per_packet, |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 532 | 532 |
| 533 aos->Start(&file_source); | 533 aos->Start(&file_source); |
| 534 base::PlatformThread::Sleep(file_duration_ms); | 534 base::PlatformThread::Sleep(file_duration_ms); |
| 535 aos->Stop(); | 535 aos->Stop(); |
| 536 | 536 |
| 537 LOG(INFO) << ">> File playout has stopped."; | 537 LOG(INFO) << ">> File playout has stopped."; |
| 538 aos->Close(); | 538 aos->Close(); |
| 539 } | 539 } |
| 540 | 540 |
| 541 } // namespace media | 541 } // namespace media |
| OLD | NEW |