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

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: chromeos and android build 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 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(std::unique_ptr<AudioThread> audio_thread,
21 scoped_refptr<base::SingleThreadTaskRunner> task_runner, 21 AudioLogFactory* audio_log_factory);
22 scoped_refptr<base::SingleThreadTaskRunner> worker_task_runner, 22 ~AudioManagerPulse() override;
23 AudioLogFactory* audio_log_factory);
24 23
25 bool Init(); 24 bool Init();
26 25
27 // Implementation of AudioManager. 26 // Implementation of AudioManager.
28 bool HasAudioOutputDevices() override; 27 bool HasAudioOutputDevices() override;
29 bool HasAudioInputDevices() override; 28 bool HasAudioInputDevices() override;
30 void ShowAudioInputSettings() override; 29 void ShowAudioInputSettings() override;
31 void GetAudioInputDeviceNames(AudioDeviceNames* device_names) override; 30 void GetAudioInputDeviceNames(AudioDeviceNames* device_names) override;
32 void GetAudioOutputDeviceNames(AudioDeviceNames* device_names) override; 31 void GetAudioOutputDeviceNames(AudioDeviceNames* device_names) override;
33 AudioParameters GetInputStreamParameters( 32 AudioParameters GetInputStreamParameters(
(...skipping 11 matching lines...) Expand all
45 AudioInputStream* MakeLinearInputStream( 44 AudioInputStream* MakeLinearInputStream(
46 const AudioParameters& params, 45 const AudioParameters& params,
47 const std::string& device_id, 46 const std::string& device_id,
48 const LogCallback& log_callback) override; 47 const LogCallback& log_callback) override;
49 AudioInputStream* MakeLowLatencyInputStream( 48 AudioInputStream* MakeLowLatencyInputStream(
50 const AudioParameters& params, 49 const AudioParameters& params,
51 const std::string& device_id, 50 const std::string& device_id,
52 const LogCallback& log_callback) override; 51 const LogCallback& log_callback) override;
53 52
54 protected: 53 protected:
55 ~AudioManagerPulse() override; 54 void ShutdownOnAudioThread() override;
56
57 AudioParameters GetPreferredOutputStreamParameters( 55 AudioParameters GetPreferredOutputStreamParameters(
58 const std::string& output_device_id, 56 const std::string& output_device_id,
59 const AudioParameters& input_params) override; 57 const AudioParameters& input_params) override;
60 58
61 private: 59 private:
62 bool InitPulse(); 60 bool InitPulse();
63 void DestroyPulse(); 61 void DestroyPulse();
64 62
65 void GetAudioDeviceNames(bool input, media::AudioDeviceNames* device_names); 63 void GetAudioDeviceNames(bool input, media::AudioDeviceNames* device_names);
66 64
(...skipping 27 matching lines...) Expand all
94 AudioDeviceNames* devices_; 92 AudioDeviceNames* devices_;
95 int native_input_sample_rate_; 93 int native_input_sample_rate_;
96 int native_channel_count_; 94 int native_channel_count_;
97 95
98 DISALLOW_COPY_AND_ASSIGN(AudioManagerPulse); 96 DISALLOW_COPY_AND_ASSIGN(AudioManagerPulse);
99 }; 97 };
100 98
101 } // namespace media 99 } // namespace media
102 100
103 #endif // MEDIA_AUDIO_PULSE_AUDIO_MANAGER_PULSE_H_ 101 #endif // MEDIA_AUDIO_PULSE_AUDIO_MANAGER_PULSE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698