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 543 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
554 need_key_cb_(need_key_cb), | 554 need_key_cb_(need_key_cb), |
555 log_cb_(log_cb) { | 555 log_cb_(log_cb) { |
556 DCHECK(!open_cb_.is_null()); | 556 DCHECK(!open_cb_.is_null()); |
557 DCHECK(!need_key_cb_.is_null()); | 557 DCHECK(!need_key_cb_.is_null()); |
558 } | 558 } |
559 | 559 |
560 void ChunkDemuxer::Initialize(DemuxerHost* host, const PipelineStatusCB& cb) { | 560 void ChunkDemuxer::Initialize(DemuxerHost* host, const PipelineStatusCB& cb) { |
561 DVLOG(1) << "Init()"; | 561 DVLOG(1) << "Init()"; |
562 | 562 |
563 base::AutoLock auto_lock(lock_); | 563 base::AutoLock auto_lock(lock_); |
| 564 |
| 565 if (state_ == SHUTDOWN) { |
| 566 base::MessageLoopProxy::current()->PostTask(FROM_HERE, base::Bind( |
| 567 cb, DEMUXER_ERROR_COULD_NOT_OPEN)); |
| 568 return; |
| 569 } |
564 DCHECK_EQ(state_, WAITING_FOR_INIT); | 570 DCHECK_EQ(state_, WAITING_FOR_INIT); |
565 host_ = host; | 571 host_ = host; |
566 | 572 |
567 ChangeState_Locked(INITIALIZING); | 573 ChangeState_Locked(INITIALIZING); |
568 init_cb_ = cb; | 574 init_cb_ = cb; |
569 | 575 |
570 base::ResetAndReturn(&open_cb_).Run(); | 576 base::ResetAndReturn(&open_cb_).Run(); |
571 } | 577 } |
572 | 578 |
573 void ChunkDemuxer::Stop(const base::Closure& callback) { | 579 void ChunkDemuxer::Stop(const base::Closure& callback) { |
(...skipping 666 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1240 | 1246 |
1241 Ranges<TimeDelta> ChunkDemuxer::GetBufferedRanges() const { | 1247 Ranges<TimeDelta> ChunkDemuxer::GetBufferedRanges() const { |
1242 if (audio_ && !video_) | 1248 if (audio_ && !video_) |
1243 return audio_->GetBufferedRanges(duration_); | 1249 return audio_->GetBufferedRanges(duration_); |
1244 else if (!audio_ && video_) | 1250 else if (!audio_ && video_) |
1245 return video_->GetBufferedRanges(duration_); | 1251 return video_->GetBufferedRanges(duration_); |
1246 return ComputeIntersection(); | 1252 return ComputeIntersection(); |
1247 } | 1253 } |
1248 | 1254 |
1249 } // namespace media | 1255 } // namespace media |
OLD | NEW |