Chromium Code Reviews| Index: media/audio/audio_output_controller.h |
| =================================================================== |
| --- media/audio/audio_output_controller.h (revision 104827) |
| +++ media/audio/audio_output_controller.h (working copy) |
| @@ -103,6 +103,13 @@ |
| // Close this synchronous reader. |
| virtual void Close() = 0; |
| + |
| + // Poll if data is ready. |
| + // Not reliable, as there is no guarantee that renderer is "new-style" |
| + // renderer that writes metadata into buffer. After several unsuccessful |
| + // attempts caller should assume the data is ready even if that function |
| + // returns false. |
|
acolwell GONE FROM CHROMIUM
2011/10/12 20:14:03
Why don't all renderers write into the buffer? Sho
enal1
2011/10/13 00:39:22
That is long and sad story. 3 months ago I tried t
acolwell GONE FROM CHROMIUM
2011/10/13 00:52:47
Ok. Sorry to hear this.
On 2011/10/13 00:39:22, en
|
| + virtual bool DataReady() = 0; |
| }; |
| virtual ~AudioOutputController(); |
| @@ -163,12 +170,17 @@ |
| virtual void OnError(AudioOutputStream* stream, int code); |
| private: |
| + // We are polling sync reader if data became available. |
| + static const int kPollNumAttempts; |
| + static const int kPollPauseInMilliseconds; |
|
acolwell GONE FROM CHROMIUM
2011/10/12 20:14:03
Why not just make these file static in the .cc?
enal1
2011/10/13 00:39:22
Because previous time I tried that I was told to m
acolwell GONE FROM CHROMIUM
2011/10/13 00:52:47
OK.
|
| + |
| AudioOutputController(EventHandler* handler, |
| uint32 capacity, SyncReader* sync_reader); |
| // The following methods are executed on the audio controller thread. |
| void DoCreate(const AudioParameters& params); |
| void DoPlay(); |
| + void DoPollIfDataReady(); |
| void DoPause(); |
| void DoFlush(); |
| void DoClose(const base::Closure& closed_task); |
| @@ -178,6 +190,9 @@ |
| // Helper method to submit a OnMoreData() call to the event handler. |
| void SubmitOnMoreData_Locked(); |
| + // Helper method that starts physical stream. |
| + void StartStream(); |
| + |
| // |handler_| may be called only if |state_| is not kClosed. |
| EventHandler* handler_; |
| AudioOutputStream* stream_; |
| @@ -205,6 +220,10 @@ |
| // The message loop of audio thread that this object runs on. |
| MessageLoop* message_loop_; |
| + // When starting stream we wait for data to become available. |
| + // Number of times left. |
| + int number_polling_attempts_left_; |
| + |
| DISALLOW_COPY_AND_ASSIGN(AudioOutputController); |
| }; |