Chromium Code Reviews| Index: media/audio/win/core_audio_util_win_unittest.cc |
| diff --git a/media/audio/win/core_audio_util_win_unittest.cc b/media/audio/win/core_audio_util_win_unittest.cc |
| index b1edf4704544b95dfdd4457d8f5d890048733d27..d3336f8f9c8abddfa9b3ecfd9877f7e5d8f7f82f 100644 |
| --- a/media/audio/win/core_audio_util_win_unittest.cc |
| +++ b/media/audio/win/core_audio_util_win_unittest.cc |
| @@ -384,6 +384,42 @@ TEST_F(CoreAudioUtilWinTest, CreateRenderAndCaptureClients) { |
| } |
| } |
| +TEST_F(CoreAudioUtilWinTest, FillRenderEndpointBufferWithSilence) { |
| + if (!CanRunAudioTest()) |
| + return; |
| + |
| + WAVEFORMATPCMEX format; |
|
tommi (sloooow) - chröme
2013/02/01 11:57:53
move these variables down to where they're used.
henrika (OOO until Aug 14)
2013/02/01 12:23:52
Done.
|
| + size_t endpoint_buffer_size = 0; |
| + |
| + // Create default clients using the default mixing format for shared mode. |
| + ScopedComPtr<IAudioClient> client( |
| + CoreAudioUtil::CreateDefaultClient(eRender, eConsole)); |
| + EXPECT_TRUE(client); |
| + EXPECT_TRUE(SUCCEEDED(CoreAudioUtil::GetSharedModeMixFormat(client, |
| + &format))); |
| + CoreAudioUtil::SharedModeInitialize(client, &format, NULL, |
| + &endpoint_buffer_size); |
| + ScopedComPtr<IAudioRenderClient> render_client( |
| + CoreAudioUtil::CreateRenderClient(client)); |
| + EXPECT_TRUE(render_client); |
| + EXPECT_GT(endpoint_buffer_size, 0u); |
| + |
| + // The endpoint audio buffer should not be filled up by default after being |
| + // created. |
| + UINT32 num_queued_frames = 0; |
| + client->GetCurrentPadding(&num_queued_frames); |
| + EXPECT_EQ(num_queued_frames, 0u); |
| + |
| + // Fill it up with zeros and verify that the buffer is full. |
| + // It is not possible to verify that the actual data consists of zeros |
| + // since we can't access data that has already been sent to the endpoint |
| + // buffer. |
| + EXPECT_TRUE(CoreAudioUtil::FillRenderEndpointBufferWithSilence( |
| + client, render_client)); |
|
tommi (sloooow) - chröme
2013/02/01 11:57:53
fix indent
henrika (OOO until Aug 14)
2013/02/01 12:23:52
Done.
|
| + client->GetCurrentPadding(&num_queued_frames); |
| + EXPECT_EQ(num_queued_frames, endpoint_buffer_size); |
| +} |
| + |
| // |
| } // namespace media |