Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(433)

Side by Side Diff: media/blink/multibuffer_data_source.cc

Issue 1991033002: Make http/tests/media/audio-seekable-contains-zero-without-ranges.html work with multibuffers. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2704
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | media/blink/multibuffer_data_source_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "media/blink/multibuffer_data_source.h" 5 #include "media/blink/multibuffer_data_source.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/callback_helpers.h" 10 #include "base/callback_helpers.h"
(...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after
391 int64_t available = reader_->Available(); 391 int64_t available = reader_->Available();
392 if (available < 0) { 392 if (available < 0) {
393 // A failure has occured. 393 // A failure has occured.
394 ReadOperation::Run(std::move(read_op_), kReadError); 394 ReadOperation::Run(std::move(read_op_), kReadError);
395 return; 395 return;
396 } 396 }
397 if (available) { 397 if (available) {
398 bytes_read = 398 bytes_read =
399 static_cast<int>(std::min<int64_t>(available, read_op_->size())); 399 static_cast<int>(std::min<int64_t>(available, read_op_->size()));
400 bytes_read = reader_->TryRead(read_op_->data(), bytes_read); 400 bytes_read = reader_->TryRead(read_op_->data(), bytes_read);
401
402 if (bytes_read == 0 && total_bytes_ == kPositionNotSpecified) {
403 // We've reached the end of the file and we didn't know the total size
404 // before. Update the total size so Read()s past the end of the file will
405 // fail like they would if we had known the file size at the beginning.
406 total_bytes_ = reader_->Tell();
407 if (total_bytes_ != kPositionNotSpecified)
408 host_->SetTotalBytes(total_bytes_);
409 }
410
401 ReadOperation::Run(std::move(read_op_), bytes_read); 411 ReadOperation::Run(std::move(read_op_), bytes_read);
402 } else { 412 } else {
403 reader_->Wait(1, base::Bind(&MultibufferDataSource::ReadTask, 413 reader_->Wait(1, base::Bind(&MultibufferDataSource::ReadTask,
404 weak_factory_.GetWeakPtr())); 414 weak_factory_.GetWeakPtr()));
405 UpdateLoadingState(false); 415 UpdateLoadingState(false);
406 } 416 }
407 } 417 }
408 418
409 void MultibufferDataSource::StopInternal_Locked() { 419 void MultibufferDataSource::StopInternal_Locked() {
410 lock_.AssertAcquired(); 420 lock_.AssertAcquired();
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
574 reader_->SetMaxBuffer(back_buffer, preload + kPreloadHighExtra); 584 reader_->SetMaxBuffer(back_buffer, preload + kPreloadHighExtra);
575 585
576 if (preload_ == METADATA) { 586 if (preload_ == METADATA) {
577 reader_->SetPreload(0, 0); 587 reader_->SetPreload(0, 0);
578 } else { 588 } else {
579 reader_->SetPreload(preload + kPreloadHighExtra, preload); 589 reader_->SetPreload(preload + kPreloadHighExtra, preload);
580 } 590 }
581 } 591 }
582 592
583 } // namespace media 593 } // namespace media
OLDNEW
« no previous file with comments | « no previous file | media/blink/multibuffer_data_source_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698