Index: media/blink/multibuffer_data_source.cc |
diff --git a/media/blink/multibuffer_data_source.cc b/media/blink/multibuffer_data_source.cc |
index 1390c69c36e78319d6f4063678258090b72bc099..ce450c96bce12b6c93e885e4fb8a49b5d938396e 100644 |
--- a/media/blink/multibuffer_data_source.cc |
+++ b/media/blink/multibuffer_data_source.cc |
@@ -505,6 +505,14 @@ 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); |
@@ -552,6 +560,12 @@ void MultibufferDataSource::UpdateLoadingState_Locked(bool force_loading) { |
} |
} |
+void MultibufferDataSource::UpdateLoadingState() { |
+ DCHECK(render_task_runner_->BelongsToCurrentThread()); |
+ base::AutoLock auto_lock(lock_); |
+ UpdateLoadingState_Locked(false); |
+} |
+ |
void MultibufferDataSource::UpdateBufferSizes() { |
DVLOG(1) << __func__; |
if (!reader_) |