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

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

Issue 66183002: Replace MessageLoopProxy with SingleThreadTaskRunner for the rest of media/. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix win and audio tests Created 6 years, 11 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 | Annotate | Revision Log
« no previous file with comments | « media/audio/android/audio_manager_android.cc ('k') | media/audio/audio_input_controller.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_INPUT_CONTROLLER_H_ 5 #ifndef MEDIA_AUDIO_AUDIO_INPUT_CONTROLLER_H_
6 #define MEDIA_AUDIO_AUDIO_INPUT_CONTROLLER_H_ 6 #define MEDIA_AUDIO_AUDIO_INPUT_CONTROLLER_H_
7 7
8 #include <string> 8 #include <string>
9 #include "base/atomicops.h" 9 #include "base/atomicops.h"
10 #include "base/callback.h" 10 #include "base/callback.h"
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 // External synchronous writer for audio controller. 158 // External synchronous writer for audio controller.
159 SyncWriter* sync_writer, 159 SyncWriter* sync_writer,
160 UserInputMonitor* user_input_monitor); 160 UserInputMonitor* user_input_monitor);
161 161
162 // Factory method for creating an AudioInputController for low-latency mode, 162 // Factory method for creating an AudioInputController for low-latency mode,
163 // taking ownership of |stream|. The stream will be opened on the audio 163 // taking ownership of |stream|. The stream will be opened on the audio
164 // thread, and when that is done, the event handler will receive an 164 // thread, and when that is done, the event handler will receive an
165 // OnCreated() call from that same thread. |user_input_monitor| is used for 165 // OnCreated() call from that same thread. |user_input_monitor| is used for
166 // typing detection and can be NULL. 166 // typing detection and can be NULL.
167 static scoped_refptr<AudioInputController> CreateForStream( 167 static scoped_refptr<AudioInputController> CreateForStream(
168 const scoped_refptr<base::MessageLoopProxy>& message_loop, 168 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner,
169 EventHandler* event_handler, 169 EventHandler* event_handler,
170 AudioInputStream* stream, 170 AudioInputStream* stream,
171 // External synchronous writer for audio controller. 171 // External synchronous writer for audio controller.
172 SyncWriter* sync_writer, 172 SyncWriter* sync_writer,
173 UserInputMonitor* user_input_monitor); 173 UserInputMonitor* user_input_monitor);
174 174
175 // Starts recording using the created audio input stream. 175 // Starts recording using the created audio input stream.
176 // This method is called on the creator thread. 176 // This method is called on the creator thread.
177 virtual void Record(); 177 virtual void Record();
178 178
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
234 // times out. Called on the audio thread. 234 // times out. Called on the audio thread.
235 void DoCheckForNoData(); 235 void DoCheckForNoData();
236 236
237 // Helper method that stops, closes, and NULL:s |*stream_|. 237 // Helper method that stops, closes, and NULL:s |*stream_|.
238 // Signals event when done if the event is not NULL. 238 // Signals event when done if the event is not NULL.
239 void DoStopCloseAndClearStream(base::WaitableEvent* done); 239 void DoStopCloseAndClearStream(base::WaitableEvent* done);
240 240
241 void SetDataIsActive(bool enabled); 241 void SetDataIsActive(bool enabled);
242 bool GetDataIsActive(); 242 bool GetDataIsActive();
243 243
244 // Gives access to the message loop of the creating thread. 244 // Gives access to the task runner of the creating thread.
245 scoped_refptr<base::MessageLoopProxy> creator_loop_; 245 scoped_refptr<base::SingleThreadTaskRunner> creator_task_runner_;
246 246
247 // The message loop of audio-manager thread that this object runs on. 247 // The task runner of audio-manager thread that this object runs on.
248 scoped_refptr<base::MessageLoopProxy> message_loop_; 248 scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
249 249
250 // Contains the AudioInputController::EventHandler which receives state 250 // Contains the AudioInputController::EventHandler which receives state
251 // notifications from this class. 251 // notifications from this class.
252 EventHandler* handler_; 252 EventHandler* handler_;
253 253
254 // Pointer to the audio input stream object. 254 // Pointer to the audio input stream object.
255 AudioInputStream* stream_; 255 AudioInputStream* stream_;
256 256
257 // |no_data_timer_| is used to call OnError() when we stop receiving 257 // |no_data_timer_| is used to call OnError() when we stop receiving
258 // OnData() calls. This can occur when an audio input device is unplugged 258 // OnData() calls. This can occur when an audio input device is unplugged
(...skipping 25 matching lines...) Expand all
284 UserInputMonitor* user_input_monitor_; 284 UserInputMonitor* user_input_monitor_;
285 285
286 size_t prev_key_down_count_; 286 size_t prev_key_down_count_;
287 287
288 DISALLOW_COPY_AND_ASSIGN(AudioInputController); 288 DISALLOW_COPY_AND_ASSIGN(AudioInputController);
289 }; 289 };
290 290
291 } // namespace media 291 } // namespace media
292 292
293 #endif // MEDIA_AUDIO_AUDIO_INPUT_CONTROLLER_H_ 293 #endif // MEDIA_AUDIO_AUDIO_INPUT_CONTROLLER_H_
OLDNEW
« no previous file with comments | « media/audio/android/audio_manager_android.cc ('k') | media/audio/audio_input_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698