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

Unified Diff: media/blink/buffered_data_source.h

Issue 1399603003: Tie multibuffers to URLs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@media_cache
Patch Set: compile fixes Created 5 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/blink/buffered_data_source.h
diff --git a/media/blink/buffered_data_source.h b/media/blink/buffered_data_source.h
index fd85b7cc524e3e79395313e3e59ed33015bcf250..d0a79f775c94081d19eea3ed22062b8c65003c7f 100644
--- a/media/blink/buffered_data_source.h
+++ b/media/blink/buffered_data_source.h
@@ -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,55 @@ 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_EXPORT BufferedDataSource : public BufferedDataSourceInterface {
+ public:
typedef base::Callback<void(bool)> DownloadingCB;
// |url| and |cors_mode| are passed to the object. Buffered byte range changes
@@ -77,41 +123,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.

Powered by Google App Engine
This is Rietveld 408576698