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

Unified Diff: webkit/glue/media/buffered_data_source.h

Issue 6625059: Implementing preload=metadata for video (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed tests and added unit tests Created 9 years, 9 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: 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 2c9e9046fb14ac2d47100ada8f87d4d79a15f743..933ffb9139fdbd775e11c58a43e18e068947019e 100644
--- a/webkit/glue/media/buffered_data_source.h
+++ b/webkit/glue/media/buffered_data_source.h
@@ -11,6 +11,7 @@
#include "base/memory/scoped_ptr.h"
#include "base/synchronization/lock.h"
#include "media/base/filter_factories.h"
+#include "media/base/filters.h"
#include "webkit/glue/media/buffered_resource_loader.h"
namespace webkit_glue {
@@ -40,6 +41,7 @@ class BufferedDataSource : public WebDataSource {
media::DataSource::ReadCallback* read_callback);
virtual bool GetSize(int64* size_out);
virtual bool IsStreaming();
+ virtual void SetPreload(media::Preload preload);
const media::MediaFormat& media_format() {
return media_format_;
@@ -90,6 +92,13 @@ class BufferedDataSource : public WebDataSource {
// and signals the buffered resource loader accordingly.
void SetPlaybackRateTask(float playback_rate);
+ // This task saves the preload value for the media.
+ void SetPreloadTask(media::Preload preload);
+
+ // Decides which DeferStrategy to used based on the current state of the
+ // BufferedDataSource.
+ BufferedResourceLoader::DeferStrategy ChooseDeferStrategy();
+
// The method that performs actual read. This method can only be executed on
// the render thread.
void ReadInternal();
@@ -196,6 +205,14 @@ class BufferedDataSource : public WebDataSource {
// are in a playing state.
bool media_is_paused_;
+ // This variable is true when the user has requested the video to play at
+ // least once.
+ bool media_has_played_;
+
+ // This variable holds the value of the preload attribute for the video
+ // element.
+ media::Preload preload_;
+
// 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

Powered by Google App Engine
This is Rietveld 408576698