Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(443)

Unified Diff: media/audio/win/core_audio_util_win_unittest.cc

Issue 12049070: Avoids irregular OnMoreData callbacks on Windows using Core Audio (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed audio glitch at startup Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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
« media/audio/win/audio_unified_win.cc ('K') | « media/audio/win/core_audio_util_win.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698