| 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 <limits> | 8 #include <limits> |
| 9 #include <list> | 9 #include <list> |
| 10 | 10 |
| (...skipping 956 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 967 bool splice_frames_enabled) | 967 bool splice_frames_enabled) |
| 968 : state_(WAITING_FOR_INIT), | 968 : state_(WAITING_FOR_INIT), |
| 969 cancel_next_seek_(false), | 969 cancel_next_seek_(false), |
| 970 host_(NULL), | 970 host_(NULL), |
| 971 open_cb_(open_cb), | 971 open_cb_(open_cb), |
| 972 need_key_cb_(need_key_cb), | 972 need_key_cb_(need_key_cb), |
| 973 enable_text_(false), | 973 enable_text_(false), |
| 974 log_cb_(log_cb), | 974 log_cb_(log_cb), |
| 975 duration_(kNoTimestamp()), | 975 duration_(kNoTimestamp()), |
| 976 user_specified_duration_(-1), | 976 user_specified_duration_(-1), |
| 977 liveness_(LIVENESS_UNKNOWN), |
| 977 splice_frames_enabled_(splice_frames_enabled) { | 978 splice_frames_enabled_(splice_frames_enabled) { |
| 978 DCHECK(!open_cb_.is_null()); | 979 DCHECK(!open_cb_.is_null()); |
| 979 DCHECK(!need_key_cb_.is_null()); | 980 DCHECK(!need_key_cb_.is_null()); |
| 980 } | 981 } |
| 981 | 982 |
| 982 void ChunkDemuxer::Initialize( | 983 void ChunkDemuxer::Initialize( |
| 983 DemuxerHost* host, | 984 DemuxerHost* host, |
| 984 const PipelineStatusCB& cb, | 985 const PipelineStatusCB& cb, |
| 985 bool enable_text_tracks) { | 986 bool enable_text_tracks) { |
| 986 DVLOG(1) << "Init()"; | 987 DVLOG(1) << "Init()"; |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1057 } | 1058 } |
| 1058 | 1059 |
| 1059 TimeDelta ChunkDemuxer::GetStartTime() const { | 1060 TimeDelta ChunkDemuxer::GetStartTime() const { |
| 1060 return TimeDelta(); | 1061 return TimeDelta(); |
| 1061 } | 1062 } |
| 1062 | 1063 |
| 1063 base::Time ChunkDemuxer::GetTimelineOffset() const { | 1064 base::Time ChunkDemuxer::GetTimelineOffset() const { |
| 1064 return timeline_offset_; | 1065 return timeline_offset_; |
| 1065 } | 1066 } |
| 1066 | 1067 |
| 1068 Demuxer::Liveness ChunkDemuxer::GetLiveness() const { |
| 1069 return liveness_; |
| 1070 } |
| 1071 |
| 1067 void ChunkDemuxer::StartWaitingForSeek(TimeDelta seek_time) { | 1072 void ChunkDemuxer::StartWaitingForSeek(TimeDelta seek_time) { |
| 1068 DVLOG(1) << "StartWaitingForSeek()"; | 1073 DVLOG(1) << "StartWaitingForSeek()"; |
| 1069 base::AutoLock auto_lock(lock_); | 1074 base::AutoLock auto_lock(lock_); |
| 1070 DCHECK(state_ == INITIALIZED || state_ == ENDED || state_ == SHUTDOWN || | 1075 DCHECK(state_ == INITIALIZED || state_ == ENDED || state_ == SHUTDOWN || |
| 1071 state_ == PARSE_ERROR) << state_; | 1076 state_ == PARSE_ERROR) << state_; |
| 1072 DCHECK(seek_cb_.is_null()); | 1077 DCHECK(seek_cb_.is_null()); |
| 1073 | 1078 |
| 1074 if (state_ == SHUTDOWN || state_ == PARSE_ERROR) | 1079 if (state_ == SHUTDOWN || state_ == PARSE_ERROR) |
| 1075 return; | 1080 return; |
| 1076 | 1081 |
| (...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1501 params.timeline_offset != timeline_offset_) { | 1506 params.timeline_offset != timeline_offset_) { |
| 1502 MEDIA_LOG(log_cb_) | 1507 MEDIA_LOG(log_cb_) |
| 1503 << "Timeline offset is not the same across all SourceBuffers."; | 1508 << "Timeline offset is not the same across all SourceBuffers."; |
| 1504 ReportError_Locked(DEMUXER_ERROR_COULD_NOT_OPEN); | 1509 ReportError_Locked(DEMUXER_ERROR_COULD_NOT_OPEN); |
| 1505 return; | 1510 return; |
| 1506 } | 1511 } |
| 1507 | 1512 |
| 1508 timeline_offset_ = params.timeline_offset; | 1513 timeline_offset_ = params.timeline_offset; |
| 1509 } | 1514 } |
| 1510 | 1515 |
| 1516 if (params.liveness != LIVENESS_UNKNOWN) { |
| 1517 if (liveness_ != LIVENESS_UNKNOWN && params.liveness != liveness_) { |
| 1518 MEDIA_LOG(log_cb_) |
| 1519 << "Liveness is not the same across all SourceBuffers."; |
| 1520 ReportError_Locked(DEMUXER_ERROR_COULD_NOT_OPEN); |
| 1521 return; |
| 1522 } |
| 1523 |
| 1524 liveness_ = params.liveness; |
| 1525 } |
| 1526 |
| 1511 // Wait until all streams have initialized. | 1527 // Wait until all streams have initialized. |
| 1512 if ((!source_id_audio_.empty() && !audio_) || | 1528 if ((!source_id_audio_.empty() && !audio_) || |
| 1513 (!source_id_video_.empty() && !video_)) { | 1529 (!source_id_video_.empty() && !video_)) { |
| 1514 return; | 1530 return; |
| 1515 } | 1531 } |
| 1516 | 1532 |
| 1517 SeekAllSources(GetStartTime()); | 1533 SeekAllSources(GetStartTime()); |
| 1518 StartReturningData(); | 1534 StartReturningData(); |
| 1519 | 1535 |
| 1520 if (duration_ == kNoTimestamp()) | 1536 if (duration_ == kNoTimestamp()) |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1654 } | 1670 } |
| 1655 | 1671 |
| 1656 void ChunkDemuxer::ShutdownAllStreams() { | 1672 void ChunkDemuxer::ShutdownAllStreams() { |
| 1657 for (SourceStateMap::iterator itr = source_state_map_.begin(); | 1673 for (SourceStateMap::iterator itr = source_state_map_.begin(); |
| 1658 itr != source_state_map_.end(); ++itr) { | 1674 itr != source_state_map_.end(); ++itr) { |
| 1659 itr->second->Shutdown(); | 1675 itr->second->Shutdown(); |
| 1660 } | 1676 } |
| 1661 } | 1677 } |
| 1662 | 1678 |
| 1663 } // namespace media | 1679 } // namespace media |
| OLD | NEW |