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

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

Issue 1983793003: Make http/tests/media/audio-seekable-contains-zero-without-ranges.html work with multibuffers. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: test added 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 378 matching lines...) Expand 10 before | Expand all | Expand 10 after
389 int64_t available = reader_->Available(); 389 int64_t available = reader_->Available();
390 if (available < 0) { 390 if (available < 0) {
391 // A failure has occured. 391 // A failure has occured.
392 ReadOperation::Run(std::move(read_op_), kReadError); 392 ReadOperation::Run(std::move(read_op_), kReadError);
393 return; 393 return;
394 } 394 }
395 if (available) { 395 if (available) {
396 bytes_read = 396 bytes_read =
397 static_cast<int>(std::min<int64_t>(available, read_op_->size())); 397 static_cast<int>(std::min<int64_t>(available, read_op_->size()));
398 bytes_read = reader_->TryRead(read_op_->data(), bytes_read); 398 bytes_read = reader_->TryRead(read_op_->data(), bytes_read);
399
400 if (bytes_read == 0 && total_bytes_ == kPositionNotSpecified) {
401 // We've reached the end of the file and we didn't know the total size
402 // before. Update the total size so Read()s past the end of the file will
403 // fail like they would if we had known the file size at the beginning.
404 total_bytes_ = reader_->Tell();
405 if (total_bytes_ != kPositionNotSpecified)
406 host_->SetTotalBytes(total_bytes_);
407 }
408
399 ReadOperation::Run(std::move(read_op_), bytes_read); 409 ReadOperation::Run(std::move(read_op_), bytes_read);
400 } else { 410 } else {
401 reader_->Wait(1, base::Bind(&MultibufferDataSource::ReadTask, 411 reader_->Wait(1, base::Bind(&MultibufferDataSource::ReadTask,
402 weak_factory_.GetWeakPtr())); 412 weak_factory_.GetWeakPtr()));
403 UpdateLoadingState(false); 413 UpdateLoadingState(false);
404 } 414 }
405 } 415 }
406 416
407 void MultibufferDataSource::StopInternal_Locked() { 417 void MultibufferDataSource::StopInternal_Locked() {
408 lock_.AssertAcquired(); 418 lock_.AssertAcquired();
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
581 reader_->SetPinRange(back_buffer, kMaxBufferPreload + kPreloadHighExtra); 591 reader_->SetPinRange(back_buffer, kMaxBufferPreload + kPreloadHighExtra);
582 592
583 if (preload_ == METADATA) { 593 if (preload_ == METADATA) {
584 reader_->SetPreload(0, 0); 594 reader_->SetPreload(0, 0);
585 } else { 595 } else {
586 reader_->SetPreload(preload_high, preload); 596 reader_->SetPreload(preload_high, preload);
587 } 597 }
588 } 598 }
589 599
590 } // namespace media 600 } // 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