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

Unified Diff: content/renderer/media/buffered_data_source.cc

Issue 302553006: Suppress pause and buffer for local resources (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 6 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
« no previous file with comments | « no previous file | content/renderer/media/buffered_data_source_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/media/buffered_data_source.cc
diff --git a/content/renderer/media/buffered_data_source.cc b/content/renderer/media/buffered_data_source.cc
index 19e9f00383155275250e23ab68c881d5f5c77ae5..f4a3094684a4272db7853e71b7fcf9a61f67d25e 100644
--- a/content/renderer/media/buffered_data_source.cc
+++ b/content/renderer/media/buffered_data_source.cc
@@ -511,10 +511,9 @@ void BufferedDataSource::ProgressCallback(int64 position) {
}
void BufferedDataSource::UpdateDeferStrategy(bool paused) {
- // 200 responses end up not being reused to satisfy future range requests,
- // and we don't want to get too far ahead of the read-head (and thus require
- // a restart), so keep to the thresholds.
- if (!loader_->range_supported()) {
+ // No need to aggressively buffer when we are assuming the resource is fully
+ // buffered.
+ if (assume_fully_buffered()) {
loader_->UpdateDeferStrategy(BufferedResourceLoader::kCapacityDefer);
return;
}
@@ -523,14 +522,15 @@ void BufferedDataSource::UpdateDeferStrategy(bool paused) {
// and we're paused, then try to load as much as possible (the loader will
// fall back to kCapacityDefer if it knows the current response won't be
// useful from the cache in the future).
- if (media_has_played_ && paused) {
+ if (media_has_played_ && paused && loader_->range_supported()) {
loader_->UpdateDeferStrategy(BufferedResourceLoader::kNeverDefer);
return;
}
- // If media is currently playing or the page indicated preload=auto,
- // use threshold strategy to enable/disable deferring when the buffer
- // is full/depleted.
+ // If media is currently playing or the page indicated preload=auto or the
+ // the server does not support the byte range request or we do not want to go
+ // too far ahead of the read head, use threshold strategy to enable/disable
+ // deferring when the buffer is full/depleted.
loader_->UpdateDeferStrategy(BufferedResourceLoader::kCapacityDefer);
}
« no previous file with comments | « no previous file | content/renderer/media/buffered_data_source_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698