Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(254)

Side by Side Diff: media/filters/chunk_demuxer.cc

Issue 10830185: Check for duplicate id strings in ChunkDemuxer::AddId() (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698