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

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

Issue 2885173002: Make AudioDebugFileWriter create its own file worker thread. (Closed)
Patch Set: Remove useless include 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_input_controller_unittest.cc ('k') | media/audio/audio_manager.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 (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_H_ 5 #ifndef MEDIA_AUDIO_AUDIO_MANAGER_H_
6 #define MEDIA_AUDIO_AUDIO_MANAGER_H_ 6 #define MEDIA_AUDIO_AUDIO_MANAGER_H_
7 7
8 #include <memory> 8 #include <memory>
9 #include <string> 9 #include <string>
10 10
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 // 47 //
48 // The manager will use |audio_thread->GetTaskRunner()| for audio IO. 48 // The manager will use |audio_thread->GetTaskRunner()| for audio IO.
49 // On OS_MACOSX, CoreAudio requires that |audio_thread->GetTaskRunner()| 49 // On OS_MACOSX, CoreAudio requires that |audio_thread->GetTaskRunner()|
50 // must belong to the main thread of the process, which in our case is sadly 50 // must belong to the main thread of the process, which in our case is sadly
51 // the browser UI thread. Failure to execute calls on the right thread leads 51 // the browser UI thread. Failure to execute calls on the right thread leads
52 // to crashes and odd behavior. See http://crbug.com/158170. 52 // to crashes and odd behavior. See http://crbug.com/158170.
53 // 53 //
54 // The manager will use |audio_thread->GetWorkerTaskRunner()| for heavyweight 54 // The manager will use |audio_thread->GetWorkerTaskRunner()| for heavyweight
55 // tasks. The |audio_thread->GetWorkerTaskRunner()| may be the same as 55 // tasks. The |audio_thread->GetWorkerTaskRunner()| may be the same as
56 // |audio_thread->GetTaskRunner()|. 56 // |audio_thread->GetTaskRunner()|.
57 //
58 // |file_task_runner| is used for audio debug recordings and is the task
59 // runner to do file output operations on.
60 static std::unique_ptr<AudioManager> Create( 57 static std::unique_ptr<AudioManager> Create(
61 std::unique_ptr<AudioThread> audio_thread, 58 std::unique_ptr<AudioThread> audio_thread,
62 scoped_refptr<base::SingleThreadTaskRunner> file_task_runner,
63 AudioLogFactory* audio_log_factory); 59 AudioLogFactory* audio_log_factory);
64 60
65 // A convenience wrapper of AudioManager::Create for testing. 61 // A convenience wrapper of AudioManager::Create for testing.
66 static std::unique_ptr<AudioManager> CreateForTesting( 62 static std::unique_ptr<AudioManager> CreateForTesting(
67 std::unique_ptr<AudioThread> audio_thread); 63 std::unique_ptr<AudioThread> audio_thread);
68 64
69 // Starts monitoring AudioManager task runner for hangs. 65 // Starts monitoring AudioManager task runner for hangs.
70 // Runs the monitor on the given |task_runner|, which must be different from 66 // Runs the monitor on the given |task_runner|, which must be different from
71 // AudioManager::GetTaskRunner to be meaningful. 67 // AudioManager::GetTaskRunner to be meaningful.
72 // This must be called only after an AudioManager instance is created. 68 // This must be called only after an AudioManager instance is created.
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 protected: 190 protected:
195 FRIEND_TEST_ALL_PREFIXES(AudioManagerTest, AudioDebugRecording); 191 FRIEND_TEST_ALL_PREFIXES(AudioManagerTest, AudioDebugRecording);
196 friend class AudioDeviceInfoAccessorForTests; 192 friend class AudioDeviceInfoAccessorForTests;
197 193
198 explicit AudioManager(std::unique_ptr<AudioThread> audio_thread); 194 explicit AudioManager(std::unique_ptr<AudioThread> audio_thread);
199 195
200 virtual void ShutdownOnAudioThread() = 0; 196 virtual void ShutdownOnAudioThread() = 0;
201 197
202 // Initializes output debug recording. Can be called on any thread; will post 198 // Initializes output debug recording. Can be called on any thread; will post
203 // to the audio thread if not called on it. 199 // to the audio thread if not called on it.
204 virtual void InitializeOutputDebugRecording( 200 virtual void InitializeOutputDebugRecording() = 0;
205 scoped_refptr<base::SingleThreadTaskRunner> file_task_runner) = 0;
206 201
207 // Returns true if the OS reports existence of audio devices. This does not 202 // Returns true if the OS reports existence of audio devices. This does not
208 // guarantee that the existing devices support all formats and sample rates. 203 // guarantee that the existing devices support all formats and sample rates.
209 virtual bool HasAudioOutputDevices() = 0; 204 virtual bool HasAudioOutputDevices() = 0;
210 205
211 // Returns true if the OS reports existence of audio recording devices. This 206 // Returns true if the OS reports existence of audio recording devices. This
212 // does not guarantee that the existing devices support all formats and 207 // does not guarantee that the existing devices support all formats and
213 // sample rates. 208 // sample rates.
214 virtual bool HasAudioInputDevices() = 0; 209 virtual bool HasAudioInputDevices() = 0;
215 210
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
274 std::unique_ptr<AudioThread> audio_thread_; 269 std::unique_ptr<AudioThread> audio_thread_;
275 bool shutdown_ = false; // True after |this| has been shutdown. 270 bool shutdown_ = false; // True after |this| has been shutdown.
276 271
277 THREAD_CHECKER(thread_checker_); 272 THREAD_CHECKER(thread_checker_);
278 DISALLOW_COPY_AND_ASSIGN(AudioManager); 273 DISALLOW_COPY_AND_ASSIGN(AudioManager);
279 }; 274 };
280 275
281 } // namespace media 276 } // namespace media
282 277
283 #endif // MEDIA_AUDIO_AUDIO_MANAGER_H_ 278 #endif // MEDIA_AUDIO_AUDIO_MANAGER_H_
OLDNEW
« no previous file with comments | « media/audio/audio_input_controller_unittest.cc ('k') | media/audio/audio_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698