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

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

Issue 2799363005: Removing public access to AudioManager device info interface. (Closed)
Patch Set: rebase Created 3 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
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 "media/audio/win/audio_low_latency_output_win.h" 5 #include "media/audio/win/audio_low_latency_output_win.h"
6 6
7 #include <windows.h> 7 #include <windows.h>
8 #include <mmsystem.h> 8 #include <mmsystem.h>
9 #include <stddef.h> 9 #include <stddef.h>
10 #include <stdint.h> 10 #include <stdint.h>
11 11
12 #include <memory> 12 #include <memory>
13 13
14 #include "base/environment.h" 14 #include "base/environment.h"
15 #include "base/files/file_util.h" 15 #include "base/files/file_util.h"
16 #include "base/message_loop/message_loop.h" 16 #include "base/message_loop/message_loop.h"
17 #include "base/path_service.h" 17 #include "base/path_service.h"
18 #include "base/run_loop.h" 18 #include "base/run_loop.h"
19 #include "base/single_thread_task_runner.h" 19 #include "base/single_thread_task_runner.h"
20 #include "base/test/test_timeouts.h" 20 #include "base/test/test_timeouts.h"
21 #include "base/time/time.h" 21 #include "base/time/time.h"
22 #include "base/win/scoped_com_initializer.h" 22 #include "base/win/scoped_com_initializer.h"
23 #include "media/audio/audio_device_description.h" 23 #include "media/audio/audio_device_description.h"
24 #include "media/audio/audio_device_info_accessor_for_tests.h"
24 #include "media/audio/audio_io.h" 25 #include "media/audio/audio_io.h"
25 #include "media/audio/audio_manager.h" 26 #include "media/audio/audio_manager.h"
26 #include "media/audio/audio_unittest_util.h" 27 #include "media/audio/audio_unittest_util.h"
27 #include "media/audio/mock_audio_source_callback.h" 28 #include "media/audio/mock_audio_source_callback.h"
28 #include "media/audio/win/core_audio_util_win.h" 29 #include "media/audio/win/core_audio_util_win.h"
29 #include "media/base/decoder_buffer.h" 30 #include "media/base/decoder_buffer.h"
30 #include "media/base/seekable_buffer.h" 31 #include "media/base/seekable_buffer.h"
31 #include "media/base/test_data_util.h" 32 #include "media/base/test_data_util.h"
32 #include "testing/gmock/include/gmock/gmock.h" 33 #include "testing/gmock/include/gmock/gmock.h"
33 #include "testing/gmock_mutant.h" 34 #include "testing/gmock_mutant.h"
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 152
152 static bool ExclusiveModeIsEnabled() { 153 static bool ExclusiveModeIsEnabled() {
153 return (WASAPIAudioOutputStream::GetShareMode() == 154 return (WASAPIAudioOutputStream::GetShareMode() ==
154 AUDCLNT_SHAREMODE_EXCLUSIVE); 155 AUDCLNT_SHAREMODE_EXCLUSIVE);
155 } 156 }
156 157
157 static bool HasCoreAudioAndOutputDevices(AudioManager* audio_man) { 158 static bool HasCoreAudioAndOutputDevices(AudioManager* audio_man) {
158 // The low-latency (WASAPI-based) version requires Windows Vista or higher. 159 // The low-latency (WASAPI-based) version requires Windows Vista or higher.
159 // TODO(henrika): note that we use Wave today to query the number of 160 // TODO(henrika): note that we use Wave today to query the number of
160 // existing output devices. 161 // existing output devices.
161 return CoreAudioUtil::IsSupported() && audio_man->HasAudioOutputDevices(); 162 return CoreAudioUtil::IsSupported() &&
163 AudioDeviceInfoAccessorForTests(audio_man).HasAudioOutputDevices();
162 } 164 }
163 165
164 // Convenience method which creates a default AudioOutputStream object but 166 // Convenience method which creates a default AudioOutputStream object but
165 // also allows the user to modify the default settings. 167 // also allows the user to modify the default settings.
166 class AudioOutputStreamWrapper { 168 class AudioOutputStreamWrapper {
167 public: 169 public:
168 explicit AudioOutputStreamWrapper(AudioManager* audio_manager) 170 explicit AudioOutputStreamWrapper(AudioManager* audio_manager)
169 : audio_man_(audio_manager), 171 : audio_man_(audio_manager),
170 format_(AudioParameters::AUDIO_PCM_LOW_LATENCY), 172 format_(AudioParameters::AUDIO_PCM_LOW_LATENCY),
171 bits_per_sample_(kBitsPerSample) { 173 bits_per_sample_(kBitsPerSample) {
(...skipping 440 matching lines...) Expand 10 before | Expand all | Expand 10 after
612 aos->Start(&source); 614 aos->Start(&source);
613 message_loop_.task_runner()->PostDelayedTask( 615 message_loop_.task_runner()->PostDelayedTask(
614 FROM_HERE, base::MessageLoop::QuitWhenIdleClosure(), 616 FROM_HERE, base::MessageLoop::QuitWhenIdleClosure(),
615 TestTimeouts::action_timeout()); 617 TestTimeouts::action_timeout());
616 base::RunLoop().Run(); 618 base::RunLoop().Run();
617 aos->Stop(); 619 aos->Stop();
618 aos->Close(); 620 aos->Close();
619 } 621 }
620 622
621 } // namespace media 623 } // namespace media
OLDNEW
« no previous file with comments | « media/audio/win/audio_low_latency_input_win_unittest.cc ('k') | media/audio/win/audio_output_win_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698