| 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 1036 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1047 for (itr = ranges_.begin(); itr != ranges_.end(); ++itr) { | 1047 for (itr = ranges_.begin(); itr != ranges_.end(); ++itr) { |
| 1048 if ((*itr)->GetEndTimestamp() > duration) | 1048 if ((*itr)->GetEndTimestamp() > duration) |
| 1049 break; | 1049 break; |
| 1050 } | 1050 } |
| 1051 if (itr == ranges_.end()) | 1051 if (itr == ranges_.end()) |
| 1052 return; | 1052 return; |
| 1053 | 1053 |
| 1054 // Need to partially truncate this range. | 1054 // Need to partially truncate this range. |
| 1055 if ((*itr)->GetStartTimestamp() < duration) { | 1055 if ((*itr)->GetStartTimestamp() < duration) { |
| 1056 (*itr)->TruncateAt(duration, NULL, false); | 1056 (*itr)->TruncateAt(duration, NULL, false); |
| 1057 if ((*itr == selected_range_) && !selected_range_->HasNextBufferPosition()) |
| 1058 SetSelectedRange(NULL); |
| 1057 ++itr; | 1059 ++itr; |
| 1058 } | 1060 } |
| 1059 | 1061 |
| 1060 // Delete all ranges that begin after |duration|. | 1062 // Delete all ranges that begin after |duration|. |
| 1061 while (itr != ranges_.end()) { | 1063 while (itr != ranges_.end()) { |
| 1062 // If we're about to delete the selected range, also reset the seek state. | 1064 // If we're about to delete the selected range, also reset the seek state. |
| 1063 DCHECK((*itr)->GetStartTimestamp() >= duration); | 1065 DCHECK((*itr)->GetStartTimestamp() >= duration); |
| 1064 if (*itr == selected_range_) | 1066 if (*itr == selected_range_) |
| 1065 ResetSeekState(); | 1067 ResetSeekState(); |
| 1066 DeleteAndRemoveRange(&itr); | 1068 DeleteAndRemoveRange(&itr); |
| (...skipping 883 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1950 return ComputeFudgeRoom(GetApproximateDuration()); | 1952 return ComputeFudgeRoom(GetApproximateDuration()); |
| 1951 } | 1953 } |
| 1952 | 1954 |
| 1953 base::TimeDelta SourceBufferRange::GetApproximateDuration() const { | 1955 base::TimeDelta SourceBufferRange::GetApproximateDuration() const { |
| 1954 base::TimeDelta max_interbuffer_distance = interbuffer_distance_cb_.Run(); | 1956 base::TimeDelta max_interbuffer_distance = interbuffer_distance_cb_.Run(); |
| 1955 DCHECK(max_interbuffer_distance != kNoTimestamp()); | 1957 DCHECK(max_interbuffer_distance != kNoTimestamp()); |
| 1956 return max_interbuffer_distance; | 1958 return max_interbuffer_distance; |
| 1957 } | 1959 } |
| 1958 | 1960 |
| 1959 } // namespace media | 1961 } // namespace media |
| OLD | NEW |