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

Side by Side Diff: media/audio/audio_manager_base.h

Issue 2784433002: Ensures that audio tasks cannot run after AudioManager is deleted. (Closed)
Patch Set: cleanup 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 (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_AUDIO_MANAGER_BASE_H_ 5 #ifndef MEDIA_AUDIO_AUDIO_MANAGER_BASE_H_
6 #define MEDIA_AUDIO_AUDIO_MANAGER_BASE_H_ 6 #define MEDIA_AUDIO_AUDIO_MANAGER_BASE_H_
7 7
8 #include <memory> 8 #include <memory>
9 #include <string> 9 #include <string>
10 #include <unordered_set> 10 #include <unordered_set>
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 const std::string& device_id, 104 const std::string& device_id,
105 const LogCallback& log_callback) = 0; 105 const LogCallback& log_callback) = 0;
106 106
107 // Get number of input or output streams. 107 // Get number of input or output streams.
108 int input_stream_count() const { 108 int input_stream_count() const {
109 return static_cast<int>(input_streams_.size()); 109 return static_cast<int>(input_streams_.size());
110 } 110 }
111 int output_stream_count() const { return num_output_streams_; } 111 int output_stream_count() const { return num_output_streams_; }
112 112
113 protected: 113 protected:
114 AudioManagerBase( 114 AudioManagerBase(std::unique_ptr<AudioThread> audio_thread,
115 scoped_refptr<base::SingleThreadTaskRunner> task_runner, 115 AudioLogFactory* audio_log_factory);
116 scoped_refptr<base::SingleThreadTaskRunner> worker_task_runner,
117 AudioLogFactory* audio_log_factory);
118 116
119 // Releases all the audio output dispatchers. 117 // AudioManager:
120 // All audio streams should be closed before Shutdown() is called. 118 void ShutdownOnAudioThread() override;
121 // This must be called in the destructor of every AudioManagerBase
122 // implementation.
123 void Shutdown();
124 119
125 void SetMaxOutputStreamsAllowed(int max) { max_num_output_streams_ = max; } 120 void SetMaxOutputStreamsAllowed(int max) { max_num_output_streams_ = max; }
126 121
127 // Called by each platform specific AudioManager to notify output state change 122 // Called by each platform specific AudioManager to notify output state change
128 // listeners that a state change has occurred. Must be called from the audio 123 // listeners that a state change has occurred. Must be called from the audio
129 // thread. 124 // thread.
130 void NotifyAllOutputDeviceChangeListeners(); 125 void NotifyAllOutputDeviceChangeListeners();
131 126
132 // Returns user buffer size as specified on the command line or 0 if no buffer 127 // Returns user buffer size as specified on the command line or 0 if no buffer
133 // size has been specified. 128 // size has been specified.
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 200
206 // Debug recording manager. 201 // Debug recording manager.
207 std::unique_ptr<AudioDebugRecordingManager> debug_recording_manager_; 202 std::unique_ptr<AudioDebugRecordingManager> debug_recording_manager_;
208 203
209 DISALLOW_COPY_AND_ASSIGN(AudioManagerBase); 204 DISALLOW_COPY_AND_ASSIGN(AudioManagerBase);
210 }; 205 };
211 206
212 } // namespace media 207 } // namespace media
213 208
214 #endif // MEDIA_AUDIO_AUDIO_MANAGER_BASE_H_ 209 #endif // MEDIA_AUDIO_AUDIO_MANAGER_BASE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698