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

Side by Side Diff: media/audio/alsa/audio_manager_alsa.h

Issue 2784433002: Ensures that audio tasks cannot run after AudioManager is deleted. (Closed)
Patch Set: addressed comments 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_ALSA_AUDIO_MANAGER_ALSA_H_ 5 #ifndef MEDIA_AUDIO_ALSA_AUDIO_MANAGER_ALSA_H_
6 #define MEDIA_AUDIO_ALSA_AUDIO_MANAGER_ALSA_H_ 6 #define MEDIA_AUDIO_ALSA_AUDIO_MANAGER_ALSA_H_
7 7
8 #include <memory> 8 #include <memory>
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 "base/threading/thread.h" 14 #include "base/threading/thread.h"
15 #include "media/audio/audio_manager_base.h" 15 #include "media/audio/audio_manager_base.h"
16 16
17 namespace media { 17 namespace media {
18 18
19 class AlsaWrapper; 19 class AlsaWrapper;
20 20
21 class MEDIA_EXPORT AudioManagerAlsa : public AudioManagerBase { 21 class MEDIA_EXPORT AudioManagerAlsa : public AudioManagerBase {
22 public: 22 public:
23 AudioManagerAlsa( 23 AudioManagerAlsa(std::unique_ptr<AudioThread> audio_thread,
24 scoped_refptr<base::SingleThreadTaskRunner> task_runner, 24 AudioLogFactory* audio_log_factory);
25 scoped_refptr<base::SingleThreadTaskRunner> worker_task_runner, 25 ~AudioManagerAlsa() override;
26 AudioLogFactory* audio_log_factory);
27 26
28 static void ShowLinuxAudioInputSettings(); 27 static void ShowLinuxAudioInputSettings();
29 28
30 // Implementation of AudioManager. 29 // Implementation of AudioManager.
31 bool HasAudioOutputDevices() override; 30 bool HasAudioOutputDevices() override;
32 bool HasAudioInputDevices() override; 31 bool HasAudioInputDevices() override;
33 void ShowAudioInputSettings() override; 32 void ShowAudioInputSettings() override;
34 void GetAudioInputDeviceNames(AudioDeviceNames* device_names) override; 33 void GetAudioInputDeviceNames(AudioDeviceNames* device_names) override;
35 void GetAudioOutputDeviceNames(AudioDeviceNames* device_names) override; 34 void GetAudioOutputDeviceNames(AudioDeviceNames* device_names) override;
36 AudioParameters GetInputStreamParameters( 35 AudioParameters GetInputStreamParameters(
(...skipping 11 matching lines...) Expand all
48 AudioInputStream* MakeLinearInputStream( 47 AudioInputStream* MakeLinearInputStream(
49 const AudioParameters& params, 48 const AudioParameters& params,
50 const std::string& device_id, 49 const std::string& device_id,
51 const LogCallback& log_callback) override; 50 const LogCallback& log_callback) override;
52 AudioInputStream* MakeLowLatencyInputStream( 51 AudioInputStream* MakeLowLatencyInputStream(
53 const AudioParameters& params, 52 const AudioParameters& params,
54 const std::string& device_id, 53 const std::string& device_id,
55 const LogCallback& log_callback) override; 54 const LogCallback& log_callback) override;
56 55
57 protected: 56 protected:
58 ~AudioManagerAlsa() override; 57 void ShutdownOnAudioThread() override;
59
60 AudioParameters GetPreferredOutputStreamParameters( 58 AudioParameters GetPreferredOutputStreamParameters(
61 const std::string& output_device_id, 59 const std::string& output_device_id,
62 const AudioParameters& input_params) override; 60 const AudioParameters& input_params) override;
63 61
64 private: 62 private:
65 enum StreamType { 63 enum StreamType {
66 kStreamPlayback = 0, 64 kStreamPlayback = 0,
67 kStreamCapture, 65 kStreamCapture,
68 }; 66 };
69 67
(...skipping 24 matching lines...) Expand all
94 const std::string& device_id); 92 const std::string& device_id);
95 93
96 std::unique_ptr<AlsaWrapper> wrapper_; 94 std::unique_ptr<AlsaWrapper> wrapper_;
97 95
98 DISALLOW_COPY_AND_ASSIGN(AudioManagerAlsa); 96 DISALLOW_COPY_AND_ASSIGN(AudioManagerAlsa);
99 }; 97 };
100 98
101 } // namespace media 99 } // namespace media
102 100
103 #endif // MEDIA_AUDIO_ALSA_AUDIO_MANAGER_ALSA_H_ 101 #endif // MEDIA_AUDIO_ALSA_AUDIO_MANAGER_ALSA_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698