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 "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 return true; | 132 return true; |
133 } | 133 } |
134 } | 134 } |
135 | 135 |
136 // |type| didn't match any of the supported types. | 136 // |type| didn't match any of the supported types. |
137 return false; | 137 return false; |
138 } | 138 } |
139 | 139 |
140 class ChunkDemuxerStream : public DemuxerStream { | 140 class ChunkDemuxerStream : public DemuxerStream { |
141 public: | 141 public: |
| 142 // Only present in 1180 branch to fix compile breakage; stubbed out. |
| 143 virtual Ranges<base::TimeDelta> GetBufferedRanges() OVERRIDE; |
| 144 |
142 typedef std::deque<scoped_refptr<StreamParserBuffer> > BufferQueue; | 145 typedef std::deque<scoped_refptr<StreamParserBuffer> > BufferQueue; |
143 typedef std::deque<ReadCB> ReadCBQueue; | 146 typedef std::deque<ReadCB> ReadCBQueue; |
144 typedef std::deque<base::Closure> ClosureQueue; | 147 typedef std::deque<base::Closure> ClosureQueue; |
145 | 148 |
146 explicit ChunkDemuxerStream(const AudioDecoderConfig& audio_config); | 149 explicit ChunkDemuxerStream(const AudioDecoderConfig& audio_config); |
147 explicit ChunkDemuxerStream(const VideoDecoderConfig& video_config); | 150 explicit ChunkDemuxerStream(const VideoDecoderConfig& video_config); |
148 | 151 |
149 void StartWaitingForSeek(); | 152 void StartWaitingForSeek(); |
150 void Seek(base::TimeDelta time); | 153 void Seek(base::TimeDelta time); |
151 bool IsSeekPending() const; | 154 bool IsSeekPending() const; |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
210 State state_; | 213 State state_; |
211 ReadCBQueue read_cbs_; | 214 ReadCBQueue read_cbs_; |
212 | 215 |
213 // The timestamp of the current media segment being parsed by | 216 // The timestamp of the current media segment being parsed by |
214 // |stream_parser_|. | 217 // |stream_parser_|. |
215 base::TimeDelta media_segment_start_time_; | 218 base::TimeDelta media_segment_start_time_; |
216 | 219 |
217 DISALLOW_IMPLICIT_CONSTRUCTORS(ChunkDemuxerStream); | 220 DISALLOW_IMPLICIT_CONSTRUCTORS(ChunkDemuxerStream); |
218 }; | 221 }; |
219 | 222 |
| 223 Ranges<base::TimeDelta> ChunkDemuxerStream::GetBufferedRanges() { |
| 224 return Ranges<base::TimeDelta>(); |
| 225 } |
| 226 |
220 ChunkDemuxerStream::ChunkDemuxerStream(const AudioDecoderConfig& audio_config) | 227 ChunkDemuxerStream::ChunkDemuxerStream(const AudioDecoderConfig& audio_config) |
221 : type_(AUDIO), | 228 : type_(AUDIO), |
222 state_(RETURNING_DATA_FOR_READS), | 229 state_(RETURNING_DATA_FOR_READS), |
223 media_segment_start_time_(kNoTimestamp()) { | 230 media_segment_start_time_(kNoTimestamp()) { |
224 stream_.reset(new SourceBufferStream(audio_config)); | 231 stream_.reset(new SourceBufferStream(audio_config)); |
225 } | 232 } |
226 | 233 |
227 ChunkDemuxerStream::ChunkDemuxerStream(const VideoDecoderConfig& video_config) | 234 ChunkDemuxerStream::ChunkDemuxerStream(const VideoDecoderConfig& video_config) |
228 : type_(VIDEO), | 235 : type_(VIDEO), |
229 state_(RETURNING_DATA_FOR_READS) { | 236 state_(RETURNING_DATA_FOR_READS) { |
(...skipping 798 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1028 // TODO(vrk): There should be a special case for the first appends where all | 1035 // TODO(vrk): There should be a special case for the first appends where all |
1029 // streams (for both demuxed and muxed case) begin at the earliest stream | 1036 // streams (for both demuxed and muxed case) begin at the earliest stream |
1030 // timestamp. (crbug.com/132815) | 1037 // timestamp. (crbug.com/132815) |
1031 if (audio_ && source_id == source_id_audio_) | 1038 if (audio_ && source_id == source_id_audio_) |
1032 audio_->OnNewMediaSegment(start_timestamp); | 1039 audio_->OnNewMediaSegment(start_timestamp); |
1033 if (video_ && source_id == source_id_video_) | 1040 if (video_ && source_id == source_id_video_) |
1034 video_->OnNewMediaSegment(start_timestamp); | 1041 video_->OnNewMediaSegment(start_timestamp); |
1035 } | 1042 } |
1036 | 1043 |
1037 } // namespace media | 1044 } // namespace media |
OLD | NEW |