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

Side by Side Diff: media/audio/pulse/audio_manager_pulse.h

Issue 1806313003: Pass task runners to AudioManager constructor. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: addressed comments Created 4 years, 9 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 #ifndef MEDIA_AUDIO_PULSE_AUDIO_MANAGER_PULSE_H_ 5 #ifndef MEDIA_AUDIO_PULSE_AUDIO_MANAGER_PULSE_H_
6 #define MEDIA_AUDIO_PULSE_AUDIO_MANAGER_PULSE_H_ 6 #define MEDIA_AUDIO_PULSE_AUDIO_MANAGER_PULSE_H_
7 7
8 #include <pulse/pulseaudio.h> 8 #include <pulse/pulseaudio.h>
9 #include <string> 9 #include <string>
10 10
11 #include "base/compiler_specific.h" 11 #include "base/compiler_specific.h"
12 #include "base/macros.h" 12 #include "base/macros.h"
13 #include "base/memory/ref_counted.h" 13 #include "base/memory/ref_counted.h"
14 #include "media/audio/audio_manager_base.h" 14 #include "media/audio/audio_manager_base.h"
15 15
16 namespace media { 16 namespace media {
17 17
18 class MEDIA_EXPORT AudioManagerPulse : public AudioManagerBase { 18 class MEDIA_EXPORT AudioManagerPulse : public AudioManagerBase {
19 public: 19 public:
20 AudioManagerPulse(AudioLogFactory* audio_log_factory); 20 AudioManagerPulse(
21 scoped_refptr<base::SingleThreadTaskRunner> task_runner,
22 scoped_refptr<base::SingleThreadTaskRunner> worker_task_runner,
23 AudioLogFactory* audio_log_factory);
21 ~AudioManagerPulse() override; 24 ~AudioManagerPulse() override;
22 25
23 static AudioManager* Create(AudioLogFactory* audio_log_factory); 26 bool Init();
24 27
25 // Implementation of AudioManager. 28 // Implementation of AudioManager.
26 bool HasAudioOutputDevices() override; 29 bool HasAudioOutputDevices() override;
27 bool HasAudioInputDevices() override; 30 bool HasAudioInputDevices() override;
28 void ShowAudioInputSettings() override; 31 void ShowAudioInputSettings() override;
29 void GetAudioInputDeviceNames(AudioDeviceNames* device_names) override; 32 void GetAudioInputDeviceNames(AudioDeviceNames* device_names) override;
30 void GetAudioOutputDeviceNames(AudioDeviceNames* device_names) override; 33 void GetAudioOutputDeviceNames(AudioDeviceNames* device_names) override;
31 AudioParameters GetInputStreamParameters( 34 AudioParameters GetInputStreamParameters(
32 const std::string& device_id) override; 35 const std::string& device_id) override;
33 36
34 // Implementation of AudioManagerBase. 37 // Implementation of AudioManagerBase.
35 AudioOutputStream* MakeLinearOutputStream( 38 AudioOutputStream* MakeLinearOutputStream(
36 const AudioParameters& params) override; 39 const AudioParameters& params) override;
37 AudioOutputStream* MakeLowLatencyOutputStream( 40 AudioOutputStream* MakeLowLatencyOutputStream(
38 const AudioParameters& params, 41 const AudioParameters& params,
39 const std::string& device_id) override; 42 const std::string& device_id) override;
40 AudioInputStream* MakeLinearInputStream( 43 AudioInputStream* MakeLinearInputStream(
41 const AudioParameters& params, 44 const AudioParameters& params,
42 const std::string& device_id) override; 45 const std::string& device_id) override;
43 AudioInputStream* MakeLowLatencyInputStream( 46 AudioInputStream* MakeLowLatencyInputStream(
44 const AudioParameters& params, 47 const AudioParameters& params,
45 const std::string& device_id) override; 48 const std::string& device_id) override;
46 49
47 protected: 50 protected:
48 AudioParameters GetPreferredOutputStreamParameters( 51 AudioParameters GetPreferredOutputStreamParameters(
49 const std::string& output_device_id, 52 const std::string& output_device_id,
50 const AudioParameters& input_params) override; 53 const AudioParameters& input_params) override;
51 54
52 private: 55 private:
53 bool Init();
54 void DestroyPulse(); 56 void DestroyPulse();
55 57
56 void GetAudioDeviceNames(bool input, media::AudioDeviceNames* device_names); 58 void GetAudioDeviceNames(bool input, media::AudioDeviceNames* device_names);
57 59
58 // Callback to get the devices' info like names, used by GetInputDevices(). 60 // Callback to get the devices' info like names, used by GetInputDevices().
59 static void InputDevicesInfoCallback(pa_context* context, 61 static void InputDevicesInfoCallback(pa_context* context,
60 const pa_source_info* info, 62 const pa_source_info* info,
61 int error, void* user_data); 63 int error, void* user_data);
62 static void OutputDevicesInfoCallback(pa_context* context, 64 static void OutputDevicesInfoCallback(pa_context* context,
63 const pa_sink_info* info, 65 const pa_sink_info* info,
(...skipping 20 matching lines...) Expand all
84 pa_context* input_context_; 86 pa_context* input_context_;
85 AudioDeviceNames* devices_; 87 AudioDeviceNames* devices_;
86 int native_input_sample_rate_; 88 int native_input_sample_rate_;
87 89
88 DISALLOW_COPY_AND_ASSIGN(AudioManagerPulse); 90 DISALLOW_COPY_AND_ASSIGN(AudioManagerPulse);
89 }; 91 };
90 92
91 } // namespace media 93 } // namespace media
92 94
93 #endif // MEDIA_AUDIO_PULSE_AUDIO_MANAGER_PULSE_H_ 95 #endif // MEDIA_AUDIO_PULSE_AUDIO_MANAGER_PULSE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698