| 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 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 273 | 273 |
| 274 void SourceState::AdjustBufferTimestamps( | 274 void SourceState::AdjustBufferTimestamps( |
| 275 const StreamParser::BufferQueue& buffers) { | 275 const StreamParser::BufferQueue& buffers) { |
| 276 if (timestamp_offset_ == TimeDelta()) | 276 if (timestamp_offset_ == TimeDelta()) |
| 277 return; | 277 return; |
| 278 | 278 |
| 279 for (StreamParser::BufferQueue::const_iterator itr = buffers.begin(); | 279 for (StreamParser::BufferQueue::const_iterator itr = buffers.begin(); |
| 280 itr != buffers.end(); ++itr) { | 280 itr != buffers.end(); ++itr) { |
| 281 (*itr)->SetDecodeTimestamp( | 281 (*itr)->SetDecodeTimestamp( |
| 282 (*itr)->GetDecodeTimestamp() + timestamp_offset_); | 282 (*itr)->GetDecodeTimestamp() + timestamp_offset_); |
| 283 (*itr)->SetTimestamp((*itr)->GetTimestamp() + timestamp_offset_); | 283 (*itr)->set_timestamp((*itr)->timestamp() + timestamp_offset_); |
| 284 } | 284 } |
| 285 } | 285 } |
| 286 | 286 |
| 287 bool SourceState::OnNewConfigs(bool allow_audio, bool allow_video, | 287 bool SourceState::OnNewConfigs(bool allow_audio, bool allow_video, |
| 288 const AudioDecoderConfig& audio_config, | 288 const AudioDecoderConfig& audio_config, |
| 289 const VideoDecoderConfig& video_config) { | 289 const VideoDecoderConfig& video_config) { |
| 290 DVLOG(1) << "OnNewConfigs(" << allow_audio << ", " << allow_video | 290 DVLOG(1) << "OnNewConfigs(" << allow_audio << ", " << allow_video |
| 291 << ", " << audio_config.IsValidConfig() | 291 << ", " << audio_config.IsValidConfig() |
| 292 << ", " << video_config.IsValidConfig() << ")"; | 292 << ", " << video_config.IsValidConfig() << ")"; |
| 293 | 293 |
| (...skipping 905 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1199 TextTrack* text_track, | 1199 TextTrack* text_track, |
| 1200 const StreamParser::BufferQueue& buffers) { | 1200 const StreamParser::BufferQueue& buffers) { |
| 1201 lock_.AssertAcquired(); | 1201 lock_.AssertAcquired(); |
| 1202 DCHECK_NE(state_, SHUTDOWN); | 1202 DCHECK_NE(state_, SHUTDOWN); |
| 1203 | 1203 |
| 1204 // TODO(matthewjheaney): IncreaseDurationIfNecessary | 1204 // TODO(matthewjheaney): IncreaseDurationIfNecessary |
| 1205 | 1205 |
| 1206 for (StreamParser::BufferQueue::const_iterator itr = buffers.begin(); | 1206 for (StreamParser::BufferQueue::const_iterator itr = buffers.begin(); |
| 1207 itr != buffers.end(); ++itr) { | 1207 itr != buffers.end(); ++itr) { |
| 1208 const StreamParserBuffer* const buffer = itr->get(); | 1208 const StreamParserBuffer* const buffer = itr->get(); |
| 1209 const TimeDelta start = buffer->GetTimestamp(); | 1209 const TimeDelta start = buffer->timestamp(); |
| 1210 const TimeDelta end = start + buffer->GetDuration(); | 1210 const TimeDelta end = start + buffer->duration(); |
| 1211 | 1211 |
| 1212 std::string id, settings, content; | 1212 std::string id, settings, content; |
| 1213 | 1213 |
| 1214 WebMWebVTTParser::Parse(buffer->GetData(), | 1214 WebMWebVTTParser::Parse(buffer->data(), |
| 1215 buffer->GetDataSize(), | 1215 buffer->data_size(), |
| 1216 &id, &settings, &content); | 1216 &id, &settings, &content); |
| 1217 | 1217 |
| 1218 text_track->addWebVTTCue(start, end, id, content, settings); | 1218 text_track->addWebVTTCue(start, end, id, content, settings); |
| 1219 } | 1219 } |
| 1220 | 1220 |
| 1221 return true; | 1221 return true; |
| 1222 } | 1222 } |
| 1223 | 1223 |
| 1224 void ChunkDemuxer::OnNewMediaSegment(const std::string& source_id, | 1224 void ChunkDemuxer::OnNewMediaSegment(const std::string& source_id, |
| 1225 TimeDelta timestamp) { | 1225 TimeDelta timestamp) { |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1274 | 1274 |
| 1275 Ranges<TimeDelta> ChunkDemuxer::GetBufferedRanges() const { | 1275 Ranges<TimeDelta> ChunkDemuxer::GetBufferedRanges() const { |
| 1276 if (audio_ && !video_) | 1276 if (audio_ && !video_) |
| 1277 return audio_->GetBufferedRanges(duration_); | 1277 return audio_->GetBufferedRanges(duration_); |
| 1278 else if (!audio_ && video_) | 1278 else if (!audio_ && video_) |
| 1279 return video_->GetBufferedRanges(duration_); | 1279 return video_->GetBufferedRanges(duration_); |
| 1280 return ComputeIntersection(); | 1280 return ComputeIntersection(); |
| 1281 } | 1281 } |
| 1282 | 1282 |
| 1283 } // namespace media | 1283 } // namespace media |
| OLD | NEW |