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

Unified Diff: media/audio/audio_output_controller.h

Issue 8371013: Harden audio output controller making it safe to call Pause() before (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: '' Created 9 years, 2 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_output_controller.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/audio/audio_output_controller.h
===================================================================
--- media/audio/audio_output_controller.h (revision 106670)
+++ media/audio/audio_output_controller.h (working copy)
@@ -25,15 +25,21 @@
// All the public methods of AudioOutputController are non-blocking except
// close, the actual operations are performed on the audio controller thread.
//
-// Here is a state diagram for the AudioOutputController:
+// Here is a state diagram for the AudioOutputController for default low
+// latency mode; in normal latency mode there is no "starting" or "paused when
+// starting" states, "created" immediately switches to "playing":
//
-// .----> [ Closed / Error ] <------.
-// | ^ |
-// | | |
-// [ Created ] --> [ Playing ] --> [ Paused ]
-// ^ ^ |
-// | | |
-// *[ Empty ] `-----------------'
+// .-----------------------> [ Closed / Error ] <------.
+// | ^ |
+// | | |
+// [ Created ] --> [ Starting ] --> [ Playing ] --> [ Paused ]
+// ^ | ^ | ^
+// | | | | |
+// | | `----------------' |
+// | V |
+// | [ PausedWhenStarting ] ------------------------'
+// |
+// *[ Empty ]
//
// * Initial state
//
@@ -55,16 +61,6 @@
: public base::RefCountedThreadSafe<AudioOutputController>,
public AudioOutputStream::AudioSourceCallback {
public:
- // Internal state of the source.
- enum State {
- kEmpty,
- kCreated,
- kPlaying,
- kPaused,
- kClosed,
- kError,
- };
-
// Value sent by the controller to the renderer in low-latency mode
// indicating that the stream is paused.
static const int kPauseMark;
@@ -169,6 +165,19 @@
uint32 max_size, AudioBuffersState buffers_state);
virtual void OnError(AudioOutputStream* stream, int code);
+ protected:
+ // Internal state of the source.
+ enum State {
+ kEmpty,
+ kCreated,
+ kPlaying,
+ kStarting,
+ kPausedWhenStarting,
+ kPaused,
+ kClosed,
+ kError,
+ };
+
private:
// We are polling sync reader if data became available.
static const int kPollNumAttempts;
« no previous file with comments | « no previous file | media/audio/audio_output_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698