Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(957)

Unified Diff: Source/core/layout/LayoutMediaControls.cpp

Issue 982553002: Paint buffered range closest to the current play position (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Formatting fixup Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/layout/LayoutMediaControls.cpp
diff --git a/Source/core/layout/LayoutMediaControls.cpp b/Source/core/layout/LayoutMediaControls.cpp
index 4c1a2c4faa321772a3456c4801fb9f5e4ec918e5..dc4f4c78579cab755af7d230c2039646c92080d3 100644
--- a/Source/core/layout/LayoutMediaControls.cpp
+++ b/Source/core/layout/LayoutMediaControls.cpp
@@ -39,6 +39,7 @@ namespace blink {
typedef WTF::HashMap<const char*, Image*> MediaControlImageMap;
static MediaControlImageMap* gMediaControlImageMap = 0;
+static double kCurrentTimeBufferedDelta = 1.0;
static Image* platformResource(const char* name)
{
@@ -215,7 +216,15 @@ static bool paintMediaSlider(LayoutObject* object, const PaintInfo& paintInfo, c
for (unsigned i = 0; i < bufferedTimeRanges->length(); ++i) {
float start = bufferedTimeRanges->start(i, ASSERT_NO_EXCEPTION);
float end = bufferedTimeRanges->end(i, ASSERT_NO_EXCEPTION);
- if (std::isnan(start) || std::isnan(end) || start > currentTime || end < currentTime)
+ // The delta is there to avoid corner cases when buffered
+ // ranges is out of sync with current time because of
+ // asynchronous media pipeline and current time caching in
+ // HTMLMediaElement.
+ // This is related to https://www.w3.org/Bugs/Public/show_bug.cgi?id=28125
+ // FIXME: Remove this workaround when WebMediaPlayer
+ // has an asynchronous pause interface.
+ if (std::isnan(start) || std::isnan(end)
+ || start > currentTime + kCurrentTimeBufferedDelta || end < currentTime)
continue;
int startPosition = int(start * rect.width() / duration);
int currentPosition = int(currentTime * rect.width() / duration);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698