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

Unified Diff: media/audio/audio_output_controller.h

Issue 8229013: Fix problem when we did not play beginning of HTML5 audio stream in low latency mode. (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 | « content/browser/renderer_host/media/audio_sync_reader.cc ('k') | 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 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);
};
« no previous file with comments | « content/browser/renderer_host/media/audio_sync_reader.cc ('k') | media/audio/audio_output_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698