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

Unified Diff: media/audio/audio_output_dispatcher.h

Issue 6822019: Fix erratic HTML5 audio playback (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix nit Created 9 years, 8 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_dispatcher.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/audio/audio_output_dispatcher.h
diff --git a/media/audio/audio_output_dispatcher.h b/media/audio/audio_output_dispatcher.h
index 2289e8909de45a80f6a30017fc2bd4620ddb14bc..18e1b2869c6f73a17e61ad4e37066676b9c55304 100644
--- a/media/audio/audio_output_dispatcher.h
+++ b/media/audio/audio_output_dispatcher.h
@@ -22,6 +22,7 @@
#define MEDIA_AUDIO_AUDIO_OUTPUT_DISPATCHER_H_
#include <vector>
+#include <list>
#include "base/basictypes.h"
#include "base/memory/ref_counted.h"
@@ -43,19 +44,20 @@ class AudioOutputDispatcher
~AudioOutputDispatcher();
// Called by AudioOutputProxy when the stream is closed. Opens a new
- // physical stream if there are no pending streams in |streams_|.
+ // physical stream if there are no pending streams in |idle_streams_|.
// Returns false, if it fails to open it.
bool StreamOpened();
// Called by AudioOutputProxy when the stream is started. If there
- // are pending streams in |streams_| then it returns one of them,
+ // are pending streams in |idle_streams_| then it returns one of them,
// otherwise creates a new one. Returns a physical stream that must
// be used, or NULL if it fails to open audio device. Ownership of
// the result is passed to the caller.
AudioOutputStream* StreamStarted();
- // Called by AudioOutputProxy when the stream is stopped. Returns
- // |stream| to the pool of pending streams (i.e. |streams_|).
+ // Called by AudioOutputProxy when the stream is stopped. Holds the
+ // stream temporarily in |pausing_streams_| and then |stream| is
+ // added to the pool of pending streams (i.e. |idle_streams_|).
// Ownership of the |stream| is passed to the dispatcher.
void StreamStopped(AudioOutputStream* stream);
@@ -68,14 +70,18 @@ class AudioOutputDispatcher
friend class AudioOutputProxyTest;
// Creates a new physical output stream, opens it and pushes to
- // |streams_|. Returns false if the stream couldn't be created or
+ // |idle_streams_|. Returns false if the stream couldn't be created or
// opened.
bool CreateAndOpenStream();
// A task scheduled by StreamStarted(). Opens a new stream and puts
- // it in |streams_|.
+ // it in |idle_streams_|.
void OpenTask();
+ // Before a stream is reused, it should sit idle for a bit. This task is
+ // called once that time has elapsed.
+ void StopStreamTask();
+
// Called by |close_timer_|. Closes all pending stream.
void ClosePendingStreams();
@@ -83,8 +89,10 @@ class AudioOutputDispatcher
MessageLoop* message_loop_;
AudioParameters params_;
+ int64 pause_delay_milliseconds_;
size_t paused_proxies_;
- std::vector<AudioOutputStream*> streams_;
+ std::vector<AudioOutputStream*> idle_streams_;
+ std::list<AudioOutputStream*> pausing_streams_;
base::DelayTimer<AudioOutputDispatcher> close_timer_;
DISALLOW_COPY_AND_ASSIGN(AudioOutputDispatcher);
« no previous file with comments | « no previous file | media/audio/audio_output_dispatcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698