| Index: media/blink/webmediaplayer_impl.cc
|
| diff --git a/media/blink/webmediaplayer_impl.cc b/media/blink/webmediaplayer_impl.cc
|
| index 003d084d7aa973ba04948c9bddf7341192395248..c616635a17f3588e325a8383f6fde474afd779bb 100644
|
| --- a/media/blink/webmediaplayer_impl.cc
|
| +++ b/media/blink/webmediaplayer_impl.cc
|
| @@ -537,8 +537,17 @@ void WebMediaPlayerImpl::setBufferingStrategy(
|
| DVLOG(1) << __FUNCTION__;
|
| DCHECK(main_task_runner_->BelongsToCurrentThread());
|
|
|
| +#if defined(OS_ANDROID)
|
| + // We disallow aggressive buffering on Android since it matches the behavior
|
| + // of the platform media player and may have data usage penalties.
|
| + // TODO(dalecurtis, hubbe): We should probably stop using "pause-and-buffer"
|
| + // everywhere. See http://crbug.com/594669 for more details.
|
| + buffering_strategy_ = BufferedDataSource::BUFFERING_STRATEGY_NORMAL;
|
| +#else
|
| buffering_strategy_ =
|
| static_cast<BufferedDataSource::BufferingStrategy>(buffering_strategy);
|
| +#endif
|
| +
|
| if (data_source_)
|
| data_source_->SetBufferingStrategy(buffering_strategy_);
|
| }
|
| @@ -873,6 +882,13 @@ void WebMediaPlayerImpl::OnPipelineSuspended() {
|
| memory_usage_reporting_timer_.Stop();
|
| ReportMemoryUsage();
|
|
|
| + // If we're not in an aggressive buffering state, tell the data source we have
|
| + // enough data so that it may release the connection.
|
| + if (buffering_strategy_ !=
|
| + BufferedDataSource::BUFFERING_STRATEGY_AGGRESSIVE) {
|
| + data_source_->OnBufferingHaveEnough(true);
|
| + }
|
| +
|
| if (pending_suspend_resume_cycle_) {
|
| pending_suspend_resume_cycle_ = false;
|
| pipeline_controller_.Resume();
|
| @@ -972,7 +988,7 @@ void WebMediaPlayerImpl::OnPipelineBufferingStateChanged(
|
| // Let the DataSource know we have enough data. It may use this information to
|
| // release unused network connections.
|
| if (data_source_)
|
| - data_source_->OnBufferingHaveEnough();
|
| + data_source_->OnBufferingHaveEnough(false);
|
|
|
| // Blink expects a timeChanged() in response to a seek().
|
| if (should_notify_time_changed_)
|
| @@ -1030,6 +1046,9 @@ void WebMediaPlayerImpl::OnHidden() {
|
| if (!hasVideo() && !paused_ && !ended_)
|
| return;
|
|
|
| + // Always reset the buffering strategy to normal when suspending for hidden to
|
| + // prevent an idle network connection from lingering.
|
| + setBufferingStrategy(WebMediaPlayer::BufferingStrategy::Normal);
|
| pipeline_controller_.Suspend();
|
| if (delegate_)
|
| delegate_->PlayerGone(delegate_id_);
|
|
|