Chromium Code Reviews| Index: media/audio/audio_output_device.h |
| diff --git a/media/audio/audio_output_device.h b/media/audio/audio_output_device.h |
| index fe4459cc5018d411041b39c49a3e4f35a90187e6..499eaa1a9e8691db113f5b112e3d995b1863375d 100644 |
| --- a/media/audio/audio_output_device.h |
| +++ b/media/audio/audio_output_device.h |
| @@ -99,11 +99,12 @@ class MEDIA_EXPORT AudioOutputDevice |
| // Creates an uninitialized AudioOutputDevice. Clients must call Initialize() |
| // before using. |
| - // TODO(tommi): When all dependencies on |content| have been removed |
| - // from AudioOutputDevice, move this class over to media/audio. |
| AudioOutputDevice(AudioOutputIPC* ipc, |
| const scoped_refptr<base::MessageLoopProxy>& io_loop); |
| + // Returns the stream id used with the AudioOutputIPC interface. |
| + int stream_id() const; |
| + |
| protected: |
| // Magic required by ref_counted.h to avoid any code deleting the object |
| // accidentally while there are references to it. |
| @@ -111,10 +112,19 @@ class MEDIA_EXPORT AudioOutputDevice |
| virtual ~AudioOutputDevice(); |
| private: |
| + enum State { |
| + kIpcClosed, // No more IPCs can take place. |
|
scherkus (not reviewing)
2012/11/27 22:55:26
chromium has decreed SHOUTING_STYLE for enum const
miu
2012/11/28 07:26:20
Done.
|
| + kIdle, // Not started. |
| + kCreatingStream, // Waiting for OnStreamCreated() to be called back. |
| + kPaused, // Paused. OnStreamCreated() has been called. Can Play()/Stop(). |
| + kPlaying, // Playing back. Can Pause()/Stop(). |
| + }; |
| + |
| // Methods called on IO thread ---------------------------------------------- |
| // The following methods are tasks posted on the IO thread that needs to |
| // be executed on that thread. They interact with AudioMessageFilter and |
| // sends IPC messages on that thread. |
| + void RegisterDelegateOnIOThread(AudioOutputIPC* ipc); |
| void CreateStreamOnIOThread(const AudioParameters& params, |
| int input_channels); |
| void PlayOnIOThread(); |
| @@ -136,21 +146,19 @@ class MEDIA_EXPORT AudioOutputDevice |
| // A pointer to the IPC layer that takes care of sending requests over to |
| // the AudioRendererHost. |
| - AudioOutputIPC* ipc_; |
| + base::WeakPtr<AudioOutputIPC> ipc_; |
| // Our stream ID on the message filter. Only accessed on the IO thread. |
| // Must only be modified on the IO thread. |
| int stream_id_; |
| + // Current state (must only be accessed from the IO thread). See comments for |
| + // State enum above. |
| + State state_; |
| + |
| // State of Play() / Pause() calls before OnStreamCreated() is called. |
| bool play_on_start_; |
| - // Set to |true| when OnStreamCreated() is called. |
| - // Set to |false| when ShutDownOnIOThread() is called. |
| - // This is for use with play_on_start_ to track Play() / Pause() state. |
| - // Must only be touched from the IO thread. |
| - bool is_started_; |
| - |
| // Our audio thread callback class. See source file for details. |
| class AudioThreadCallback; |