Index: media/base/pipeline.cc |
diff --git a/media/base/pipeline.cc b/media/base/pipeline.cc |
index de7098341337ff4c9807aaec23e8e9120134373b..395e664cfcc70c7a8bea6d583fc4206bfbae6848 100644 |
--- a/media/base/pipeline.cc |
+++ b/media/base/pipeline.cc |
@@ -204,11 +204,21 @@ Ranges<TimeDelta> Pipeline::GetBufferedTimeRanges() { |
Ranges<TimeDelta> time_ranges; |
if (clock_->Duration() == TimeDelta() || total_bytes_ == 0) |
return time_ranges; |
+ TimeDelta current_time = GetCurrentTime_Locked(); |
for (size_t i = 0; i < buffered_byte_ranges_.size(); ++i) { |
TimeDelta start = TimeForByteOffset_Locked(buffered_byte_ranges_.start(i)); |
TimeDelta end = TimeForByteOffset_Locked(buffered_byte_ranges_.end(i)); |
// Cap approximated buffered time at the length of the video. |
end = std::min(end, clock_->Duration()); |
+ // HACK: Extend the last range preceding the current time to include the |
+ // current time, to avoid disappearing/reappearing buffered bar. |
+ // TODO(fischman): remove this HACK when we have time-based buffered-range |
+ // tracking (http://crbug.com/133588). |
+ if ((i + 1 == buffered_byte_ranges_.size()) || |
scherkus (not reviewing)
2012/06/21 01:10:38
brackets around (i + 1) for warm fuzzy feeling ple
|
+ (current_time > start && current_time < |
+ TimeForByteOffset_Locked((buffered_byte_ranges_.start(i + 1))))) { |
+ end = std::max(end, current_time + TimeDelta::FromSeconds(1)); |
+ } |
time_ranges.Add(start, end); |
} |