| Index: media/filters/chunk_demuxer.cc
|
| diff --git a/media/filters/chunk_demuxer.cc b/media/filters/chunk_demuxer.cc
|
| index 1b57c3a1b18d35587bf6f07e8b2f6a68c258f15f..4288a362bb38b8ec2c66cbf9381cad639bd8124d 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(DecodeTimestamp media_time);
|
| +
|
| // 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(DecodeTimestamp media_time) {
|
| + bool success = true;
|
| +
|
| + if(audio_)
|
| + success = audio_->EvictFrames(media_time) && success;
|
| +
|
| + if (video_)
|
| + success = video_->EvictFrames(media_time) && success;
|
| +
|
| + for (TextStreamMap::iterator itr = text_stream_map_.begin();
|
| + itr != text_stream_map_.end(); ++itr) {
|
| + success = itr->second->EvictFrames(media_time) && 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(DecodeTimestamp media_time) {
|
| + base::AutoLock auto_lock(lock_);
|
| + return stream_->GarbageCollectIfNeeded(media_time);
|
| +}
|
| +
|
| void ChunkDemuxerStream::OnSetDuration(TimeDelta duration) {
|
| base::AutoLock auto_lock(lock_);
|
| stream_->OnSetDuration(duration);
|
| @@ -1124,6 +1148,11 @@ ChunkDemuxer::ChunkDemuxer(
|
| DCHECK(!encrypted_media_init_data_cb_.is_null());
|
| }
|
|
|
| +void ChunkDemuxer::SetMediaTimeProvider(
|
| + const base::Callback<base::TimeDelta(void)>& get_media_time_cb) {
|
| + get_media_time_cb_ = get_media_time_cb;
|
| +}
|
| +
|
| void ChunkDemuxer::Initialize(
|
| DemuxerHost* host,
|
| const PipelineStatusCB& cb,
|
| @@ -1316,6 +1345,23 @@ Ranges<TimeDelta> ChunkDemuxer::GetBufferedRanges(const std::string& id) const {
|
| return itr->second->GetBufferedRanges(duration_, state_ == ENDED);
|
| }
|
|
|
| +bool ChunkDemuxer::EvictFrames() {
|
| + DecodeTimestamp current_media_time;
|
| + if (!get_media_time_cb_.is_null()) {
|
| + current_media_time =
|
| + DecodeTimestamp::FromPresentationTime(get_media_time_cb_.Run());
|
| + } else {
|
| + current_media_time = kNoDecodeTimestamp();
|
| + }
|
| +
|
| + bool success = true;
|
| + for (SourceStateMap::iterator itr = source_state_map_.begin();
|
| + itr != source_state_map_.end(); ++itr) {
|
| + success = itr->second->EvictFrames(current_media_time) && success;
|
| + }
|
| + return success;
|
| +}
|
| +
|
| void ChunkDemuxer::AppendData(
|
| const std::string& id,
|
| const uint8* data,
|
|
|