Chromium Code Reviews| 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 d0461785f5e5b6e9b79eccee19f4e752da684b31..118167489f553331a25d276350c2331ae1968808 100644 |
| --- a/content/renderer/media/buffered_data_source.cc |
| +++ b/content/renderer/media/buffered_data_source.cc |
| @@ -201,12 +201,13 @@ void BufferedDataSource::MediaPlaybackRateChanged(float playback_rate) { |
| void BufferedDataSource::MediaIsPlaying() { |
| DCHECK(render_loop_->BelongsToCurrentThread()); |
| media_has_played_ = true; |
| - UpdateDeferStrategy(false); |
| + // is_local_resource does not matter while playing, so send false. |
| + UpdateDeferStrategy(false, false); |
| } |
| -void BufferedDataSource::MediaIsPaused() { |
| +void BufferedDataSource::MediaIsPaused(bool is_local_resource) { |
| DCHECK(render_loop_->BelongsToCurrentThread()); |
| - UpdateDeferStrategy(true); |
| + UpdateDeferStrategy(true, is_local_resource); |
| } |
| ///////////////////////////////////////////////////////////////////////////// |
| @@ -513,7 +514,8 @@ void BufferedDataSource::ProgressCallback(int64 position) { |
| host_->AddBufferedByteRange(loader_->first_byte_position(), position); |
| } |
| -void BufferedDataSource::UpdateDeferStrategy(bool paused) { |
| +void BufferedDataSource::UpdateDeferStrategy(bool paused, |
| + bool is_local_resource) { |
| // 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. |
| @@ -525,8 +527,13 @@ void BufferedDataSource::UpdateDeferStrategy(bool paused) { |
| // If the playback has started (at which point the preload value is ignored) |
| // 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). |
| + // useful from the cache in the future) for external resources. Loading data |
| + // in buffer is not necessary while the player is paused. |
|
AmoghBihani
2014/05/27 14:17:30
Oh I am sorry, I will change this statement to "Lo
|
| if (media_has_played_ && paused) { |
| + if (is_local_resource) { |
| + loader_->UpdateDeferStrategy(BufferedResourceLoader::kReadThenDefer); |
| + return; |
| + } |
| loader_->UpdateDeferStrategy(BufferedResourceLoader::kNeverDefer); |
| return; |
| } |