diff options
author | acolwell@chromium.org <acolwell@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-12-14 05:14:17 +0000 |
---|---|---|
committer | acolwell@chromium.org <acolwell@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-12-14 05:14:17 +0000 |
commit | dc7862a042484fafbed8f7bcb5c7364f4565ee4e (patch) | |
tree | e26b38df0fff51e086df796ee07d1a33e755753c /media | |
parent | 88c266af33357db418cdb98067476a44dadcbb72 (diff) | |
download | chromium_src-dc7862a042484fafbed8f7bcb5c7364f4565ee4e.zip chromium_src-dc7862a042484fafbed8f7bcb5c7364f4565ee4e.tar.gz chromium_src-dc7862a042484fafbed8f7bcb5c7364f4565ee4e.tar.bz2 |
Add missing AutoLocks to a few ChunkDemuxer methods that needed them.
BUG=166027
Review URL: https://chromiumcodereview.appspot.com/11567024
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@173093 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'media')
-rw-r--r-- | media/filters/chunk_demuxer.cc | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/media/filters/chunk_demuxer.cc b/media/filters/chunk_demuxer.cc index 690b897..c245281 100644 --- a/media/filters/chunk_demuxer.cc +++ b/media/filters/chunk_demuxer.cc @@ -613,6 +613,7 @@ void ChunkDemuxer::OnAudioRendererDisabled() { // Demuxer implementation. scoped_refptr<DemuxerStream> ChunkDemuxer::GetStream( DemuxerStream::Type type) { + base::AutoLock auto_lock(lock_); if (type == DemuxerStream::VIDEO) return video_; @@ -720,8 +721,8 @@ ChunkDemuxer::Status ChunkDemuxer::AddId(const std::string& id, } void ChunkDemuxer::RemoveId(const std::string& id) { - CHECK(IsValidId(id)); base::AutoLock auto_lock(lock_); + CHECK(IsValidId(id)); delete stream_parser_map_[id]; stream_parser_map_.erase(id); @@ -741,12 +742,11 @@ void ChunkDemuxer::RemoveId(const std::string& id) { } Ranges<TimeDelta> ChunkDemuxer::GetBufferedRanges(const std::string& id) const { + base::AutoLock auto_lock(lock_); DCHECK(!id.empty()); DCHECK(IsValidId(id)); DCHECK(id == source_id_audio_ || id == source_id_video_); - base::AutoLock auto_lock(lock_); - if (id == source_id_audio_ && id != source_id_video_) { // Only include ranges that have been buffered in |audio_| return audio_ ? audio_->GetBufferedRanges(duration_) : Ranges<TimeDelta>(); @@ -867,14 +867,15 @@ bool ChunkDemuxer::AppendData(const std::string& id, void ChunkDemuxer::Abort(const std::string& id) { DVLOG(1) << "Abort(" << id << ")"; + base::AutoLock auto_lock(lock_); DCHECK(!id.empty()); CHECK(IsValidId(id)); - stream_parser_map_[id]->Flush(); source_info_map_[id].can_update_offset = true; } void ChunkDemuxer::SetDuration(base::TimeDelta duration) { + base::AutoLock auto_lock(lock_); DVLOG(1) << "SetDuration(" << duration.InSecondsF() << ")"; if (duration == duration_) @@ -890,6 +891,7 @@ void ChunkDemuxer::SetDuration(base::TimeDelta duration) { } bool ChunkDemuxer::SetTimestampOffset(const std::string& id, TimeDelta offset) { + base::AutoLock auto_lock(lock_); DVLOG(1) << "SetTimestampOffset(" << id << ", " << offset.InSecondsF() << ")"; CHECK(IsValidId(id)); @@ -1200,6 +1202,7 @@ void ChunkDemuxer::AdjustBufferTimestamps( } bool ChunkDemuxer::IsValidId(const std::string& source_id) const { + lock_.AssertAcquired(); return source_info_map_.count(source_id) > 0u && stream_parser_map_.count(source_id) > 0u; } |