| OLD | NEW |
| 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 <deque> | 8 #include <deque> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 695 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 706 } | 706 } |
| 707 | 707 |
| 708 void ChunkDemuxer::RemoveId(const std::string& id) { | 708 void ChunkDemuxer::RemoveId(const std::string& id) { |
| 709 CHECK(IsValidId(id)); | 709 CHECK(IsValidId(id)); |
| 710 base::AutoLock auto_lock(lock_); | 710 base::AutoLock auto_lock(lock_); |
| 711 | 711 |
| 712 delete stream_parser_map_[id]; | 712 delete stream_parser_map_[id]; |
| 713 stream_parser_map_.erase(id); | 713 stream_parser_map_.erase(id); |
| 714 source_info_map_.erase(id); | 714 source_info_map_.erase(id); |
| 715 | 715 |
| 716 if (source_id_audio_ == id && audio_) | 716 if (source_id_audio_ == id) { |
| 717 audio_->Shutdown(); | 717 if (audio_) |
| 718 audio_->Shutdown(); |
| 719 source_id_audio_.clear(); |
| 720 } |
| 718 | 721 |
| 719 if (source_id_video_ == id && video_) | 722 if (source_id_video_ == id) { |
| 720 video_->Shutdown(); | 723 if (video_) |
| 724 video_->Shutdown(); |
| 725 source_id_video_.clear(); |
| 726 } |
| 721 } | 727 } |
| 722 | 728 |
| 723 Ranges<TimeDelta> ChunkDemuxer::GetBufferedRanges(const std::string& id) const { | 729 Ranges<TimeDelta> ChunkDemuxer::GetBufferedRanges(const std::string& id) const { |
| 724 DCHECK(!id.empty()); | 730 DCHECK(!id.empty()); |
| 725 DCHECK(IsValidId(id)); | 731 DCHECK(IsValidId(id)); |
| 726 DCHECK(id == source_id_audio_ || id == source_id_video_); | 732 DCHECK(id == source_id_audio_ || id == source_id_video_); |
| 727 | 733 |
| 728 base::AutoLock auto_lock(lock_); | 734 base::AutoLock auto_lock(lock_); |
| 729 | 735 |
| 730 if (id == source_id_audio_ && id != source_id_video_) { | 736 if (id == source_id_audio_ && id != source_id_video_) { |
| (...skipping 462 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1193 | 1199 |
| 1194 Ranges<TimeDelta> ChunkDemuxer::GetBufferedRanges() const { | 1200 Ranges<TimeDelta> ChunkDemuxer::GetBufferedRanges() const { |
| 1195 if (audio_ && !video_) | 1201 if (audio_ && !video_) |
| 1196 return audio_->GetBufferedRanges(duration_); | 1202 return audio_->GetBufferedRanges(duration_); |
| 1197 else if (!audio_ && video_) | 1203 else if (!audio_ && video_) |
| 1198 return video_->GetBufferedRanges(duration_); | 1204 return video_->GetBufferedRanges(duration_); |
| 1199 return ComputeIntersection(); | 1205 return ComputeIntersection(); |
| 1200 } | 1206 } |
| 1201 | 1207 |
| 1202 } // namespace media | 1208 } // namespace media |
| OLD | NEW |