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 598 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
609 | 609 |
610 ChangeState_Locked(INITIALIZED); | 610 ChangeState_Locked(INITIALIZED); |
611 } | 611 } |
612 | 612 |
613 ChunkDemuxer::Status ChunkDemuxer::AddId(const std::string& id, | 613 ChunkDemuxer::Status ChunkDemuxer::AddId(const std::string& id, |
614 const std::string& type, | 614 const std::string& type, |
615 std::vector<std::string>& codecs) { | 615 std::vector<std::string>& codecs) { |
616 DCHECK_GT(codecs.size(), 0u); | 616 DCHECK_GT(codecs.size(), 0u); |
617 base::AutoLock auto_lock(lock_); | 617 base::AutoLock auto_lock(lock_); |
618 | 618 |
619 if (state_ != WAITING_FOR_INIT && state_ != INITIALIZING) | 619 if ((state_ != WAITING_FOR_INIT && state_ != INITIALIZING) || |
| 620 stream_parser_map_.count(id) > 0u) |
620 return kReachedIdLimit; | 621 return kReachedIdLimit; |
621 | 622 |
622 bool has_audio = false; | 623 bool has_audio = false; |
623 bool has_video = false; | 624 bool has_video = false; |
624 ParserFactoryFunction factory_function = NULL; | 625 ParserFactoryFunction factory_function = NULL; |
625 if (!IsSupported(type, codecs, &factory_function, &has_audio, &has_video)) | 626 if (!IsSupported(type, codecs, &factory_function, &has_audio, &has_video)) |
626 return kNotSupported; | 627 return kNotSupported; |
627 | 628 |
628 if ((has_audio && !source_id_audio_.empty()) || | 629 if ((has_audio && !source_id_audio_.empty()) || |
629 (has_video && !source_id_video_.empty())) | 630 (has_video && !source_id_video_.empty())) |
(...skipping 525 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1155 | 1156 |
1156 Ranges<TimeDelta> ChunkDemuxer::GetBufferedRanges() const { | 1157 Ranges<TimeDelta> ChunkDemuxer::GetBufferedRanges() const { |
1157 if (audio_ && !video_) | 1158 if (audio_ && !video_) |
1158 return audio_->GetBufferedRanges(duration_); | 1159 return audio_->GetBufferedRanges(duration_); |
1159 else if (!audio_ && video_) | 1160 else if (!audio_ && video_) |
1160 return video_->GetBufferedRanges(duration_); | 1161 return video_->GetBufferedRanges(duration_); |
1161 return ComputeIntersection(); | 1162 return ComputeIntersection(); |
1162 } | 1163 } |
1163 | 1164 |
1164 } // namespace media | 1165 } // namespace media |
OLD | NEW |