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

Side by Side 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 unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/renderer/media/buffered_data_source.h" 5 #include "content/renderer/media/buffered_data_source.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/callback_helpers.h" 8 #include "base/callback_helpers.h"
9 #include "base/message_loop/message_loop_proxy.h" 9 #include "base/message_loop/message_loop_proxy.h"
10 #include "content/public/common/url_constants.h" 10 #include "content/public/common/url_constants.h"
(...skipping 499 matching lines...) Expand 10 before | Expand all | Expand 10 after
510 if (stop_signal_received_) 510 if (stop_signal_received_)
511 return; 511 return;
512 512
513 host_->AddBufferedByteRange(loader_->first_byte_position(), position); 513 host_->AddBufferedByteRange(loader_->first_byte_position(), position);
514 } 514 }
515 515
516 void BufferedDataSource::UpdateDeferStrategy(bool paused) { 516 void BufferedDataSource::UpdateDeferStrategy(bool paused) {
517 // 200 responses end up not being reused to satisfy future range requests, 517 // 200 responses end up not being reused to satisfy future range requests,
518 // and we don't want to get too far ahead of the read-head (and thus require 518 // and we don't want to get too far ahead of the read-head (and thus require
519 // a restart), so keep to the thresholds. 519 // a restart), so keep to the thresholds.
520 if (!loader_->range_supported()) { 520 if (!loader_->range_supported() && !assume_fully_buffered_) {
amogh.bihani 2014/05/29 09:38:57 in buffered_resource_loader 'range_supported_' is
521 loader_->UpdateDeferStrategy(BufferedResourceLoader::kCapacityDefer); 521 loader_->UpdateDeferStrategy(BufferedResourceLoader::kCapacityDefer);
522 return; 522 return;
523 } 523 }
524 524
525 // If the playback has started (at which point the preload value is ignored) 525 // If the playback has started (at which point the preload value is ignored)
526 // and we're paused, then try to load as much as possible (the loader will 526 // and we're paused, then try to load as much as possible (the loader will
527 // fall back to kCapacityDefer if it knows the current response won't be 527 // fall back to kCapacityDefer if it knows the current response won't be
528 // useful from the cache in the future). 528 // useful from the cache in the future) for external resources. Loading data
529 // for local resources is not necessary while the player is paused.
529 if (media_has_played_ && paused) { 530 if (media_has_played_ && paused) {
531 if (assume_fully_buffered_) {
532 loader_->UpdateDeferStrategy(BufferedResourceLoader::kReadThenDefer);
scherkus (not reviewing) 2014/05/30 20:37:39 I feel like kCapacityDefer is right one to use for
amogh.bihani 2014/06/02 05:01:28 Done.
533 return;
534 }
530 loader_->UpdateDeferStrategy(BufferedResourceLoader::kNeverDefer); 535 loader_->UpdateDeferStrategy(BufferedResourceLoader::kNeverDefer);
531 return; 536 return;
532 } 537 }
533 538
534 // If media is currently playing or the page indicated preload=auto, 539 // If media is currently playing or the page indicated preload=auto,
535 // use threshold strategy to enable/disable deferring when the buffer 540 // use threshold strategy to enable/disable deferring when the buffer
536 // is full/depleted. 541 // is full/depleted.
537 loader_->UpdateDeferStrategy(BufferedResourceLoader::kCapacityDefer); 542 loader_->UpdateDeferStrategy(BufferedResourceLoader::kCapacityDefer);
538 } 543 }
539 544
540 } // namespace content 545 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698