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

Side by Side Diff: media/audio/cras/audio_manager_cras.h

Issue 2784433002: Ensures that audio tasks cannot run after AudioManager is deleted. (Closed)
Patch Set: rebase 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
« no previous file with comments | « media/audio/audio_thread_impl.cc ('k') | media/audio/cras/audio_manager_cras.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_CRAS_AUDIO_MANAGER_CRAS_H_ 5 #ifndef MEDIA_AUDIO_CRAS_AUDIO_MANAGER_CRAS_H_
6 #define MEDIA_AUDIO_CRAS_AUDIO_MANAGER_CRAS_H_ 6 #define MEDIA_AUDIO_CRAS_AUDIO_MANAGER_CRAS_H_
7 7
8 #include <cras_types.h> 8 #include <cras_types.h>
9 9
10 #include <string> 10 #include <string>
11 11
12 #include "base/compiler_specific.h" 12 #include "base/compiler_specific.h"
13 #include "base/macros.h" 13 #include "base/macros.h"
14 #include "base/memory/ref_counted.h" 14 #include "base/memory/ref_counted.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 MEDIA_EXPORT AudioManagerCras : public AudioManagerBase { 19 class MEDIA_EXPORT AudioManagerCras : public AudioManagerBase {
20 public: 20 public:
21 AudioManagerCras( 21 AudioManagerCras(std::unique_ptr<AudioThread> audio_thread,
22 scoped_refptr<base::SingleThreadTaskRunner> task_runner, 22 AudioLogFactory* audio_log_factory);
23 scoped_refptr<base::SingleThreadTaskRunner> worker_task_runner, 23 ~AudioManagerCras() override;
24 AudioLogFactory* audio_log_factory);
25 24
26 // AudioManager implementation. 25 // AudioManager implementation.
27 bool HasAudioOutputDevices() override; 26 bool HasAudioOutputDevices() override;
28 bool HasAudioInputDevices() override; 27 bool HasAudioInputDevices() override;
29 void ShowAudioInputSettings() override; 28 void ShowAudioInputSettings() override;
30 void GetAudioInputDeviceNames(AudioDeviceNames* device_names) override; 29 void GetAudioInputDeviceNames(AudioDeviceNames* device_names) override;
31 void GetAudioOutputDeviceNames(AudioDeviceNames* device_names) override; 30 void GetAudioOutputDeviceNames(AudioDeviceNames* device_names) override;
32 AudioParameters GetInputStreamParameters( 31 AudioParameters GetInputStreamParameters(
33 const std::string& device_id) override; 32 const std::string& device_id) override;
34 const char* GetName() override; 33 const char* GetName() override;
(...skipping 15 matching lines...) Expand all
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 51
53 static snd_pcm_format_t BitsToFormat(int bits_per_sample); 52 static snd_pcm_format_t BitsToFormat(int bits_per_sample);
54 53
55 // Checks if |device_id| corresponds to the default device. 54 // Checks if |device_id| corresponds to the default device.
56 // Set |is_input| to true for capture devices, false for output. 55 // Set |is_input| to true for capture devices, false for output.
57 bool IsDefault(const std::string& device_id, bool is_input); 56 bool IsDefault(const std::string& device_id, bool is_input);
58 57
59 protected: 58 protected:
60 ~AudioManagerCras() override;
61
62 AudioParameters GetPreferredOutputStreamParameters( 59 AudioParameters GetPreferredOutputStreamParameters(
63 const std::string& output_device_id, 60 const std::string& output_device_id,
64 const AudioParameters& input_params) override; 61 const AudioParameters& input_params) override;
65 62
66 private: 63 private:
67 // Called by MakeLinearOutputStream and MakeLowLatencyOutputStream. 64 // Called by MakeLinearOutputStream and MakeLowLatencyOutputStream.
68 AudioOutputStream* MakeOutputStream(const AudioParameters& params, 65 AudioOutputStream* MakeOutputStream(const AudioParameters& params,
69 const std::string& device_id); 66 const std::string& device_id);
70 67
71 // Called by MakeLinearInputStream and MakeLowLatencyInputStream. 68 // Called by MakeLinearInputStream and MakeLowLatencyInputStream.
(...skipping 12 matching lines...) Expand all
84 81
85 const char* beamforming_on_device_id_; 82 const char* beamforming_on_device_id_;
86 const char* beamforming_off_device_id_; 83 const char* beamforming_off_device_id_;
87 84
88 DISALLOW_COPY_AND_ASSIGN(AudioManagerCras); 85 DISALLOW_COPY_AND_ASSIGN(AudioManagerCras);
89 }; 86 };
90 87
91 } // namespace media 88 } // namespace media
92 89
93 #endif // MEDIA_AUDIO_CRAS_AUDIO_MANAGER_CRAS_H_ 90 #endif // MEDIA_AUDIO_CRAS_AUDIO_MANAGER_CRAS_H_
OLDNEW
« no previous file with comments | « media/audio/audio_thread_impl.cc ('k') | media/audio/cras/audio_manager_cras.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698