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

Unified Diff: media/audio/audio_device_thread.h

Issue 1830933002: Making AudioThread::Thread restartable *** DRAFT *** (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | media/audio/audio_device_thread.cc » ('j') | media/audio/audio_device_thread.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/audio/audio_device_thread.h
diff --git a/media/audio/audio_device_thread.h b/media/audio/audio_device_thread.h
index 3cd673c4520bda7e0799be7337c6c4db4d7e67f6..c787bd467f24b5dba29a5913d599d08c5cc988b2 100644
--- a/media/audio/audio_device_thread.h
+++ b/media/audio/audio_device_thread.h
@@ -76,13 +76,12 @@ class MEDIA_EXPORT AudioDeviceThread {
AudioDeviceThread();
~AudioDeviceThread();
- // Starts the audio thread. The thread must not already be running. If
- // |sychronized_buffers| is set, the browser expects to be notified via the
- // |socket| every time AudioDeviceThread::Process() completes.
- void Start(AudioDeviceThread::Callback* callback,
- base::SyncSocket::Handle socket,
- const char* thread_name,
- bool synchronized_buffers);
+ // Starts the audio thread and puts into wait mode. Play() must
+ // be called to release it and actually start running. The thread must not
+ // already be started. If |sychronized_buffers| is set, the browser expects
+ // to be notified via the |socket| every time AudioDeviceThread::Process()
+ // completes.
+ void Start(const char* thread_name, bool synchronized_buffers);
// This tells the audio thread to stop and clean up the data.
// The method can stop the thread synchronously or asynchronously.
@@ -95,10 +94,21 @@ class MEDIA_EXPORT AudioDeviceThread {
// If set to NULL, function will wait for the thread to exit before returning.
void Stop(base::MessageLoop* loop_for_join);
+ // Releases the thread from wait mode so that it starts running with the given
Guido Urdaneta 2016/04/01 10:17:01 Nit: Release is perhaps not the most familiar term
Henrik Grunell 2016/05/09 12:13:37 Done in other CL.
+ // |callback| and |socket|. This will also reset the index used for
+ // sychronized buffers.
+ void Play(AudioDeviceThread::Callback* callback,
+ base::SyncSocket::Handle socket);
+
+ // Puts the thread in the wait mode and shuts down the socket.
+ // It can be resumed again with Play().
+ void Pause();
+
// Returns true if the thread is stopped or stopping.
bool IsStopped();
private:
+ // Not sure if we need this extra class and extra lock?
Henrik Grunell 2016/03/25 09:24:01 Yeah, does the below motivation hold? It seems pre
Henrik Grunell 2016/05/09 12:13:37 Changed to TODO in other CL.
// Our own private SimpleThread override. We implement this in a
// private class so that we get the following benefits:
// 1) AudioDeviceThread doesn't expose SimpleThread methods.
« no previous file with comments | « no previous file | media/audio/audio_device_thread.cc » ('j') | media/audio/audio_device_thread.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698