summaryrefslogtreecommitdiffstats
path: root/webkit/glue/media/buffered_data_source.h
diff options
context:
space:
mode:
authorvrk@google.com <vrk@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-04-05 16:28:20 +0000
committervrk@google.com <vrk@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-04-05 16:28:20 +0000
commit23a8b1d8f4c8c3b3c37811f310891256f45c8063 (patch)
tree3576777d4ec689cbba94c172f92ee5ed1e3077f9 /webkit/glue/media/buffered_data_source.h
parent702b280dbaa67b88d0b07da22dc73f2f3116afee (diff)
downloadchromium_src-23a8b1d8f4c8c3b3c37811f310891256f45c8063.zip
chromium_src-23a8b1d8f4c8c3b3c37811f310891256f45c8063.tar.gz
chromium_src-23a8b1d8f4c8c3b3c37811f310891256f45c8063.tar.bz2
Implementing preload=metadata for video
This patch implements the logic necessary to respect the preload attribute when it is set to MetaData. This also refactors the BufferedResourceLoader to determine its buffering techniques based on a DeferStrategy value. BUG=16482,76555 TEST=media/video-preload.html, test_shell_tests Review URL: http://codereview.chromium.org/6625059 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@80465 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/glue/media/buffered_data_source.h')
-rw-r--r--webkit/glue/media/buffered_data_source.h17
1 files changed, 17 insertions, 0 deletions
diff --git a/webkit/glue/media/buffered_data_source.h b/webkit/glue/media/buffered_data_source.h
index 2c9e904..933ffb9 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