Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/filters/source_buffer_state.h" | 5 #include "media/filters/source_buffer_state.h" |
| 6 | 6 |
| 7 #include <set> | 7 #include <set> |
| 8 | 8 |
| 9 #include "base/callback_helpers.h" | 9 #include "base/callback_helpers.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 299 uint64_t estimated_new_size = newDataSize * curr_size / total_buffered_size; | 299 uint64_t estimated_new_size = newDataSize * curr_size / total_buffered_size; |
| 300 DCHECK_LE(estimated_new_size, SIZE_MAX); | 300 DCHECK_LE(estimated_new_size, SIZE_MAX); |
| 301 success &= it.second->EvictCodedFrames( | 301 success &= it.second->EvictCodedFrames( |
| 302 media_time, static_cast<size_t>(estimated_new_size)); | 302 media_time, static_cast<size_t>(estimated_new_size)); |
| 303 } | 303 } |
| 304 | 304 |
| 305 DVLOG(3) << __func__ << " success=" << success; | 305 DVLOG(3) << __func__ << " success=" << success; |
| 306 return success; | 306 return success; |
| 307 } | 307 } |
| 308 | 308 |
| 309 void SourceBufferState::OnMemoryPressure( | |
| 310 DecodeTimestamp media_time, | |
| 311 base::MemoryPressureListener::MemoryPressureLevel memory_pressure_level) { | |
| 312 // Notify video streams about memory pressure first, since video typically | |
| 313 // takes up the most memory and that's where we can expect most savings. | |
|
chcunningham
2017/01/25 03:47:15
I agree about the savings, but I don't follow on t
servolk
2017/01/25 18:06:47
This might make a difference when the instant GC o
chcunningham
2017/01/25 22:21:56
I think this is fine, I just wanted to be sure I w
servolk
2017/01/26 18:10:14
The aggressiveness of GC for audio/text is going t
| |
| 314 for (const auto& it : video_streams_) | |
| 315 it.second->OnMemoryPressure(media_time, memory_pressure_level); | |
| 316 for (const auto& it : audio_streams_) | |
| 317 it.second->OnMemoryPressure(media_time, memory_pressure_level); | |
| 318 for (const auto& it : text_streams_) | |
| 319 it.second->OnMemoryPressure(media_time, memory_pressure_level); | |
| 320 } | |
| 321 | |
| 309 Ranges<TimeDelta> SourceBufferState::GetBufferedRanges(TimeDelta duration, | 322 Ranges<TimeDelta> SourceBufferState::GetBufferedRanges(TimeDelta duration, |
| 310 bool ended) const { | 323 bool ended) const { |
| 311 RangesList ranges_list; | 324 RangesList ranges_list; |
| 312 for (const auto& it : audio_streams_) | 325 for (const auto& it : audio_streams_) |
| 313 ranges_list.push_back(it.second->GetBufferedRanges(duration)); | 326 ranges_list.push_back(it.second->GetBufferedRanges(duration)); |
| 314 | 327 |
| 315 for (const auto& it : video_streams_) | 328 for (const auto& it : video_streams_) |
| 316 ranges_list.push_back(it.second->GetBufferedRanges(duration)); | 329 ranges_list.push_back(it.second->GetBufferedRanges(duration)); |
| 317 | 330 |
| 318 for (const auto& it : text_streams_) | 331 for (const auto& it : text_streams_) |
| (...skipping 569 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 888 } | 901 } |
| 889 void SourceBufferState::OnSourceInitDone( | 902 void SourceBufferState::OnSourceInitDone( |
| 890 const StreamParser::InitParameters& params) { | 903 const StreamParser::InitParameters& params) { |
| 891 DCHECK_EQ(state_, PENDING_PARSER_INIT); | 904 DCHECK_EQ(state_, PENDING_PARSER_INIT); |
| 892 state_ = PARSER_INITIALIZED; | 905 state_ = PARSER_INITIALIZED; |
| 893 auto_update_timestamp_offset_ = params.auto_update_timestamp_offset; | 906 auto_update_timestamp_offset_ = params.auto_update_timestamp_offset; |
| 894 base::ResetAndReturn(&init_cb_).Run(params); | 907 base::ResetAndReturn(&init_cb_).Run(params); |
| 895 } | 908 } |
| 896 | 909 |
| 897 } // namespace media | 910 } // namespace media |
| OLD | NEW |