| 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 343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 354 // This can be done by intersecting the stream's range with the valid time | 354 // This can be done by intersecting the stream's range with the valid time |
| 355 // range. | 355 // range. |
| 356 Ranges<TimeDelta> valid_time_range; | 356 Ranges<TimeDelta> valid_time_range; |
| 357 valid_time_range.Add(range.start(0), duration); | 357 valid_time_range.Add(range.start(0), duration); |
| 358 return range.IntersectionWith(valid_time_range); | 358 return range.IntersectionWith(valid_time_range); |
| 359 } | 359 } |
| 360 | 360 |
| 361 bool ChunkDemuxerStream::UpdateAudioConfig(const AudioDecoderConfig& config) { | 361 bool ChunkDemuxerStream::UpdateAudioConfig(const AudioDecoderConfig& config) { |
| 362 DCHECK(config.IsValidConfig()); | 362 DCHECK(config.IsValidConfig()); |
| 363 DCHECK_EQ(type_, AUDIO); | 363 DCHECK_EQ(type_, AUDIO); |
| 364 base::AutoLock auto_lock(lock_); |
| 364 return stream_->UpdateAudioConfig(config); | 365 return stream_->UpdateAudioConfig(config); |
| 365 } | 366 } |
| 366 | 367 |
| 367 bool ChunkDemuxerStream::UpdateVideoConfig(const VideoDecoderConfig& config) { | 368 bool ChunkDemuxerStream::UpdateVideoConfig(const VideoDecoderConfig& config) { |
| 368 DCHECK(config.IsValidConfig()); | 369 DCHECK(config.IsValidConfig()); |
| 369 DCHECK_EQ(type_, VIDEO); | 370 DCHECK_EQ(type_, VIDEO); |
| 371 base::AutoLock auto_lock(lock_); |
| 370 return stream_->UpdateVideoConfig(config); | 372 return stream_->UpdateVideoConfig(config); |
| 371 } | 373 } |
| 372 | 374 |
| 373 void ChunkDemuxerStream::EndOfStream() { | 375 void ChunkDemuxerStream::EndOfStream() { |
| 374 ClosureQueue closures; | 376 ClosureQueue closures; |
| 375 { | 377 { |
| 376 base::AutoLock auto_lock(lock_); | 378 base::AutoLock auto_lock(lock_); |
| 377 DCHECK(!end_of_stream_); | 379 DCHECK(!end_of_stream_); |
| 378 DCHECK(stream_->IsEndSelected()); | 380 DCHECK(stream_->IsEndSelected()); |
| 379 end_of_stream_ = true; | 381 end_of_stream_ = true; |
| (...skipping 807 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1187 | 1189 |
| 1188 Ranges<TimeDelta> ChunkDemuxer::GetBufferedRanges() const { | 1190 Ranges<TimeDelta> ChunkDemuxer::GetBufferedRanges() const { |
| 1189 if (audio_ && !video_) | 1191 if (audio_ && !video_) |
| 1190 return audio_->GetBufferedRanges(duration_); | 1192 return audio_->GetBufferedRanges(duration_); |
| 1191 else if (!audio_ && video_) | 1193 else if (!audio_ && video_) |
| 1192 return video_->GetBufferedRanges(duration_); | 1194 return video_->GetBufferedRanges(duration_); |
| 1193 return ComputeIntersection(); | 1195 return ComputeIntersection(); |
| 1194 } | 1196 } |
| 1195 | 1197 |
| 1196 } // namespace media | 1198 } // namespace media |
| OLD | NEW |