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

Side by Side Diff: media/audio/win/audio_output_win_unittest.cc

Issue 1111503003: Revert of Switch to STA mode for audio thread and WASAPI I/O streams. (Closed) Base URL: http://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 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 unified diff | Download patch
« no previous file with comments | « media/audio/win/audio_manager_win.h ('k') | media/audio/win/core_audio_util_win.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/base_paths.h" 9 #include "base/base_paths.h"
10 #include "base/memory/aligned_memory.h" 10 #include "base/memory/aligned_memory.h"
(...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after
420 } 420 }
421 421
422 // With the low latency mode, WASAPI is utilized by default for Vista and 422 // With the low latency mode, WASAPI is utilized by default for Vista and
423 // higher and Wave is used for XP and lower. It is possible to utilize a 423 // higher and Wave is used for XP and lower. It is possible to utilize a
424 // smaller buffer size for WASAPI than for Wave. 424 // smaller buffer size for WASAPI than for Wave.
425 TEST(WinAudioTest, PCMWaveStreamPlay200HzToneLowLatency) { 425 TEST(WinAudioTest, PCMWaveStreamPlay200HzToneLowLatency) {
426 scoped_ptr<AudioManager> audio_man(AudioManager::CreateForTesting()); 426 scoped_ptr<AudioManager> audio_man(AudioManager::CreateForTesting());
427 ABORT_AUDIO_TEST_IF_NOT(audio_man->HasAudioOutputDevices()); 427 ABORT_AUDIO_TEST_IF_NOT(audio_man->HasAudioOutputDevices());
428 428
429 // The WASAPI API requires a correct COM environment. 429 // The WASAPI API requires a correct COM environment.
430 ScopedCOMInitializer com_init; 430 ScopedCOMInitializer com_init(ScopedCOMInitializer::kMTA);
431 431
432 // Use 10 ms buffer size for WASAPI and 50 ms buffer size for Wave. 432 // Use 10 ms buffer size for WASAPI and 50 ms buffer size for Wave.
433 // Take the existing native sample rate into account. 433 // Take the existing native sample rate into account.
434 const AudioParameters params = audio_man->GetDefaultOutputStreamParameters(); 434 const AudioParameters params = audio_man->GetDefaultOutputStreamParameters();
435 int sample_rate = params.sample_rate(); 435 int sample_rate = params.sample_rate();
436 uint32 samples_10_ms = sample_rate / 100; 436 uint32 samples_10_ms = sample_rate / 100;
437 int n = 1; 437 int n = 1;
438 (base::win::GetVersion() <= base::win::VERSION_XP) ? n = 5 : n = 1; 438 (base::win::GetVersion() <= base::win::VERSION_XP) ? n = 5 : n = 1;
439 AudioOutputStream* oas = audio_man->MakeAudioOutputStream( 439 AudioOutputStream* oas = audio_man->MakeAudioOutputStream(
440 AudioParameters(AudioParameters::AUDIO_PCM_LOW_LATENCY, 440 AudioParameters(AudioParameters::AUDIO_PCM_LOW_LATENCY,
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
631 oas->Start(&source); 631 oas->Start(&source);
632 632
633 ::WaitForSingleObject(thread, INFINITE); 633 ::WaitForSingleObject(thread, INFINITE);
634 ::CloseHandle(thread); 634 ::CloseHandle(thread);
635 635
636 oas->Stop(); 636 oas->Stop();
637 oas->Close(); 637 oas->Close();
638 } 638 }
639 639
640 } // namespace media 640 } // namespace media
OLDNEW
« no previous file with comments | « media/audio/win/audio_manager_win.h ('k') | media/audio/win/core_audio_util_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698