Index: media/blink/multibuffer_data_source.cc |
diff --git a/media/blink/multibuffer_data_source.cc b/media/blink/multibuffer_data_source.cc |
index 335617a6b4bbe8bd0ef5dd58fc9e26f5c484df42..51c4ccb1b0ec53d500705d284dc9f143ed8aa765 100644 |
--- a/media/blink/multibuffer_data_source.cc |
+++ b/media/blink/multibuffer_data_source.cc |
@@ -23,13 +23,14 @@ namespace { |
// Minimum preload buffer. |
const int64_t kMinBufferPreload = 2 << 20; // 2 Mb |
// Maxmimum preload buffer. |
-const int64_t kMaxBufferPreload = 20 << 20; // 20 Mb |
+const int64_t kMaxBufferPreload = 50 << 20; // 50 Mb |
// Preload this much extra, then stop preloading until we fall below the |
// kTargetSecondsBufferedAhead. |
const int64_t kPreloadHighExtra = 1 << 20; // 1 Mb |
// Total size of the pinned region in the cache. |
+// Note that we go over this if preload is calculated high enough. |
const int64_t kMaxBufferSize = 25 << 20; // 25 Mb |
// If bitrate is not known, use this. |
@@ -603,16 +604,17 @@ void MultibufferDataSource::UpdateBufferSizes() { |
kMinBufferPreload, kMaxBufferPreload); |
int64_t preload_high = preload + kPreloadHighExtra; |
- // Assert that kMaxBufferSize is big enough that the subtraction on the next |
- // line cannot go negative. |
- static_assert(kMaxBufferSize > kMaxBufferPreload + kPreloadHighExtra, |
- "kMaxBufferSize too small to contain preload."); |
- int64_t back_buffer = clamp(kTargetSecondsBufferedBehind * bytes_per_second, |
- kMinBufferPreload, kMaxBufferSize - preload_high); |
+ // Make sure that kMaxBufferSize is big enough that the subtraction on the |
+ // next line cannot go negative. |
+ int64_t max_buffer_size = |
+ std::max(kMaxBufferSize, kMaxBufferPreload + kPreloadHighExtra); |
watk
2016/11/03 21:09:18
Drive by: It's confusing to me that kMaxBufferSize
hubbe
2016/11/03 23:11:59
You're right, and that's not how I wanted it to wo
|
+ int64_t back_buffer = |
+ clamp(kTargetSecondsBufferedBehind * bytes_per_second, kMinBufferPreload, |
+ max_buffer_size - preload_high); |
int64_t buffer_size = |
std::min((kTargetSecondsBufferedAhead + kTargetSecondsBufferedBehind) * |
bytes_per_second, |
- kMaxBufferSize); |
+ max_buffer_size); |
reader_->SetMaxBuffer(buffer_size); |
reader_->SetPinRange(back_buffer, kMaxBufferPreload + kPreloadHighExtra); |