| 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 818 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 829 } | 829 } |
| 830 | 830 |
| 831 void ChunkDemuxer::Abort(const std::string& id) { | 831 void ChunkDemuxer::Abort(const std::string& id) { |
| 832 DVLOG(1) << "Abort(" << id << ")"; | 832 DVLOG(1) << "Abort(" << id << ")"; |
| 833 DCHECK(!id.empty()); | 833 DCHECK(!id.empty()); |
| 834 CHECK(IsValidId(id)); | 834 CHECK(IsValidId(id)); |
| 835 | 835 |
| 836 stream_parser_map_[id]->Flush(); | 836 stream_parser_map_[id]->Flush(); |
| 837 } | 837 } |
| 838 | 838 |
| 839 bool ChunkDemuxer::SetTimestampOffset(const std::string& id, double offset) { | 839 bool ChunkDemuxer::SetTimestampOffset(const std::string& id, TimeDelta offset) { |
| 840 DVLOG(1) << "SetTimestampOffset(" << id << ", " << offset << ")"; | 840 DVLOG(1) << "SetTimestampOffset(" << id << ", " << offset.InSecondsF() << ")"; |
| 841 CHECK(IsValidId(id)); | 841 CHECK(IsValidId(id)); |
| 842 | 842 |
| 843 if (!source_info_map_[id].can_update_offset) | 843 if (!source_info_map_[id].can_update_offset) |
| 844 return false; | 844 return false; |
| 845 | 845 |
| 846 TimeDelta time_offset = TimeDelta::FromMicroseconds( | 846 source_info_map_[id].timestamp_offset = offset; |
| 847 offset * base::Time::kMicrosecondsPerSecond); | |
| 848 source_info_map_[id].timestamp_offset = time_offset; | |
| 849 return true; | 847 return true; |
| 850 } | 848 } |
| 851 | 849 |
| 852 bool ChunkDemuxer::EndOfStream(PipelineStatus status) { | 850 bool ChunkDemuxer::EndOfStream(PipelineStatus status) { |
| 853 DVLOG(1) << "EndOfStream(" << status << ")"; | 851 DVLOG(1) << "EndOfStream(" << status << ")"; |
| 854 base::AutoLock auto_lock(lock_); | 852 base::AutoLock auto_lock(lock_); |
| 855 DCHECK_NE(state_, WAITING_FOR_INIT); | 853 DCHECK_NE(state_, WAITING_FOR_INIT); |
| 856 DCHECK_NE(state_, ENDED); | 854 DCHECK_NE(state_, ENDED); |
| 857 | 855 |
| 858 if (state_ == SHUTDOWN || state_ == PARSE_ERROR) | 856 if (state_ == SHUTDOWN || state_ == PARSE_ERROR) |
| (...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1190 | 1188 |
| 1191 Ranges<TimeDelta> ChunkDemuxer::GetBufferedRanges() const { | 1189 Ranges<TimeDelta> ChunkDemuxer::GetBufferedRanges() const { |
| 1192 if (audio_ && !video_) | 1190 if (audio_ && !video_) |
| 1193 return audio_->GetBufferedRanges(duration_); | 1191 return audio_->GetBufferedRanges(duration_); |
| 1194 else if (!audio_ && video_) | 1192 else if (!audio_ && video_) |
| 1195 return video_->GetBufferedRanges(duration_); | 1193 return video_->GetBufferedRanges(duration_); |
| 1196 return ComputeIntersection(); | 1194 return ComputeIntersection(); |
| 1197 } | 1195 } |
| 1198 | 1196 |
| 1199 } // namespace media | 1197 } // namespace media |
| OLD | NEW |