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 964 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
975 split_range->waiting_for_keyframe_ = true; | 975 split_range->waiting_for_keyframe_ = true; |
976 split_range->next_keyframe_timestamp_ = next_keyframe_timestamp_; | 976 split_range->next_keyframe_timestamp_ = next_keyframe_timestamp_; |
977 ResetNextBufferPosition(); | 977 ResetNextBufferPosition(); |
978 } | 978 } |
979 | 979 |
980 return split_range; | 980 return split_range; |
981 } | 981 } |
982 | 982 |
983 SourceBufferRange::KeyframeMap::iterator | 983 SourceBufferRange::KeyframeMap::iterator |
984 SourceBufferRange::GetFirstKeyframeAt(base::TimeDelta timestamp, | 984 SourceBufferRange::GetFirstKeyframeAt(base::TimeDelta timestamp, |
985 bool skip_given_timestamp) { | 985 bool skip_given_timestamp) { |
986 KeyframeMap::iterator result = keyframe_map_.lower_bound(timestamp); | 986 KeyframeMap::iterator result = keyframe_map_.lower_bound(timestamp); |
987 // lower_bound() returns the first element >= |timestamp|, so if we don't want | 987 // lower_bound() returns the first element >= |timestamp|, so if we don't want |
988 // to include keyframes == |timestamp|, we have to increment the iterator | 988 // to include keyframes == |timestamp|, we have to increment the iterator |
989 // accordingly. | 989 // accordingly. |
990 if (skip_given_timestamp && | 990 if (skip_given_timestamp && |
991 result != keyframe_map_.end() && result->first == timestamp) { | 991 result != keyframe_map_.end() && result->first == timestamp) { |
992 ++result; | 992 ++result; |
993 } | 993 } |
994 return result; | 994 return result; |
995 } | 995 } |
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1174 return 2 * GetApproximateDuration(); | 1174 return 2 * GetApproximateDuration(); |
1175 } | 1175 } |
1176 | 1176 |
1177 base::TimeDelta SourceBufferRange::GetApproximateDuration() const { | 1177 base::TimeDelta SourceBufferRange::GetApproximateDuration() const { |
1178 base::TimeDelta max_interbuffer_distance = interbuffer_distance_cb_.Run(); | 1178 base::TimeDelta max_interbuffer_distance = interbuffer_distance_cb_.Run(); |
1179 DCHECK(max_interbuffer_distance != kNoTimestamp()); | 1179 DCHECK(max_interbuffer_distance != kNoTimestamp()); |
1180 return max_interbuffer_distance; | 1180 return max_interbuffer_distance; |
1181 } | 1181 } |
1182 | 1182 |
1183 } // namespace media | 1183 } // namespace media |
OLD | NEW |