Index: media/filters/chunk_demuxer.cc |
diff --git a/media/filters/chunk_demuxer.cc b/media/filters/chunk_demuxer.cc |
index 1b57c3a1b18d35587bf6f07e8b2f6a68c258f15f..3936f8770d6d5680bce533836f6dfcaed32828ed 100644 |
--- a/media/filters/chunk_demuxer.cc |
+++ b/media/filters/chunk_demuxer.cc |
@@ -133,6 +133,8 @@ class SourceState { |
// ChunkDemuxerStreams managed by this object. |
void Remove(TimeDelta start, TimeDelta end, TimeDelta duration); |
+ bool EvictFrames(); |
+ |
// Returns true if currently parsing a media segment, or false otherwise. |
bool parsing_media_segment() const { return parsing_media_segment_; } |
@@ -375,6 +377,23 @@ void SourceState::Remove(TimeDelta start, TimeDelta end, TimeDelta duration) { |
} |
} |
+bool SourceState::EvictFrames() { |
+ bool success = true; |
+ |
+ if(audio_) |
+ success = audio_->EvictFrames() && success; |
+ |
+ if (video_) |
+ success = video_->EvictFrames() && success; |
+ |
+ for (TextStreamMap::iterator itr = text_stream_map_.begin(); |
philipj_slow
2014/12/10 09:26:08
If C++11 range-based for loops work here, that wou
kjoswiak
2014/12/10 19:35:28
I did it this way because this is how it's done el
philipj_slow
2014/12/10 19:39:56
OK, owners get to decide.
|
+ itr != text_stream_map_.end(); ++itr) { |
+ success = itr->second->EvictFrames() && success; |
+ } |
+ |
+ return success; |
+} |
+ |
Ranges<TimeDelta> SourceState::GetBufferedRanges(TimeDelta duration, |
bool ended) const { |
// TODO(acolwell): When we start allowing disabled tracks we'll need to update |
@@ -883,6 +902,11 @@ void ChunkDemuxerStream::Remove(TimeDelta start, TimeDelta end, |
stream_->Remove(start, end, duration); |
} |
+bool ChunkDemuxerStream::EvictFrames() { |
+ base::AutoLock auto_lock(lock_); |
+ return stream_->GarbageCollectIfNeeded(); |
+} |
+ |
void ChunkDemuxerStream::OnSetDuration(TimeDelta duration) { |
base::AutoLock auto_lock(lock_); |
stream_->OnSetDuration(duration); |
@@ -1316,6 +1340,15 @@ Ranges<TimeDelta> ChunkDemuxer::GetBufferedRanges(const std::string& id) const { |
return itr->second->GetBufferedRanges(duration_, state_ == ENDED); |
} |
+bool ChunkDemuxer::EvictFrames() { |
+ bool success = true; |
+ for (SourceStateMap::iterator itr = source_state_map_.begin(); |
+ itr != source_state_map_.end(); ++itr) { |
+ success = itr->second->EvictFrames() && success; |
+ } |
+ return success; |
+} |
+ |
void ChunkDemuxer::AppendData( |
const std::string& id, |
const uint8* data, |