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 "base/memory/scoped_ptr.h" | 5 #include "base/memory/scoped_ptr.h" |
6 #include "base/synchronization/waitable_event.h" | 6 #include "base/synchronization/waitable_event.h" |
7 #include "base/win/scoped_com_initializer.h" | 7 #include "base/win/scoped_com_initializer.h" |
8 #include "base/win/scoped_handle.h" | 8 #include "base/win/scoped_handle.h" |
9 #include "media/audio/win/core_audio_util_win.h" | 9 #include "media/audio/win/core_audio_util_win.h" |
10 #include "testing/gmock/include/gmock/gmock.h" | 10 #include "testing/gmock/include/gmock/gmock.h" |
(...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
377 // Do a proper initialization and verify that it works this time. | 377 // Do a proper initialization and verify that it works this time. |
378 CoreAudioUtil::SharedModeInitialize(client, &format, NULL, | 378 CoreAudioUtil::SharedModeInitialize(client, &format, NULL, |
379 &endpoint_buffer_size); | 379 &endpoint_buffer_size); |
380 capture_client = CoreAudioUtil::CreateCaptureClient(client); | 380 capture_client = CoreAudioUtil::CreateCaptureClient(client); |
381 EXPECT_TRUE(capture_client); | 381 EXPECT_TRUE(capture_client); |
382 EXPECT_GT(endpoint_buffer_size, 0u); | 382 EXPECT_GT(endpoint_buffer_size, 0u); |
383 } | 383 } |
384 } | 384 } |
385 } | 385 } |
386 | 386 |
387 TEST_F(CoreAudioUtilWinTest, FillRenderEndpointBufferWithSilence) { | |
388 if (!CanRunAudioTest()) | |
389 return; | |
390 | |
391 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.
| |
392 size_t endpoint_buffer_size = 0; | |
393 | |
394 // Create default clients using the default mixing format for shared mode. | |
395 ScopedComPtr<IAudioClient> client( | |
396 CoreAudioUtil::CreateDefaultClient(eRender, eConsole)); | |
397 EXPECT_TRUE(client); | |
398 EXPECT_TRUE(SUCCEEDED(CoreAudioUtil::GetSharedModeMixFormat(client, | |
399 &format))); | |
400 CoreAudioUtil::SharedModeInitialize(client, &format, NULL, | |
401 &endpoint_buffer_size); | |
402 ScopedComPtr<IAudioRenderClient> render_client( | |
403 CoreAudioUtil::CreateRenderClient(client)); | |
404 EXPECT_TRUE(render_client); | |
405 EXPECT_GT(endpoint_buffer_size, 0u); | |
406 | |
407 // The endpoint audio buffer should not be filled up by default after being | |
408 // created. | |
409 UINT32 num_queued_frames = 0; | |
410 client->GetCurrentPadding(&num_queued_frames); | |
411 EXPECT_EQ(num_queued_frames, 0u); | |
412 | |
413 // Fill it up with zeros and verify that the buffer is full. | |
414 // It is not possible to verify that the actual data consists of zeros | |
415 // since we can't access data that has already been sent to the endpoint | |
416 // buffer. | |
417 EXPECT_TRUE(CoreAudioUtil::FillRenderEndpointBufferWithSilence( | |
418 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.
| |
419 client->GetCurrentPadding(&num_queued_frames); | |
420 EXPECT_EQ(num_queued_frames, endpoint_buffer_size); | |
421 } | |
422 | |
387 // | 423 // |
388 | 424 |
389 } // namespace media | 425 } // namespace media |
OLD | NEW |