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 856 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
867 split_range->waiting_for_keyframe_ = true; | 867 split_range->waiting_for_keyframe_ = true; |
868 split_range->next_keyframe_timestamp_ = next_keyframe_timestamp_; | 868 split_range->next_keyframe_timestamp_ = next_keyframe_timestamp_; |
869 ResetNextBufferPosition(); | 869 ResetNextBufferPosition(); |
870 } | 870 } |
871 | 871 |
872 return split_range; | 872 return split_range; |
873 } | 873 } |
874 | 874 |
875 SourceBufferRange::KeyframeMap::iterator | 875 SourceBufferRange::KeyframeMap::iterator |
876 SourceBufferRange::GetFirstKeyframeAt(base::TimeDelta timestamp, | 876 SourceBufferRange::GetFirstKeyframeAt(base::TimeDelta timestamp, |
877 bool skip_given_timestamp) { | 877 bool skip_given_timestamp) { |
878 KeyframeMap::iterator result = keyframe_map_.lower_bound(timestamp); | 878 KeyframeMap::iterator result = keyframe_map_.lower_bound(timestamp); |
879 // lower_bound() returns the first element >= |timestamp|, so if we don't want | 879 // lower_bound() returns the first element >= |timestamp|, so if we don't want |
880 // to include keyframes == |timestamp|, we have to increment the iterator | 880 // to include keyframes == |timestamp|, we have to increment the iterator |
881 // accordingly. | 881 // accordingly. |
882 if (skip_given_timestamp && | 882 if (skip_given_timestamp && |
883 result != keyframe_map_.end() && result->first == timestamp) { | 883 result != keyframe_map_.end() && result->first == timestamp) { |
884 ++result; | 884 ++result; |
885 } | 885 } |
886 return result; | 886 return result; |
887 } | 887 } |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1062 return 2 * GetApproximateDuration(); | 1062 return 2 * GetApproximateDuration(); |
1063 } | 1063 } |
1064 | 1064 |
1065 base::TimeDelta SourceBufferRange::GetApproximateDuration() const { | 1065 base::TimeDelta SourceBufferRange::GetApproximateDuration() const { |
1066 base::TimeDelta max_interbuffer_distance = interbuffer_distance_cb_.Run(); | 1066 base::TimeDelta max_interbuffer_distance = interbuffer_distance_cb_.Run(); |
1067 DCHECK(max_interbuffer_distance != kNoTimestamp()); | 1067 DCHECK(max_interbuffer_distance != kNoTimestamp()); |
1068 return max_interbuffer_distance; | 1068 return max_interbuffer_distance; |
1069 } | 1069 } |
1070 | 1070 |
1071 } // namespace media | 1071 } // namespace media |
OLD | NEW |