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

Unified Diff: webkit/media/buffered_data_source.cc

Issue 8661002: Fire CanPlayThrough immediately for local and streaming media files (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix media/event-attributes.html Created 9 years, 1 month 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/media/buffered_data_source.cc
diff --git a/webkit/media/buffered_data_source.cc b/webkit/media/buffered_data_source.cc
index 2d7b8c9cfde9a7ce3d475a6a8b0500a6a32ea88b..92680fa2dc0b62a76dfad09d022948052f14da96 100644
--- a/webkit/media/buffered_data_source.cc
+++ b/webkit/media/buffered_data_source.cc
@@ -45,7 +45,7 @@ BufferedDataSource::BufferedDataSource(
media::MediaLog* media_log)
: total_bytes_(kPositionNotSpecified),
buffered_bytes_(0),
- loaded_(false),
+ local_source_(false),
streaming_(false),
frame_(frame),
loader_(NULL),
@@ -105,6 +105,7 @@ void BufferedDataSource::Initialize(const std::string& url,
callback.Run(media::DATASOURCE_ERROR_URL_NOT_SUPPORTED);
return;
}
+ local_source_ = !url_.SchemeIs(kHttpScheme) && !url_.SchemeIs(kHttpsScheme);
DCHECK(!callback.is_null());
{
@@ -156,6 +157,10 @@ void BufferedDataSource::SetBitrate(int bitrate) {
&BufferedDataSource::SetBitrateTask, this, bitrate));
}
+bool BufferedDataSource::IsLocalSource() {
+ return local_source_;
+}
+
/////////////////////////////////////////////////////////////////////////////
// media::DataSource implementation.
void BufferedDataSource::Read(
@@ -431,7 +436,6 @@ void BufferedDataSource::HttpInitialStartCallback(int error) {
// TODO(hclam): Needs more thinking about supporting servers without range
// request or their partial response is not complete.
total_bytes_ = instance_size;
- loaded_ = false;
streaming_ = (instance_size == kPositionNotSpecified) ||
!loader_->range_supported();
} else {
@@ -501,7 +505,6 @@ void BufferedDataSource::NonHttpInitialStartCallback(int error) {
if (success) {
total_bytes_ = instance_size;
buffered_bytes_ = total_bytes_;
- loaded_ = true;
} else {
loader_->Stop();
}
@@ -616,7 +619,7 @@ void BufferedDataSource::NetworkEventCallback() {
// In case of non-HTTP request we don't need to report network events,
// so return immediately.
- if (loaded_)
+ if (local_source_)
return;
bool is_downloading_data = loader_->is_downloading_data();
@@ -657,8 +660,6 @@ void BufferedDataSource::UpdateHostState_Locked() {
if (!filter_host)
return;
- filter_host->SetLoaded(loaded_);
-
if (streaming_)
filter_host->SetStreaming(true);

Powered by Google App Engine
This is Rietveld 408576698