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

Side by Side Diff: media/audio/linux/audio_manager_linux.cc

Issue 2632733002: media: Use fake audio manager in headless mode (Closed)
Patch Set: Created 3 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | 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 "base/command_line.h" 5 #include "base/command_line.h"
6 #include "base/metrics/histogram.h" 6 #include "base/metrics/histogram.h"
7 #include "media/audio/fake_audio_manager.h"
7 #include "media/base/media_switches.h" 8 #include "media/base/media_switches.h"
9 #include "ui/gfx/switches.h"
8 10
9 #if defined(USE_ALSA) 11 #if defined(USE_ALSA)
10 #include "media/audio/alsa/audio_manager_alsa.h" 12 #include "media/audio/alsa/audio_manager_alsa.h"
11 #else
12 #include "media/audio/fake_audio_manager.h"
13 #endif 13 #endif
14 #if defined(USE_CRAS) 14 #if defined(USE_CRAS)
15 #include "media/audio/cras/audio_manager_cras.h" 15 #include "media/audio/cras/audio_manager_cras.h"
16 #endif 16 #endif
17 #if defined(USE_PULSEAUDIO) 17 #if defined(USE_PULSEAUDIO)
18 #include "media/audio/pulse/audio_manager_pulse.h" 18 #include "media/audio/pulse/audio_manager_pulse.h"
19 #endif 19 #endif
20 20
21 namespace media { 21 namespace media {
22 22
23 enum LinuxAudioIO { 23 enum LinuxAudioIO {
24 kPulse, 24 kPulse,
25 kAlsa, 25 kAlsa,
26 kCras, 26 kCras,
27 kAudioIOMax = kCras // Must always be equal to largest logged entry. 27 kAudioIOMax = kCras // Must always be equal to largest logged entry.
28 }; 28 };
29 29
30 ScopedAudioManagerPtr CreateAudioManager( 30 ScopedAudioManagerPtr CreateAudioManager(
31 scoped_refptr<base::SingleThreadTaskRunner> task_runner, 31 scoped_refptr<base::SingleThreadTaskRunner> task_runner,
32 scoped_refptr<base::SingleThreadTaskRunner> worker_task_runner, 32 scoped_refptr<base::SingleThreadTaskRunner> worker_task_runner,
33 AudioLogFactory* audio_log_factory) { 33 AudioLogFactory* audio_log_factory) {
34 if (base::CommandLine::ForCurrentProcess()->HasSwitch(switches::kHeadless)) {
tommi (sloooow) - chröme 2017/01/13 18:02:27 This is bringing in unit test code into production
Sami 2017/01/13 18:38:06 Sorry, which tests are you referring to? The --hea
Sami 2017/01/13 18:51:04 FWIW there's some more background about Headless C
35 return ScopedAudioManagerPtr(
36 new FakeAudioManager(std::move(task_runner),
37 std::move(worker_task_runner), audio_log_factory));
38 }
39
34 #if defined(USE_CRAS) 40 #if defined(USE_CRAS)
35 if (base::CommandLine::ForCurrentProcess()->HasSwitch(switches::kUseCras)) { 41 if (base::CommandLine::ForCurrentProcess()->HasSwitch(switches::kUseCras)) {
36 UMA_HISTOGRAM_ENUMERATION("Media.LinuxAudioIO", kCras, kAudioIOMax + 1); 42 UMA_HISTOGRAM_ENUMERATION("Media.LinuxAudioIO", kCras, kAudioIOMax + 1);
37 return ScopedAudioManagerPtr( 43 return ScopedAudioManagerPtr(
38 new AudioManagerCras(std::move(task_runner), 44 new AudioManagerCras(std::move(task_runner),
39 std::move(worker_task_runner), audio_log_factory)); 45 std::move(worker_task_runner), audio_log_factory));
40 } 46 }
41 #endif 47 #endif
42 48
43 #if defined(USE_PULSEAUDIO) 49 #if defined(USE_PULSEAUDIO)
(...skipping 16 matching lines...) Expand all
60 new AudioManagerAlsa(std::move(task_runner), 66 new AudioManagerAlsa(std::move(task_runner),
61 std::move(worker_task_runner), audio_log_factory)); 67 std::move(worker_task_runner), audio_log_factory));
62 #else 68 #else
63 return ScopedAudioManagerPtr( 69 return ScopedAudioManagerPtr(
64 new FakeAudioManager(std::move(task_runner), 70 new FakeAudioManager(std::move(task_runner),
65 std::move(worker_task_runner), audio_log_factory)); 71 std::move(worker_task_runner), audio_log_factory));
66 #endif 72 #endif
67 } 73 }
68 74
69 } // namespace media 75 } // namespace media
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698