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

Side by Side Diff: media/audio/mac/audio_manager_mac.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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_MAC_AUDIO_MANAGER_MAC_H_ 5 #ifndef MEDIA_AUDIO_MAC_AUDIO_MANAGER_MAC_H_
6 #define MEDIA_AUDIO_MAC_AUDIO_MANAGER_MAC_H_ 6 #define MEDIA_AUDIO_MAC_AUDIO_MANAGER_MAC_H_
7 7
8 #include <AudioUnit/AudioUnit.h> 8 #include <AudioUnit/AudioUnit.h>
9 #include <CoreAudio/AudioHardware.h> 9 #include <CoreAudio/AudioHardware.h>
10 #include <stddef.h> 10 #include <stddef.h>
(...skipping 15 matching lines...) Expand all
26 26
27 // Mac OS X implementation of the AudioManager singleton. This class is internal 27 // Mac OS X implementation of the AudioManager singleton. This class is internal
28 // to the audio output and only internal users can call methods not exposed by 28 // to the audio output and only internal users can call methods not exposed by
29 // the AudioManager class. 29 // the AudioManager class.
30 class MEDIA_EXPORT AudioManagerMac : public AudioManagerBase { 30 class MEDIA_EXPORT AudioManagerMac : public AudioManagerBase {
31 public: 31 public:
32 AudioManagerMac( 32 AudioManagerMac(
33 scoped_refptr<base::SingleThreadTaskRunner> task_runner, 33 scoped_refptr<base::SingleThreadTaskRunner> task_runner,
34 scoped_refptr<base::SingleThreadTaskRunner> worker_task_runner, 34 scoped_refptr<base::SingleThreadTaskRunner> worker_task_runner,
35 AudioLogFactory* audio_log_factory); 35 AudioLogFactory* audio_log_factory);
36 ~AudioManagerMac() override;
36 37
37 // Implementation of AudioManager. 38 // Implementation of AudioManager.
39 void Shutdown() override;
38 bool HasAudioOutputDevices() override; 40 bool HasAudioOutputDevices() override;
39 bool HasAudioInputDevices() override; 41 bool HasAudioInputDevices() override;
40 void GetAudioInputDeviceNames(AudioDeviceNames* device_names) override; 42 void GetAudioInputDeviceNames(AudioDeviceNames* device_names) override;
41 void GetAudioOutputDeviceNames(AudioDeviceNames* device_names) override; 43 void GetAudioOutputDeviceNames(AudioDeviceNames* device_names) override;
42 AudioParameters GetInputStreamParameters( 44 AudioParameters GetInputStreamParameters(
43 const std::string& device_id) override; 45 const std::string& device_id) override;
44 std::string GetAssociatedOutputDeviceID( 46 std::string GetAssociatedOutputDeviceID(
45 const std::string& input_device_id) override; 47 const std::string& input_device_id) override;
46 const char* GetName() override; 48 const char* GetName() override;
47 49
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 size_t* io_buffer_frame_size); 120 size_t* io_buffer_frame_size);
119 121
120 // Number of constructed output and input streams. 122 // Number of constructed output and input streams.
121 size_t output_streams() const { return output_streams_.size(); } 123 size_t output_streams() const { return output_streams_.size(); }
122 size_t low_latency_input_streams() const { 124 size_t low_latency_input_streams() const {
123 return low_latency_input_streams_.size(); 125 return low_latency_input_streams_.size();
124 } 126 }
125 size_t basic_input_streams() const { return basic_input_streams_.size(); } 127 size_t basic_input_streams() const { return basic_input_streams_.size(); }
126 128
127 protected: 129 protected:
128 ~AudioManagerMac() override;
129 AudioParameters GetPreferredOutputStreamParameters( 130 AudioParameters GetPreferredOutputStreamParameters(
130 const std::string& output_device_id, 131 const std::string& output_device_id,
131 const AudioParameters& input_params) override; 132 const AudioParameters& input_params) override;
132 133
133 private: 134 private:
134 void InitializeOnAudioThread(); 135 void InitializeOnAudioThread();
135 136
136 int ChooseBufferSize(bool is_input, int sample_rate); 137 int ChooseBufferSize(bool is_input, int sample_rate);
137 138
138 // Notify streams of a device change if the default output device or its 139 // Notify streams of a device change if the default output device or its
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 // Set to true in the destructor. Ensures that methods that touches native 187 // Set to true in the destructor. Ensures that methods that touches native
187 // Core Audio APIs are not executed during shutdown. 188 // Core Audio APIs are not executed during shutdown.
188 bool in_shutdown_; 189 bool in_shutdown_;
189 190
190 DISALLOW_COPY_AND_ASSIGN(AudioManagerMac); 191 DISALLOW_COPY_AND_ASSIGN(AudioManagerMac);
191 }; 192 };
192 193
193 } // namespace media 194 } // namespace media
194 195
195 #endif // MEDIA_AUDIO_MAC_AUDIO_MANAGER_MAC_H_ 196 #endif // MEDIA_AUDIO_MAC_AUDIO_MANAGER_MAC_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698