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

Unified Diff: Source/modules/mediasource/MediaSource.cpp

Issue 733453002: Sync the documentation of seekable() with the MediaSource specification (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: one more assert Created 6 years, 1 month 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 | « LayoutTests/http/tests/media/media-source/mediasource-seekable.html ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/modules/mediasource/MediaSource.cpp
diff --git a/Source/modules/mediasource/MediaSource.cpp b/Source/modules/mediasource/MediaSource.cpp
index 99b62cc344f253800caa5fe0c4cbf958696e8fb3..084c59036ec6d030b69465cb8b03f0cd9208a28d 100644
--- a/Source/modules/mediasource/MediaSource.cpp
+++ b/Source/modules/mediasource/MediaSource.cpp
@@ -366,20 +366,25 @@ PassRefPtrWillBeRawPtr<TimeRanges> MediaSource::seekable() const
// https://dvcs.w3.org/hg/html-media/raw-file/default/media-source/media-source.html#htmlmediaelement-extensions
double sourceDuration = duration();
- // 1. If duration equals NaN then return an empty TimeRanges object.
+ // If duration equals NaN: Return an empty TimeRanges object.
if (std::isnan(sourceDuration))
return TimeRanges::create();
- // 2. If duration equals positive Infinity, then return a single range with a start time of 0 and an end time equal to the
- // highest end time reported by the HTMLMediaElement.buffered attribute.
+ // If duration equals positive Infinity:
if (sourceDuration == std::numeric_limits<double>::infinity()) {
RefPtrWillBeRawPtr<TimeRanges> buffered = m_attachedElement->buffered();
+
+ // 1. If the HTMLMediaElement.buffered attribute returns an empty TimeRanges object, then
+ // return an empty TimeRanges object and abort these steps.
if (buffered->length() == 0)
return TimeRanges::create();
+
+ // 2. Return a single range with a start time of 0 and an end time equal to the highest end
+ // time reported by the HTMLMediaElement.buffered attribute.
return TimeRanges::create(0, buffered->end(buffered->length() - 1, ASSERT_NO_EXCEPTION));
}
- // 3. Otherwise, return a single range with a start time of 0 and an end time equal to duration.
+ // 3. Otherwise: Return a single range with a start time of 0 and an end time equal to duration.
return TimeRanges::create(0, sourceDuration);
}
« no previous file with comments | « LayoutTests/http/tests/media/media-source/mediasource-seekable.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698