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/source_buffer_stream.h" | 5 #include "media/filters/source_buffer_stream.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <map> | 8 #include <map> |
9 #include <sstream> | 9 #include <sstream> |
10 | 10 |
(...skipping 1383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1394 Ranges<base::TimeDelta> SourceBufferStream::GetBufferedTime() const { | 1394 Ranges<base::TimeDelta> SourceBufferStream::GetBufferedTime() const { |
1395 Ranges<base::TimeDelta> ranges; | 1395 Ranges<base::TimeDelta> ranges; |
1396 for (RangeList::const_iterator itr = ranges_.begin(); | 1396 for (RangeList::const_iterator itr = ranges_.begin(); |
1397 itr != ranges_.end(); ++itr) { | 1397 itr != ranges_.end(); ++itr) { |
1398 ranges.Add((*itr)->GetStartTimestamp().ToPresentationTime(), | 1398 ranges.Add((*itr)->GetStartTimestamp().ToPresentationTime(), |
1399 (*itr)->GetBufferedEndTimestamp().ToPresentationTime()); | 1399 (*itr)->GetBufferedEndTimestamp().ToPresentationTime()); |
1400 } | 1400 } |
1401 return ranges; | 1401 return ranges; |
1402 } | 1402 } |
1403 | 1403 |
| 1404 base::TimeDelta SourceBufferStream::GetHighestPresentationTimestamp() const { |
| 1405 if (ranges_.empty()) |
| 1406 return base::TimeDelta(); |
| 1407 |
| 1408 // TODO(wolenetz): Report actual highest PTS here, not DTS cast to PTS. See |
| 1409 // https://crbug.com/398130. |
| 1410 return ranges_.back()->GetEndTimestamp().ToPresentationTime(); |
| 1411 } |
| 1412 |
1404 base::TimeDelta SourceBufferStream::GetBufferedDuration() const { | 1413 base::TimeDelta SourceBufferStream::GetBufferedDuration() const { |
1405 if (ranges_.empty()) | 1414 if (ranges_.empty()) |
1406 return base::TimeDelta(); | 1415 return base::TimeDelta(); |
1407 | 1416 |
1408 return ranges_.back()->GetBufferedEndTimestamp().ToPresentationTime(); | 1417 return ranges_.back()->GetBufferedEndTimestamp().ToPresentationTime(); |
1409 } | 1418 } |
1410 | 1419 |
1411 size_t SourceBufferStream::GetBufferedSize() const { | 1420 size_t SourceBufferStream::GetBufferedSize() const { |
1412 size_t ranges_size = 0; | 1421 size_t ranges_size = 0; |
1413 for (auto* range : ranges_) | 1422 for (auto* range : ranges_) |
(...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1804 return false; | 1813 return false; |
1805 | 1814 |
1806 DCHECK_NE(have_splice_buffers, have_preroll_buffer); | 1815 DCHECK_NE(have_splice_buffers, have_preroll_buffer); |
1807 splice_buffers_index_ = 0; | 1816 splice_buffers_index_ = 0; |
1808 pending_buffer_.swap(*out_buffer); | 1817 pending_buffer_.swap(*out_buffer); |
1809 pending_buffers_complete_ = false; | 1818 pending_buffers_complete_ = false; |
1810 return true; | 1819 return true; |
1811 } | 1820 } |
1812 | 1821 |
1813 } // namespace media | 1822 } // namespace media |
OLD | NEW |