| Index: media/blink/multibuffer_data_source.cc
|
| diff --git a/media/blink/multibuffer_data_source.cc b/media/blink/multibuffer_data_source.cc
|
| index d86637d474349ac2da9195c431d14b6e81b35f63..2045629d420faf4c443f7d0a74b3bc135665638d 100644
|
| --- a/media/blink/multibuffer_data_source.cc
|
| +++ b/media/blink/multibuffer_data_source.cc
|
| @@ -398,6 +398,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,
|
|
|