| 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 690 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 701 } | 701 } |
| 702 | 702 |
| 703 void ChunkDemuxer::RemoveId(const std::string& id) { | 703 void ChunkDemuxer::RemoveId(const std::string& id) { |
| 704 CHECK(IsValidId(id)); | 704 CHECK(IsValidId(id)); |
| 705 base::AutoLock auto_lock(lock_); | 705 base::AutoLock auto_lock(lock_); |
| 706 | 706 |
| 707 delete stream_parser_map_[id]; | 707 delete stream_parser_map_[id]; |
| 708 stream_parser_map_.erase(id); | 708 stream_parser_map_.erase(id); |
| 709 source_info_map_.erase(id); | 709 source_info_map_.erase(id); |
| 710 | 710 |
| 711 if (source_id_audio_ == id && audio_) | 711 if (source_id_audio_ == id) { |
| 712 audio_->Shutdown(); | 712 if (audio_) |
| 713 audio_->Shutdown(); |
| 714 source_id_audio_.clear(); |
| 715 } |
| 713 | 716 |
| 714 if (source_id_video_ == id && video_) | 717 if (source_id_video_ == id) { |
| 715 video_->Shutdown(); | 718 if (video_) |
| 719 video_->Shutdown(); |
| 720 source_id_video_.clear(); |
| 721 } |
| 716 } | 722 } |
| 717 | 723 |
| 718 Ranges<TimeDelta> ChunkDemuxer::GetBufferedRanges(const std::string& id) const { | 724 Ranges<TimeDelta> ChunkDemuxer::GetBufferedRanges(const std::string& id) const { |
| 719 DCHECK(!id.empty()); | 725 DCHECK(!id.empty()); |
| 720 DCHECK(IsValidId(id)); | 726 DCHECK(IsValidId(id)); |
| 721 DCHECK(id == source_id_audio_ || id == source_id_video_); | 727 DCHECK(id == source_id_audio_ || id == source_id_video_); |
| 722 | 728 |
| 723 base::AutoLock auto_lock(lock_); | 729 base::AutoLock auto_lock(lock_); |
| 724 | 730 |
| 725 if (id == source_id_audio_ && id != source_id_video_) { | 731 if (id == source_id_audio_ && id != source_id_video_) { |
| (...skipping 462 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1188 | 1194 |
| 1189 Ranges<TimeDelta> ChunkDemuxer::GetBufferedRanges() const { | 1195 Ranges<TimeDelta> ChunkDemuxer::GetBufferedRanges() const { |
| 1190 if (audio_ && !video_) | 1196 if (audio_ && !video_) |
| 1191 return audio_->GetBufferedRanges(duration_); | 1197 return audio_->GetBufferedRanges(duration_); |
| 1192 else if (!audio_ && video_) | 1198 else if (!audio_ && video_) |
| 1193 return video_->GetBufferedRanges(duration_); | 1199 return video_->GetBufferedRanges(duration_); |
| 1194 return ComputeIntersection(); | 1200 return ComputeIntersection(); |
| 1195 } | 1201 } |
| 1196 | 1202 |
| 1197 } // namespace media | 1203 } // namespace media |
| OLD | NEW |