summaryrefslogtreecommitdiff
path: root/chromium/media/blink/multibuffer_data_source.cc
diff options
context:
space:
mode:
Diffstat (limited to 'chromium/media/blink/multibuffer_data_source.cc')
-rw-r--r--chromium/media/blink/multibuffer_data_source.cc18
1 files changed, 13 insertions, 5 deletions
diff --git a/chromium/media/blink/multibuffer_data_source.cc b/chromium/media/blink/multibuffer_data_source.cc
index d86637d4743..a60c7614078 100644
--- a/chromium/media/blink/multibuffer_data_source.cc
+++ b/chromium/media/blink/multibuffer_data_source.cc
@@ -190,12 +190,10 @@ void MultibufferDataSource::OnRedirect(
FROM_HERE,
base::Bind(&MultibufferDataSource::StartCallback, weak_ptr_));
} else {
- {
- base::AutoLock auto_lock(lock_);
- StopInternal_Locked();
- }
- StopLoader();
+ base::AutoLock auto_lock(lock_);
+ StopInternal_Locked();
}
+ StopLoader();
return;
}
if (url_data_->url().GetOrigin() != destination->url().GetOrigin()) {
@@ -398,6 +396,16 @@ void MultibufferDataSource::ReadTask() {
bytes_read =
static_cast<int>(std::min<int64_t>(available, read_op_->size()));
bytes_read = reader_->TryRead(read_op_->data(), bytes_read);
+
+ if (bytes_read == 0 && total_bytes_ == kPositionNotSpecified) {
+ // We've reached the end of the file and we didn't know the total size
+ // before. Update the total size so Read()s past the end of the file will
+ // fail like they would if we had known the file size at the beginning.
+ total_bytes_ = reader_->Tell();
+ if (total_bytes_ != kPositionNotSpecified)
+ host_->SetTotalBytes(total_bytes_);
+ }
+
ReadOperation::Run(std::move(read_op_), bytes_read);
} else {
reader_->Wait(1, base::Bind(&MultibufferDataSource::ReadTask,