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

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: 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_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(
24 scoped_refptr<base::SingleThreadTaskRunner> task_runner, 24 scoped_refptr<base::SingleThreadTaskRunner> task_runner,
25 scoped_refptr<base::SingleThreadTaskRunner> worker_task_runner, 25 scoped_refptr<base::SingleThreadTaskRunner> worker_task_runner,
26 AudioLogFactory* audio_log_factory); 26 AudioLogFactory* audio_log_factory);
27 ~AudioManagerAlsa() override;
27 28
28 static void ShowLinuxAudioInputSettings(); 29 static void ShowLinuxAudioInputSettings();
29 30
30 // Implementation of AudioManager. 31 // Implementation of AudioManager.
32 void Shutdown() override;
31 bool HasAudioOutputDevices() override; 33 bool HasAudioOutputDevices() override;
32 bool HasAudioInputDevices() override; 34 bool HasAudioInputDevices() override;
33 void ShowAudioInputSettings() override; 35 void ShowAudioInputSettings() override;
34 void GetAudioInputDeviceNames(AudioDeviceNames* device_names) override; 36 void GetAudioInputDeviceNames(AudioDeviceNames* device_names) override;
35 void GetAudioOutputDeviceNames(AudioDeviceNames* device_names) override; 37 void GetAudioOutputDeviceNames(AudioDeviceNames* device_names) override;
36 AudioParameters GetInputStreamParameters( 38 AudioParameters GetInputStreamParameters(
37 const std::string& device_id) override; 39 const std::string& device_id) override;
38 const char* GetName() override; 40 const char* GetName() override;
39 41
40 // Implementation of AudioManagerBase. 42 // Implementation of AudioManagerBase.
41 AudioOutputStream* MakeLinearOutputStream( 43 AudioOutputStream* MakeLinearOutputStream(
42 const AudioParameters& params, 44 const AudioParameters& params,
43 const LogCallback& log_callback) override; 45 const LogCallback& log_callback) override;
44 AudioOutputStream* MakeLowLatencyOutputStream( 46 AudioOutputStream* MakeLowLatencyOutputStream(
45 const AudioParameters& params, 47 const AudioParameters& params,
46 const std::string& device_id, 48 const std::string& device_id,
47 const LogCallback& log_callback) override; 49 const LogCallback& log_callback) override;
48 AudioInputStream* MakeLinearInputStream( 50 AudioInputStream* MakeLinearInputStream(
49 const AudioParameters& params, 51 const AudioParameters& params,
50 const std::string& device_id, 52 const std::string& device_id,
51 const LogCallback& log_callback) override; 53 const LogCallback& log_callback) override;
52 AudioInputStream* MakeLowLatencyInputStream( 54 AudioInputStream* MakeLowLatencyInputStream(
53 const AudioParameters& params, 55 const AudioParameters& params,
54 const std::string& device_id, 56 const std::string& device_id,
55 const LogCallback& log_callback) override; 57 const LogCallback& log_callback) override;
56 58
57 protected: 59 protected:
58 ~AudioManagerAlsa() override;
59
60 AudioParameters GetPreferredOutputStreamParameters( 60 AudioParameters GetPreferredOutputStreamParameters(
61 const std::string& output_device_id, 61 const std::string& output_device_id,
62 const AudioParameters& input_params) override; 62 const AudioParameters& input_params) override;
63 63
64 private: 64 private:
65 enum StreamType { 65 enum StreamType {
66 kStreamPlayback = 0, 66 kStreamPlayback = 0,
67 kStreamCapture, 67 kStreamCapture,
68 }; 68 };
69 69
(...skipping 24 matching lines...) Expand all
94 const std::string& device_id); 94 const std::string& device_id);
95 95
96 std::unique_ptr<AlsaWrapper> wrapper_; 96 std::unique_ptr<AlsaWrapper> wrapper_;
97 97
98 DISALLOW_COPY_AND_ASSIGN(AudioManagerAlsa); 98 DISALLOW_COPY_AND_ASSIGN(AudioManagerAlsa);
99 }; 99 };
100 100
101 } // namespace media 101 } // namespace media
102 102
103 #endif // MEDIA_AUDIO_ALSA_AUDIO_MANAGER_ALSA_H_ 103 #endif // MEDIA_AUDIO_ALSA_AUDIO_MANAGER_ALSA_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698