| Index: media/blink/multibuffer_data_source.cc
|
| diff --git a/media/blink/multibuffer_data_source.cc b/media/blink/multibuffer_data_source.cc
|
| index ce450c96bce12b6c93e885e4fb8a49b5d938396e..f054dac827f89d67b5a8eef41c53e9be7493b1d6 100644
|
| --- a/media/blink/multibuffer_data_source.cc
|
| +++ b/media/blink/multibuffer_data_source.cc
|
| @@ -177,6 +177,14 @@ void MultibufferDataSource::Initialize(const InitializeCB& init_cb) {
|
| render_task_runner_->PostTask(
|
| FROM_HERE,
|
| base::Bind(&MultibufferDataSource::StartCallback, weak_ptr_));
|
| +
|
| + // When the entire file is already in the cache, we won't get any more
|
| + // progress callbacks, which breaks some expectations. Post a task to
|
| + // make sure that the client gets at least one call each for the progress
|
| + // and loading callbacks.
|
| + render_task_runner_->PostTask(
|
| + FROM_HERE, base::Bind(&MultibufferDataSource::UpdateProgress,
|
| + weak_factory_.GetWeakPtr()));
|
| } else {
|
| reader_->Wait(1,
|
| base::Bind(&MultibufferDataSource::StartCallback, weak_ptr_));
|
| @@ -505,14 +513,6 @@ void MultibufferDataSource::StartCallback() {
|
| render_task_runner_->PostTask(
|
| FROM_HERE, base::Bind(base::ResetAndReturn(&init_cb_), success));
|
|
|
| - // When we tell our clients that we're loading below, it's possible that
|
| - // the entire file is already cashed. If that's true, then we won't get
|
| - // any progress callbacks later, so we'll never tell the client that we
|
| - // stopped loading. Post a task to make sure that we check the loading
|
| - // state at least once.
|
| - render_task_runner_->PostTask(
|
| - FROM_HERE, base::Bind(&MultibufferDataSource::UpdateLoadingState,
|
| - weak_factory_.GetWeakPtr()));
|
| // Even if data is cached, say that we're loading at this point for
|
| // compatibility.
|
| UpdateLoadingState_Locked(true);
|
| @@ -560,10 +560,13 @@ void MultibufferDataSource::UpdateLoadingState_Locked(bool force_loading) {
|
| }
|
| }
|
|
|
| -void MultibufferDataSource::UpdateLoadingState() {
|
| +void MultibufferDataSource::UpdateProgress() {
|
| DCHECK(render_task_runner_->BelongsToCurrentThread());
|
| - base::AutoLock auto_lock(lock_);
|
| - UpdateLoadingState_Locked(false);
|
| + if (reader_) {
|
| + uint64_t available = reader_->Available();
|
| + uint64_t pos = reader_->Tell();
|
| + ProgressCallback(pos, pos + available);
|
| + }
|
| }
|
|
|
| void MultibufferDataSource::UpdateBufferSizes() {
|
|
|