| Index: media/audio/audio_output_controller.h
|
| ===================================================================
|
| --- media/audio/audio_output_controller.h (revision 104976)
|
| +++ 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.
|
| + 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;
|
| +
|
| 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 PollAndStartIfDataReady();
|
| 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);
|
| };
|
|
|
|
|