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 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 1050 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1061 for (itr = ranges_.begin(); itr != ranges_.end(); ++itr) { | 1061 for (itr = ranges_.begin(); itr != ranges_.end(); ++itr) { |
1062 if ((*itr)->GetEndTimestamp() > duration) | 1062 if ((*itr)->GetEndTimestamp() > duration) |
1063 break; | 1063 break; |
1064 } | 1064 } |
1065 if (itr == ranges_.end()) | 1065 if (itr == ranges_.end()) |
1066 return; | 1066 return; |
1067 | 1067 |
1068 // Need to partially truncate this range. | 1068 // Need to partially truncate this range. |
1069 if ((*itr)->GetStartTimestamp() < duration) { | 1069 if ((*itr)->GetStartTimestamp() < duration) { |
1070 (*itr)->TruncateAt(duration, NULL, false); | 1070 (*itr)->TruncateAt(duration, NULL, false); |
1071 if (selected_range_ && !selected_range_->HasNextBufferPosition()) | |
acolwell GONE FROM CHROMIUM
2013/11/04 20:58:11
nit: s/selected_range_ &&/(*itr == selected_range_
Jinsuk Kim
2013/11/05 03:31:49
Done.
| |
1072 SetSelectedRange(NULL); | |
1071 ++itr; | 1073 ++itr; |
1072 } | 1074 } |
1073 | 1075 |
1074 // Delete all ranges that begin after |duration|. | 1076 // Delete all ranges that begin after |duration|. |
1075 while (itr != ranges_.end()) { | 1077 while (itr != ranges_.end()) { |
1076 // If we're about to delete the selected range, also reset the seek state. | 1078 // If we're about to delete the selected range, also reset the seek state. |
1077 DCHECK((*itr)->GetStartTimestamp() >= duration); | 1079 DCHECK((*itr)->GetStartTimestamp() >= duration); |
1078 if (*itr == selected_range_) | 1080 if (*itr == selected_range_) |
1079 ResetSeekState(); | 1081 ResetSeekState(); |
1080 DeleteAndRemoveRange(&itr); | 1082 DeleteAndRemoveRange(&itr); |
(...skipping 747 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1828 | 1830 |
1829 int SourceBufferRange::GetNextConfigId() const { | 1831 int SourceBufferRange::GetNextConfigId() const { |
1830 DCHECK(HasNextBuffer()); | 1832 DCHECK(HasNextBuffer()); |
1831 return buffers_.at(next_buffer_index_)->GetConfigId(); | 1833 return buffers_.at(next_buffer_index_)->GetConfigId(); |
1832 } | 1834 } |
1833 | 1835 |
1834 base::TimeDelta SourceBufferRange::GetNextTimestamp() const { | 1836 base::TimeDelta SourceBufferRange::GetNextTimestamp() const { |
1835 DCHECK(!buffers_.empty()); | 1837 DCHECK(!buffers_.empty()); |
1836 DCHECK(HasNextBufferPosition()); | 1838 DCHECK(HasNextBufferPosition()); |
1837 | 1839 |
1838 if (next_buffer_index_ >= static_cast<int>(buffers_.size())) { | 1840 if (next_buffer_index_ >= static_cast<int>(buffers_.size())) { |
acolwell GONE FROM CHROMIUM
2013/11/04 20:58:11
With the change above do you really need this chan
Jinsuk Kim
2013/11/05 03:31:49
Mine was already reverted. This code was already h
| |
1839 return kNoTimestamp(); | 1841 return kNoTimestamp(); |
1840 } | 1842 } |
1841 | 1843 |
1842 return buffers_.at(next_buffer_index_)->GetDecodeTimestamp(); | 1844 return buffers_.at(next_buffer_index_)->GetDecodeTimestamp(); |
1843 } | 1845 } |
1844 | 1846 |
1845 bool SourceBufferRange::HasNextBufferPosition() const { | 1847 bool SourceBufferRange::HasNextBufferPosition() const { |
1846 return next_buffer_index_ >= 0; | 1848 return next_buffer_index_ >= 0; |
1847 } | 1849 } |
1848 | 1850 |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1953 return ComputeFudgeRoom(GetApproximateDuration()); | 1955 return ComputeFudgeRoom(GetApproximateDuration()); |
1954 } | 1956 } |
1955 | 1957 |
1956 base::TimeDelta SourceBufferRange::GetApproximateDuration() const { | 1958 base::TimeDelta SourceBufferRange::GetApproximateDuration() const { |
1957 base::TimeDelta max_interbuffer_distance = interbuffer_distance_cb_.Run(); | 1959 base::TimeDelta max_interbuffer_distance = interbuffer_distance_cb_.Run(); |
1958 DCHECK(max_interbuffer_distance != kNoTimestamp()); | 1960 DCHECK(max_interbuffer_distance != kNoTimestamp()); |
1959 return max_interbuffer_distance; | 1961 return max_interbuffer_distance; |
1960 } | 1962 } |
1961 | 1963 |
1962 } // namespace media | 1964 } // namespace media |
OLD | NEW |