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

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

Issue 2605993002: Experiment with more aggressive MSE GC on memory pressure (Closed)
Patch Set: typo Created 3 years, 11 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/chunk_demuxer.h" 5 #include "media/filters/chunk_demuxer.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <limits> 8 #include <limits>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 base::AutoLock auto_lock(lock_); 118 base::AutoLock auto_lock(lock_);
119 stream_->Remove(start, end, duration); 119 stream_->Remove(start, end, duration);
120 } 120 }
121 121
122 bool ChunkDemuxerStream::EvictCodedFrames(DecodeTimestamp media_time, 122 bool ChunkDemuxerStream::EvictCodedFrames(DecodeTimestamp media_time,
123 size_t newDataSize) { 123 size_t newDataSize) {
124 base::AutoLock auto_lock(lock_); 124 base::AutoLock auto_lock(lock_);
125 return stream_->GarbageCollectIfNeeded(media_time, newDataSize); 125 return stream_->GarbageCollectIfNeeded(media_time, newDataSize);
126 } 126 }
127 127
128 void ChunkDemuxerStream::OnMemoryPressure(
129 DecodeTimestamp media_time,
130 base::MemoryPressureListener::MemoryPressureLevel memory_pressure_level) {
131 base::AutoLock auto_lock(lock_);
132 return stream_->OnMemoryPressure(media_time, memory_pressure_level);
133 }
134
128 void ChunkDemuxerStream::OnSetDuration(TimeDelta duration) { 135 void ChunkDemuxerStream::OnSetDuration(TimeDelta duration) {
129 base::AutoLock auto_lock(lock_); 136 base::AutoLock auto_lock(lock_);
130 stream_->OnSetDuration(duration); 137 stream_->OnSetDuration(duration);
131 } 138 }
132 139
133 Ranges<TimeDelta> ChunkDemuxerStream::GetBufferedRanges( 140 Ranges<TimeDelta> ChunkDemuxerStream::GetBufferedRanges(
134 TimeDelta duration) const { 141 TimeDelta duration) const {
135 base::AutoLock auto_lock(lock_); 142 base::AutoLock auto_lock(lock_);
136 143
137 if (type_ == TEXT) { 144 if (type_ == TEXT) {
(...skipping 591 matching lines...) Expand 10 before | Expand all | Expand 10 after
729 DCHECK_EQ(DemuxerStream::VIDEO, stream->type()); 736 DCHECK_EQ(DemuxerStream::VIDEO, stream->type());
730 stream->set_enabled(false, currTime); 737 stream->set_enabled(false, currTime);
731 } 738 }
732 } 739 }
733 if (selected_stream) { 740 if (selected_stream) {
734 DVLOG(1) << __func__ << ": enabling stream " << selected_stream; 741 DVLOG(1) << __func__ << ": enabling stream " << selected_stream;
735 selected_stream->set_enabled(true, currTime); 742 selected_stream->set_enabled(true, currTime);
736 } 743 }
737 } 744 }
738 745
746 void ChunkDemuxer::OnMemoryPressure(
747 base::TimeDelta currentMediaTime,
748 base::MemoryPressureListener::MemoryPressureLevel memory_pressure_level) {
749 DecodeTimestamp media_time_dts =
750 DecodeTimestamp::FromPresentationTime(currentMediaTime);
751 base::AutoLock auto_lock(lock_);
752 for (const auto& itr : source_state_map_) {
753 itr.second->OnMemoryPressure(media_time_dts, memory_pressure_level);
754 }
755 }
756
739 bool ChunkDemuxer::EvictCodedFrames(const std::string& id, 757 bool ChunkDemuxer::EvictCodedFrames(const std::string& id,
740 base::TimeDelta currentMediaTime, 758 base::TimeDelta currentMediaTime,
741 size_t newDataSize) { 759 size_t newDataSize) {
742 DVLOG(1) << __func__ << "(" << id << ")" 760 DVLOG(1) << __func__ << "(" << id << ")"
743 << " media_time=" << currentMediaTime.InSecondsF() 761 << " media_time=" << currentMediaTime.InSecondsF()
744 << " newDataSize=" << newDataSize; 762 << " newDataSize=" << newDataSize;
745 base::AutoLock auto_lock(lock_); 763 base::AutoLock auto_lock(lock_);
746 764
747 // Note: The direct conversion from PTS to DTS is safe here, since we don't 765 // Note: The direct conversion from PTS to DTS is safe here, since we don't
748 // need to know currentTime precisely for GC. GC only needs to know which GOP 766 // need to know currentTime precisely for GC. GC only needs to know which GOP
(...skipping 558 matching lines...) Expand 10 before | Expand all | Expand 10 after
1307 } 1325 }
1308 1326
1309 void ChunkDemuxer::ShutdownAllStreams() { 1327 void ChunkDemuxer::ShutdownAllStreams() {
1310 for (auto itr = source_state_map_.begin(); itr != source_state_map_.end(); 1328 for (auto itr = source_state_map_.begin(); itr != source_state_map_.end();
1311 ++itr) { 1329 ++itr) {
1312 itr->second->Shutdown(); 1330 itr->second->Shutdown();
1313 } 1331 }
1314 } 1332 }
1315 1333
1316 } // namespace media 1334 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698