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

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

Issue 2784433002: Ensures that audio tasks cannot run after AudioManager is deleted. (Closed)
Patch Set: fixes content_browsertests and content_unittests Created 3 years, 8 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( 20 AudioManagerPulse(
21 scoped_refptr<base::SingleThreadTaskRunner> task_runner, 21 scoped_refptr<base::SingleThreadTaskRunner> task_runner,
22 scoped_refptr<base::SingleThreadTaskRunner> worker_task_runner, 22 scoped_refptr<base::SingleThreadTaskRunner> worker_task_runner,
23 AudioLogFactory* audio_log_factory); 23 AudioLogFactory* audio_log_factory);
24 ~AudioManagerPulse() override;
24 25
25 bool Init(); 26 bool Init();
26 27
27 // Implementation of AudioManager. 28 // Implementation of AudioManager.
29 void Shutdown() override;
28 bool HasAudioOutputDevices() override; 30 bool HasAudioOutputDevices() override;
29 bool HasAudioInputDevices() override; 31 bool HasAudioInputDevices() override;
30 void ShowAudioInputSettings() override; 32 void ShowAudioInputSettings() override;
31 void GetAudioInputDeviceNames(AudioDeviceNames* device_names) override; 33 void GetAudioInputDeviceNames(AudioDeviceNames* device_names) override;
32 void GetAudioOutputDeviceNames(AudioDeviceNames* device_names) override; 34 void GetAudioOutputDeviceNames(AudioDeviceNames* device_names) override;
33 AudioParameters GetInputStreamParameters( 35 AudioParameters GetInputStreamParameters(
34 const std::string& device_id) override; 36 const std::string& device_id) override;
35 const char* GetName() override; 37 const char* GetName() override;
36 38
37 // Implementation of AudioManagerBase. 39 // Implementation of AudioManagerBase.
38 AudioOutputStream* MakeLinearOutputStream( 40 AudioOutputStream* MakeLinearOutputStream(
39 const AudioParameters& params, 41 const AudioParameters& params,
40 const LogCallback& log_callback) override; 42 const LogCallback& log_callback) override;
41 AudioOutputStream* MakeLowLatencyOutputStream( 43 AudioOutputStream* MakeLowLatencyOutputStream(
42 const AudioParameters& params, 44 const AudioParameters& params,
43 const std::string& device_id, 45 const std::string& device_id,
44 const LogCallback& log_callback) override; 46 const LogCallback& log_callback) override;
45 AudioInputStream* MakeLinearInputStream( 47 AudioInputStream* MakeLinearInputStream(
46 const AudioParameters& params, 48 const AudioParameters& params,
47 const std::string& device_id, 49 const std::string& device_id,
48 const LogCallback& log_callback) override; 50 const LogCallback& log_callback) override;
49 AudioInputStream* MakeLowLatencyInputStream( 51 AudioInputStream* MakeLowLatencyInputStream(
50 const AudioParameters& params, 52 const AudioParameters& params,
51 const std::string& device_id, 53 const std::string& device_id,
52 const LogCallback& log_callback) override; 54 const LogCallback& log_callback) override;
53 55
54 protected: 56 protected:
55 ~AudioManagerPulse() override;
56
57 AudioParameters GetPreferredOutputStreamParameters( 57 AudioParameters GetPreferredOutputStreamParameters(
58 const std::string& output_device_id, 58 const std::string& output_device_id,
59 const AudioParameters& input_params) override; 59 const AudioParameters& input_params) override;
60 60
61 private: 61 private:
62 bool InitPulse(); 62 bool InitPulse();
63 void DestroyPulse(); 63 void DestroyPulse();
64 64
65 void GetAudioDeviceNames(bool input, media::AudioDeviceNames* device_names); 65 void GetAudioDeviceNames(bool input, media::AudioDeviceNames* device_names);
66 66
(...skipping 27 matching lines...) Expand all
94 AudioDeviceNames* devices_; 94 AudioDeviceNames* devices_;
95 int native_input_sample_rate_; 95 int native_input_sample_rate_;
96 int native_channel_count_; 96 int native_channel_count_;
97 97
98 DISALLOW_COPY_AND_ASSIGN(AudioManagerPulse); 98 DISALLOW_COPY_AND_ASSIGN(AudioManagerPulse);
99 }; 99 };
100 100
101 } // namespace media 101 } // namespace media
102 102
103 #endif // MEDIA_AUDIO_PULSE_AUDIO_MANAGER_PULSE_H_ 103 #endif // MEDIA_AUDIO_PULSE_AUDIO_MANAGER_PULSE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698