diff options
author | ajwong@chromium.org <ajwong@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-08-21 22:45:40 +0000 |
---|---|---|
committer | ajwong@chromium.org <ajwong@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-08-21 22:45:40 +0000 |
commit | 0acebfa1194d1b1b7155137ef6ccdf48b3b58258 (patch) | |
tree | c4a2fae47763fe06a1f46138715e1fb8e9840245 /media | |
parent | 083a8ceb8ab236e0710c40357409b5dda18f580b (diff) | |
download | chromium_src-0acebfa1194d1b1b7155137ef6ccdf48b3b58258.zip chromium_src-0acebfa1194d1b1b7155137ef6ccdf48b3b58258.tar.gz chromium_src-0acebfa1194d1b1b7155137ef6ccdf48b3b58258.tar.bz2 |
Correct network state and ready state reporting.
For network state, make it return "loading" for everything that's not a file source since our cache does not yet reliably support caching the full media w/o need for a network.
For ready state, correctly handle seeks to drop from HaveEnoughData down to HaveMetaData until the seek completes. Also implement the seeking() function.
BUG=18975
TEST=none
Review URL: http://codereview.chromium.org/165432
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@24036 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'media')
-rw-r--r-- | media/base/filter_host.h | 3 | ||||
-rw-r--r-- | media/base/mock_filter_host.h | 1 | ||||
-rw-r--r-- | media/base/pipeline.h | 4 | ||||
-rw-r--r-- | media/base/pipeline_impl.cc | 12 | ||||
-rw-r--r-- | media/base/pipeline_impl.h | 6 |
5 files changed, 26 insertions, 0 deletions
diff --git a/media/base/filter_host.h b/media/base/filter_host.h index 02ae399..2b288d2 100644 --- a/media/base/filter_host.h +++ b/media/base/filter_host.h @@ -61,6 +61,9 @@ class FilterHost { // endpoints such as renderers. virtual void NotifyEnded() = 0; + // Sets the flag to indicate that our media is now loaded. + virtual void SetLoaded(bool loaded) = 0; + // Broadcast a message of type |message| to all other filters from |source|. virtual void BroadcastMessage(FilterMessage message) = 0; diff --git a/media/base/mock_filter_host.h b/media/base/mock_filter_host.h index 439eda8..dfcf403 100644 --- a/media/base/mock_filter_host.h +++ b/media/base/mock_filter_host.h @@ -37,6 +37,7 @@ class MockFilterHost : public FilterHost { MOCK_METHOD1(SetBufferedBytes, void(int64 buffered_bytes)); MOCK_METHOD2(SetVideoSize, void(size_t width, size_t height)); MOCK_METHOD1(SetStreaming, void(bool streamed)); + MOCK_METHOD1(SetLoaded, void(bool loaded)); MOCK_METHOD0(NotifyEnded, void()); MOCK_METHOD1(BroadcastMessage, void(FilterMessage message)); diff --git a/media/base/pipeline.h b/media/base/pipeline.h index b54d442..dd571c9 100644 --- a/media/base/pipeline.h +++ b/media/base/pipeline.h @@ -151,6 +151,10 @@ class Pipeline : public base::RefCountedThreadSafe<Pipeline> { // data source. Seeking may not be possible. virtual bool IsStreaming() const = 0; + // If this method returns true, that means the data source has fully loaded + // the media and that the network is no longer needed. + virtual bool IsLoaded() const = 0; + // Gets the current error status for the pipeline. If the pipeline is // operating correctly, this will return OK. virtual PipelineError GetError() const = 0; diff --git a/media/base/pipeline_impl.cc b/media/base/pipeline_impl.cc index 270347c..49ebe4a 100644 --- a/media/base/pipeline_impl.cc +++ b/media/base/pipeline_impl.cc @@ -262,6 +262,11 @@ bool PipelineImpl::IsStreaming() const { return streaming_; } +bool PipelineImpl::IsLoaded() const { + AutoLock auto_lock(lock_); + return loaded_; +} + PipelineError PipelineImpl::GetError() const { AutoLock auto_lock(lock_); return error_; @@ -287,6 +292,7 @@ void PipelineImpl::ResetState() { buffered_time_ = kZero; buffered_bytes_ = 0; streaming_ = false; + loaded_ = false; total_bytes_ = 0; video_width_ = 0; video_height_ = 0; @@ -405,6 +411,12 @@ void PipelineImpl::NotifyEnded() { NewRunnableMethod(this, &PipelineImpl::NotifyEndedTask)); } +void PipelineImpl::SetLoaded(bool loaded) { + DCHECK(IsRunning()); + AutoLock auto_lock(lock_); + loaded_ = loaded; +} + void PipelineImpl::BroadcastMessage(FilterMessage message) { DCHECK(IsRunning()); diff --git a/media/base/pipeline_impl.h b/media/base/pipeline_impl.h index c448106..891404a 100644 --- a/media/base/pipeline_impl.h +++ b/media/base/pipeline_impl.h @@ -84,6 +84,7 @@ class PipelineImpl : public Pipeline, public FilterHost { virtual int64 GetTotalBytes() const; virtual void GetVideoSize(size_t* width_out, size_t* height_out) const; virtual bool IsStreaming() const; + virtual bool IsLoaded() const; virtual PipelineError GetError() const; // Sets a permanent callback owned by the pipeline that will be executed when @@ -143,6 +144,7 @@ class PipelineImpl : public Pipeline, public FilterHost { virtual void SetBufferedBytes(int64 buffered_bytes); virtual void SetVideoSize(size_t width, size_t height); virtual void SetStreaming(bool streamed); + virtual void SetLoaded(bool loaded); virtual void NotifyEnded(); virtual void BroadcastMessage(FilterMessage message); @@ -293,6 +295,10 @@ class PipelineImpl : public Pipeline, public FilterHost { // source. bool streaming_; + // Sets by the filters to indicate whether the data source is a fully + // loaded source. + bool loaded_; + // Current volume level (from 0.0f to 1.0f). This value is set immediately // via SetVolume() and a task is dispatched on the message loop to notify the // filters. |