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 #include <limits> | 9 #include <limits> |
10 | 10 |
(...skipping 727 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
738 buffer = StreamParserBuffer::CreateEOSBuffer(); | 738 buffer = StreamParserBuffer::CreateEOSBuffer(); |
739 break; | 739 break; |
740 } | 740 } |
741 | 741 |
742 base::ResetAndReturn(&read_cb_).Run(status, buffer); | 742 base::ResetAndReturn(&read_cb_).Run(status, buffer); |
743 } | 743 } |
744 | 744 |
745 ChunkDemuxer::ChunkDemuxer(const base::Closure& open_cb, | 745 ChunkDemuxer::ChunkDemuxer(const base::Closure& open_cb, |
746 const NeedKeyCB& need_key_cb, | 746 const NeedKeyCB& need_key_cb, |
747 const AddTextTrackCB& add_text_track_cb, | 747 const AddTextTrackCB& add_text_track_cb, |
| 748 const scoped_refptr<MediaLog>& media_log, |
748 const LogCB& log_cb) | 749 const LogCB& log_cb) |
749 : state_(WAITING_FOR_INIT), | 750 : state_(WAITING_FOR_INIT), |
750 cancel_next_seek_(false), | 751 cancel_next_seek_(false), |
751 host_(NULL), | 752 host_(NULL), |
752 open_cb_(open_cb), | 753 open_cb_(open_cb), |
753 need_key_cb_(need_key_cb), | 754 need_key_cb_(need_key_cb), |
754 add_text_track_cb_(add_text_track_cb), | 755 add_text_track_cb_(add_text_track_cb), |
| 756 media_log_(media_log), |
755 log_cb_(log_cb), | 757 log_cb_(log_cb), |
756 duration_(kNoTimestamp()), | 758 duration_(kNoTimestamp()), |
757 user_specified_duration_(-1) { | 759 user_specified_duration_(-1) { |
758 DCHECK(!open_cb_.is_null()); | 760 DCHECK(!open_cb_.is_null()); |
759 DCHECK(!need_key_cb_.is_null()); | 761 DCHECK(!need_key_cb_.is_null()); |
760 } | 762 } |
761 | 763 |
762 void ChunkDemuxer::Initialize(DemuxerHost* host, const PipelineStatusCB& cb) { | 764 void ChunkDemuxer::Initialize(DemuxerHost* host, const PipelineStatusCB& cb) { |
763 DVLOG(1) << "Init()"; | 765 DVLOG(1) << "Init()"; |
764 | 766 |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
876 const std::string& type, | 878 const std::string& type, |
877 std::vector<std::string>& codecs) { | 879 std::vector<std::string>& codecs) { |
878 base::AutoLock auto_lock(lock_); | 880 base::AutoLock auto_lock(lock_); |
879 | 881 |
880 if ((state_ != WAITING_FOR_INIT && state_ != INITIALIZING) || IsValidId(id)) | 882 if ((state_ != WAITING_FOR_INIT && state_ != INITIALIZING) || IsValidId(id)) |
881 return kReachedIdLimit; | 883 return kReachedIdLimit; |
882 | 884 |
883 bool has_audio = false; | 885 bool has_audio = false; |
884 bool has_video = false; | 886 bool has_video = false; |
885 scoped_ptr<media::StreamParser> stream_parser( | 887 scoped_ptr<media::StreamParser> stream_parser( |
886 StreamParserFactory::Create(type, codecs, log_cb_, | 888 StreamParserFactory::Create(type, codecs, media_log_, log_cb_, |
887 &has_audio, &has_video)); | 889 &has_audio, &has_video)); |
888 | 890 |
889 if (!stream_parser) | 891 if (!stream_parser) |
890 return ChunkDemuxer::kNotSupported; | 892 return ChunkDemuxer::kNotSupported; |
891 | 893 |
892 if ((has_audio && !source_id_audio_.empty()) || | 894 if ((has_audio && !source_id_audio_.empty()) || |
893 (has_video && !source_id_video_.empty())) | 895 (has_video && !source_id_video_.empty())) |
894 return kReachedIdLimit; | 896 return kReachedIdLimit; |
895 | 897 |
896 if (has_audio) | 898 if (has_audio) |
(...skipping 558 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1455 | 1457 |
1456 void ChunkDemuxer::CompletePendingReadsIfPossible() { | 1458 void ChunkDemuxer::CompletePendingReadsIfPossible() { |
1457 if (audio_) | 1459 if (audio_) |
1458 audio_->CompletePendingReadIfPossible(); | 1460 audio_->CompletePendingReadIfPossible(); |
1459 | 1461 |
1460 if (video_) | 1462 if (video_) |
1461 video_->CompletePendingReadIfPossible(); | 1463 video_->CompletePendingReadIfPossible(); |
1462 } | 1464 } |
1463 | 1465 |
1464 } // namespace media | 1466 } // namespace media |
OLD | NEW |