Index: media/blink/buffered_data_source.h |
diff --git a/media/blink/buffered_data_source.h b/media/blink/buffered_data_source.h |
index fd85b7cc524e3e79395313e3e59ed33015bcf250..b5d779ee68595e0ef34fb9732e52fa7473cf3f1c 100644 |
--- a/media/blink/buffered_data_source.h |
+++ b/media/blink/buffered_data_source.h |
@@ -13,9 +13,9 @@ |
#include "base/memory/weak_ptr.h" |
#include "base/synchronization/lock.h" |
#include "media/base/data_source.h" |
-#include "media/base/media_export.h" |
#include "media/base/ranges.h" |
#include "media/blink/buffered_resource_loader.h" |
+#include "media/blink/media_blink_export.h" |
#include "url/gurl.h" |
namespace base { |
@@ -25,7 +25,7 @@ class SingleThreadTaskRunner; |
namespace media { |
class MediaLog; |
-class MEDIA_EXPORT BufferedDataSourceHost { |
+class MEDIA_BLINK_EXPORT BufferedDataSourceHost { |
public: |
// Notify the host of the total size of the media file. |
virtual void SetTotalBytes(int64 total_bytes) = 0; |
@@ -39,12 +39,9 @@ class MEDIA_EXPORT BufferedDataSourceHost { |
virtual ~BufferedDataSourceHost() {} |
}; |
-// A data source capable of loading URLs and buffering the data using an |
-// in-memory sliding window. |
-// |
-// BufferedDataSource must be created and destroyed on the thread associated |
-// with the |task_runner| passed in the constructor. |
-class MEDIA_EXPORT BufferedDataSource : public DataSource { |
+// This interface is temporary and will go away once MultibufferDataSource |
+// has been fully evaluated. |
+class BufferedDataSourceInterface : public DataSource { |
public: |
// Used to specify video preload states. They are "hints" to the browser about |
// how aggressively the browser should load and buffer data. |
@@ -58,6 +55,56 @@ class MEDIA_EXPORT BufferedDataSource : public DataSource { |
METADATA, |
AUTO, |
}; |
+ |
+ // Executes |init_cb| with the result of initialization when it has completed. |
+ // |
+ // Method called on the render thread. |
+ typedef base::Callback<void(bool)> InitializeCB; |
+ virtual void Initialize(const InitializeCB& init_cb) = 0; |
+ |
+ // Adjusts the buffering algorithm based on the given preload value. |
+ virtual void SetPreload(Preload preload) = 0; |
+ |
+ // Returns true if the media resource has a single origin, false otherwise. |
+ // Only valid to call after Initialize() has completed. |
+ // |
+ // Method called on the render thread. |
+ virtual bool HasSingleOrigin() = 0; |
+ |
+ // Returns true if the media resource passed a CORS access control check. |
+ virtual bool DidPassCORSAccessCheck() const = 0; |
+ |
+ // Cancels initialization, any pending loaders, and any pending read calls |
+ // from the demuxer. The caller is expected to release its reference to this |
+ // object and never call it again. |
+ // |
+ // Method called on the render thread. |
+ virtual void Abort() = 0; |
+ |
+ // Notifies changes in playback state for controlling media buffering |
+ // behavior. |
+ virtual void MediaPlaybackRateChanged(double playback_rate) = 0; |
+ virtual void MediaIsPlaying() = 0; |
+ virtual void MediaIsPaused() = 0; |
+ virtual bool media_has_played() const = 0; |
+ |
+ // Returns true if the resource is local. |
+ virtual bool assume_fully_buffered() = 0; |
+ |
+ // Cancels any open network connections once reaching the deferred state for |
+ // preload=metadata, non-streaming resources that have not started playback. |
+ // If already deferred, connections will be immediately closed. |
+ virtual void OnBufferingHaveEnough() = 0; |
+}; |
+ |
+// A data source capable of loading URLs and buffering the data using an |
+// in-memory sliding window. |
+// |
+// BufferedDataSource must be created and destroyed on the thread associated |
+// with the |task_runner| passed in the constructor. |
+class MEDIA_BLINK_EXPORT BufferedDataSource |
+ : NON_EXPORTED_BASE(public BufferedDataSourceInterface) { |
+ public: |
typedef base::Callback<void(bool)> DownloadingCB; |
// |url| and |cors_mode| are passed to the object. Buffered byte range changes |
@@ -77,41 +124,41 @@ class MEDIA_EXPORT BufferedDataSource : public DataSource { |
// |
// Method called on the render thread. |
typedef base::Callback<void(bool)> InitializeCB; |
- void Initialize(const InitializeCB& init_cb); |
+ void Initialize(const InitializeCB& init_cb) override; |
// Adjusts the buffering algorithm based on the given preload value. |
- void SetPreload(Preload preload); |
+ void SetPreload(Preload preload) override; |
// Returns true if the media resource has a single origin, false otherwise. |
// Only valid to call after Initialize() has completed. |
// |
// Method called on the render thread. |
- bool HasSingleOrigin(); |
+ bool HasSingleOrigin() override; |
// Returns true if the media resource passed a CORS access control check. |
- bool DidPassCORSAccessCheck() const; |
+ bool DidPassCORSAccessCheck() const override; |
// Cancels initialization, any pending loaders, and any pending read calls |
// from the demuxer. The caller is expected to release its reference to this |
// object and never call it again. |
// |
// Method called on the render thread. |
- void Abort(); |
+ void Abort() override; |
// Notifies changes in playback state for controlling media buffering |
// behavior. |
- void MediaPlaybackRateChanged(double playback_rate); |
- void MediaIsPlaying(); |
- void MediaIsPaused(); |
- bool media_has_played() const { return media_has_played_; } |
+ void MediaPlaybackRateChanged(double playback_rate) override; |
+ void MediaIsPlaying() override; |
+ void MediaIsPaused() override; |
+ bool media_has_played() const override; |
// Returns true if the resource is local. |
- bool assume_fully_buffered() { return !url_.SchemeIsHTTPOrHTTPS(); } |
+ bool assume_fully_buffered() override; |
// Cancels any open network connections once reaching the deferred state for |
// preload=metadata, non-streaming resources that have not started playback. |
// If already deferred, connections will be immediately closed. |
- void OnBufferingHaveEnough(); |
+ void OnBufferingHaveEnough() override; |
// DataSource implementation. |
// Called from demuxer thread. |