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

Unified Diff: media/base/pipeline_impl.h

Issue 8399023: Fire canplaythrough event at the proper time for audio/video (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Move canplaythrough logic into pipeline; fix other stuff 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
Index: media/base/pipeline_impl.h
diff --git a/media/base/pipeline_impl.h b/media/base/pipeline_impl.h
index ef52ac240110f9d909d7141bebb33d8fdc670795..d2ebc07acc875e33b8444af97fc53b8d0436fe0e 100644
--- a/media/base/pipeline_impl.h
+++ b/media/base/pipeline_impl.h
@@ -261,7 +261,7 @@ class MEDIA_EXPORT PipelineImpl : public Pipeline, public FilterHost {
void NotifyEndedTask();
// Carries out handling a notification of network event.
- void NotifyNetworkEventTask(bool is_downloading_data);
+ void NotifyNetworkEventTask(NetworkEvent type);
// Carries out disabling the audio renderer.
void DisableAudioRendererTask();
@@ -316,6 +316,10 @@ class MEDIA_EXPORT PipelineImpl : public Pipeline, public FilterHost {
// caller.
base::TimeDelta GetCurrentTime_Locked() const;
+ // Compute the buffered time. Assumes that the lock has been acquired by the
+ // caller.
+ base::TimeDelta GetBufferedTime_Locked();
+
// Initiates a Stop() on |demuxer_| & |pipeline_filter_|. |callback|
// is called once both objects have been stopped.
void DoStop(const base::Closure& callback);
@@ -332,6 +336,20 @@ class MEDIA_EXPORT PipelineImpl : public Pipeline, public FilterHost {
void OnDemuxerSeekDone(base::TimeDelta seek_timestamp,
PipelineStatus status);
+ // If the media can be played through to the end without pausing for
+ // buffering, sends a notification saying such.
+ void NotifyCanPlayThroughIfNeeded();
+
+ // Returns an approximation of the download speed of the resource loader in
acolwell GONE FROM CHROMIUM 2011/10/28 18:24:13 Remove "of the resource loader" since that is an i
vrk (LEFT CHROMIUM) 2011/11/01 21:57:34 Done.
+ // bytes per second. Returns -1 if an approximation cannot be determined.
+ // Assumes that the lock has been acquired by the caller.
+ int ApproximateDownloadRate_Locked();
acolwell GONE FROM CHROMIUM 2011/10/28 18:24:13 Might want to change this to ApproximateDownloadBy
vrk (LEFT CHROMIUM) 2011/11/01 21:57:34 That's a good idea. Done.
+
+ // Returns true when the pipeline believes the media can be played through to
+ // the end without pausing for buffering; returns false otherwise.
+ // Assumes that the lock has been acquired by the caller.
+ bool ShouldNotifyCanPlayThrough_Locked();
+
// Message loop used to execute pipeline tasks.
MessageLoop* message_loop_;
@@ -474,6 +492,26 @@ class MEDIA_EXPORT PipelineImpl : public Pipeline, public FilterHost {
// Statistics.
PipelineStatistics statistics_;
+ // Number of bytes downloaded since download began. Is reset every time
+ // download continues from a previous defer. Used to approximate download
+ // speed.
+ unsigned long long starting_bytes_loaded_;
acolwell GONE FROM CHROMIUM 2011/10/28 18:24:13 how about making this int64
vrk (LEFT CHROMIUM) 2011/11/01 21:57:34 Done.
+
+ // Time at which download began. Is reset every time download continues
+ // from a previous defer. Used to approximate download speed.
+ base::Time starting_time_;
+
+ // Indicates whether the pipeline has sent a notification to its client that
+ // the media can play through to the end.
+ bool has_notified_can_play_through_;
+
+ // True if the pipeline is actively downloading bytes, false otherwise.
+ bool is_downloading_data_;
+
+ // An approximation of the download speed in bytes per second. -1 means the
+ // download speed is unknown.
+ int last_approximate_download_rate_;
+
FRIEND_TEST_ALL_PREFIXES(PipelineImplTest, GetBufferedTime);
DISALLOW_COPY_AND_ASSIGN(PipelineImpl);

Powered by Google App Engine
This is Rietveld 408576698