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

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

Issue 1815893002: Merge M50: "Disable "pause-and-buffer" on Android, cancel suspended players." (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2661
Patch Set: Created 4 years, 9 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 | « media/blink/multibuffer_data_source.h ('k') | 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 296 matching lines...) Expand 10 before | Expand all | Expand 10 after
307 base::Bind(&MultibufferDataSource::StopLoader, 307 base::Bind(&MultibufferDataSource::StopLoader,
308 weak_factory_.GetWeakPtr())); 308 weak_factory_.GetWeakPtr()));
309 } 309 }
310 310
311 void MultibufferDataSource::SetBitrate(int bitrate) { 311 void MultibufferDataSource::SetBitrate(int bitrate) {
312 render_task_runner_->PostTask( 312 render_task_runner_->PostTask(
313 FROM_HERE, base::Bind(&MultibufferDataSource::SetBitrateTask, 313 FROM_HERE, base::Bind(&MultibufferDataSource::SetBitrateTask,
314 weak_factory_.GetWeakPtr(), bitrate)); 314 weak_factory_.GetWeakPtr(), bitrate));
315 } 315 }
316 316
317 void MultibufferDataSource::OnBufferingHaveEnough() { 317 void MultibufferDataSource::OnBufferingHaveEnough(bool always_cancel) {
318 DCHECK(render_task_runner_->BelongsToCurrentThread()); 318 DCHECK(render_task_runner_->BelongsToCurrentThread());
319 if (reader_ && preload_ == METADATA && !media_has_played_ && !IsStreaming()) { 319 if (reader_ && (always_cancel || (preload_ == METADATA &&
320 !media_has_played_ && !IsStreaming()))) {
320 cancel_on_defer_ = true; 321 cancel_on_defer_ = true;
321 if (!loading_) 322 if (!loading_)
322 reader_.reset(nullptr); 323 reader_.reset(nullptr);
323 } 324 }
324 } 325 }
325 326
326 int64_t MultibufferDataSource::GetMemoryUsage() const { 327 int64_t MultibufferDataSource::GetMemoryUsage() const {
327 // TODO(hubbe): Make more accurate when url_data_ is shared. 328 // TODO(hubbe): Make more accurate when url_data_ is shared.
328 return url_data_->CachedSize() 329 return url_data_->CachedSize()
329 << url_data_->multibuffer()->block_size_shift(); 330 << url_data_->multibuffer()->block_size_shift();
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after
573 reader_->SetMaxBuffer(back_buffer, pin_forwards); 574 reader_->SetMaxBuffer(back_buffer, pin_forwards);
574 575
575 if (preload_ == METADATA) { 576 if (preload_ == METADATA) {
576 reader_->SetPreload(0, 0); 577 reader_->SetPreload(0, 0);
577 } else { 578 } else {
578 reader_->SetPreload(preload + kPreloadHighExtra, preload); 579 reader_->SetPreload(preload + kPreloadHighExtra, preload);
579 } 580 }
580 } 581 }
581 582
582 } // namespace media 583 } // namespace media
OLDNEW
« no previous file with comments | « media/blink/multibuffer_data_source.h ('k') | media/blink/multibuffer_data_source_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698