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

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

Issue 1869203003: Fix memory usage bug. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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 | no next file » | 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 552 matching lines...) Expand 10 before | Expand all | Expand 10 after
563 playback_rate = std::max(playback_rate, 1.0); 563 playback_rate = std::max(playback_rate, 1.0);
564 playback_rate = std::min(playback_rate, kMaxPlaybackRate); 564 playback_rate = std::min(playback_rate, kMaxPlaybackRate);
565 565
566 int64_t bytes_per_second = (bitrate / 8.0) * playback_rate; 566 int64_t bytes_per_second = (bitrate / 8.0) * playback_rate;
567 567
568 int64_t preload = clamp(kTargetSecondsBufferedAhead * bytes_per_second, 568 int64_t preload = clamp(kTargetSecondsBufferedAhead * bytes_per_second,
569 kMinBufferPreload, kMaxBufferPreload); 569 kMinBufferPreload, kMaxBufferPreload);
570 int64_t back_buffer = clamp(kTargetSecondsBufferedBehind * bytes_per_second, 570 int64_t back_buffer = clamp(kTargetSecondsBufferedBehind * bytes_per_second,
571 kMinBufferPreload, kMaxBufferPreload); 571 kMinBufferPreload, kMaxBufferPreload);
572 int64_t pin_forwards = kMaxBufferSize - back_buffer; 572 int64_t pin_forwards = kMaxBufferSize - back_buffer;
573 DCHECK_LE(preload_ + kPreloadHighExtra, pin_forwards); 573 DCHECK_LE(preload + kPreloadHighExtra, pin_forwards);
574 reader_->SetMaxBuffer(back_buffer, pin_forwards); 574 reader_->SetMaxBuffer(back_buffer, preload + kPreloadHighExtra);
575 575
576 if (preload_ == METADATA) { 576 if (preload_ == METADATA) {
577 reader_->SetPreload(0, 0); 577 reader_->SetPreload(0, 0);
578 } else { 578 } else {
579 reader_->SetPreload(preload + kPreloadHighExtra, preload); 579 reader_->SetPreload(preload + kPreloadHighExtra, preload);
580 } 580 }
581 } 581 }
582 582
583 } // namespace media 583 } // namespace media
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698