| Index: webkit/glue/media/buffered_data_source.h
|
| diff --git a/webkit/glue/media/buffered_data_source.h b/webkit/glue/media/buffered_data_source.h
|
| index 4440f2f6638bc9db6c3fe7ceec507dd2ba976409..4aff24b5c6ac0dea463a73089c57a6aedc091a4d 100644
|
| --- a/webkit/glue/media/buffered_data_source.h
|
| +++ b/webkit/glue/media/buffered_data_source.h
|
| @@ -25,7 +25,6 @@
|
| #include "webkit/glue/media/media_resource_loader_bridge_factory.h"
|
|
|
| namespace webkit_glue {
|
| -
|
| /////////////////////////////////////////////////////////////////////////////
|
| // BufferedResourceLoader
|
| // This class works inside demuxer thread and render thread. It contains a
|
| @@ -90,6 +89,9 @@ class BufferedResourceLoader :
|
| // is not available.
|
| virtual int64 GetBufferedLastBytePosition();
|
|
|
| + // Sets whether deferring data is allowed or disallowed.
|
| + virtual void SetAllowDefer(bool is_allowed);
|
| +
|
| // Gets the content length in bytes of the instance after this loader has been
|
| // started. If this value is -1, then content length is unknown.
|
| virtual int64 content_length() { return content_length_; }
|
| @@ -131,6 +133,7 @@ class BufferedResourceLoader :
|
| virtual ~BufferedResourceLoader();
|
|
|
| private:
|
| + friend class BufferedResourceLoaderTest;
|
|
|
| // Defer the resource loading if the buffer is full.
|
| void EnableDeferIfNeeded();
|
| @@ -170,6 +173,9 @@ class BufferedResourceLoader :
|
| // True if resource loading was deferred.
|
| bool deferred_;
|
|
|
| + // True if resource loader is allowed to defer, false otherwise.
|
| + bool defer_allowed_;
|
| +
|
| // True if resource loading has completed.
|
| bool completed_;
|
|
|
| @@ -231,6 +237,7 @@ class BufferedDataSource : public media::DataSource {
|
| virtual void Initialize(const std::string& url,
|
| media::FilterCallback* callback);
|
| virtual void Stop(media::FilterCallback* callback);
|
| + virtual void SetPlaybackRate(float playback_rate);
|
|
|
| // media::DataSource implementation.
|
| // Called from demuxer thread.
|
| @@ -288,6 +295,11 @@ class BufferedDataSource : public media::DataSource {
|
| // creates a new one to accommodate the read request.
|
| void WatchDogTask();
|
|
|
| + // This task uses the current playback rate with the previous playback rate
|
| + // to determine whether we are going from pause to play and play to pause,
|
| + // and signals the buffered resource loader accordingly.
|
| + void SetPlaybackRateTask(float playback_rate);
|
| +
|
| // The method that performs actual read. This method can only be executed on
|
| // the render thread.
|
| void ReadInternal();
|
| @@ -387,6 +399,10 @@ class BufferedDataSource : public media::DataSource {
|
| // on the render thread.
|
| bool stopped_on_render_loop_;
|
|
|
| + // This variable is true when we are in a paused state and false when we
|
| + // are in a playing state.
|
| + bool media_is_paused_;
|
| +
|
| // This timer is to run the WatchDogTask repeatedly. We use a timer instead
|
| // of doing PostDelayedTask() reduce the extra reference held by the message
|
| // loop. The RepeatingTimer does PostDelayedTask() internally, by using it
|
|
|