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

Side by Side Diff: media/filters/source_buffer_state.cc

Issue 2605993002: Experiment with more aggressive MSE GC on memory pressure (Closed)
Patch Set: Improve feature handling (CR feedback) Created 3 years, 10 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
OLDNEW
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
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 bool force_gc) {
313 // Notify video streams about memory pressure first, since video typically
314 // takes up the most memory and that's where we can expect most savings.
315 for (const auto& it : video_streams_)
316 it.second->OnMemoryPressure(media_time, memory_pressure_level, force_gc);
317 for (const auto& it : audio_streams_)
318 it.second->OnMemoryPressure(media_time, memory_pressure_level, force_gc);
319 for (const auto& it : text_streams_)
320 it.second->OnMemoryPressure(media_time, memory_pressure_level, force_gc);
321 }
322
309 Ranges<TimeDelta> SourceBufferState::GetBufferedRanges(TimeDelta duration, 323 Ranges<TimeDelta> SourceBufferState::GetBufferedRanges(TimeDelta duration,
310 bool ended) const { 324 bool ended) const {
311 RangesList ranges_list; 325 RangesList ranges_list;
312 for (const auto& it : audio_streams_) 326 for (const auto& it : audio_streams_)
313 ranges_list.push_back(it.second->GetBufferedRanges(duration)); 327 ranges_list.push_back(it.second->GetBufferedRanges(duration));
314 328
315 for (const auto& it : video_streams_) 329 for (const auto& it : video_streams_)
316 ranges_list.push_back(it.second->GetBufferedRanges(duration)); 330 ranges_list.push_back(it.second->GetBufferedRanges(duration));
317 331
318 for (const auto& it : text_streams_) 332 for (const auto& it : text_streams_)
(...skipping 569 matching lines...) Expand 10 before | Expand all | Expand 10 after
888 } 902 }
889 void SourceBufferState::OnSourceInitDone( 903 void SourceBufferState::OnSourceInitDone(
890 const StreamParser::InitParameters& params) { 904 const StreamParser::InitParameters& params) {
891 DCHECK_EQ(state_, PENDING_PARSER_INIT); 905 DCHECK_EQ(state_, PENDING_PARSER_INIT);
892 state_ = PARSER_INITIALIZED; 906 state_ = PARSER_INITIALIZED;
893 auto_update_timestamp_offset_ = params.auto_update_timestamp_offset; 907 auto_update_timestamp_offset_ = params.auto_update_timestamp_offset;
894 base::ResetAndReturn(&init_cb_).Run(params); 908 base::ResetAndReturn(&init_cb_).Run(params);
895 } 909 }
896 910
897 } // namespace media 911 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698