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

Unified Diff: media/blink/webmediaplayer_impl.cc

Issue 599103003: Switch from WebMediaPlayer::maxTimeSeekable() to seekable() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: compile on android Created 6 years, 3 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 | « media/blink/webmediaplayer_impl.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/blink/webmediaplayer_impl.cc
diff --git a/media/blink/webmediaplayer_impl.cc b/media/blink/webmediaplayer_impl.cc
index c79ee7a93bb96921407ab543f142d1138eb36843..cd80f3ab4a568cb32eb59f4aedf8b0bdb818135d 100644
--- a/media/blink/webmediaplayer_impl.cc
+++ b/media/blink/webmediaplayer_impl.cc
@@ -484,18 +484,25 @@ blink::WebTimeRanges WebMediaPlayerImpl::buffered() const {
return ConvertToWebTimeRanges(buffered_time_ranges);
}
-double WebMediaPlayerImpl::maxTimeSeekable() const {
+blink::WebTimeRanges WebMediaPlayerImpl::seekable() const {
DCHECK(main_task_runner_->BelongsToCurrentThread());
- // If we haven't even gotten to ReadyStateHaveMetadata yet then just
- // return 0 so that the seekable range is empty.
+ // If we haven't even gotten to ReadyStateHaveMetadata yet then there
+ // are no seekable ranges.
if (ready_state_ < WebMediaPlayer::ReadyStateHaveMetadata)
- return 0.0;
+ return blink::WebTimeRanges();
// We don't support seeking in streaming media.
if (data_source_ && data_source_->IsStreaming())
- return 0.0;
- return duration();
+ return blink::WebTimeRanges();
+
+ // If we have a duration then use [0, duration] as the seekable range.
+ const double seekable_end = duration();
+ if (!seekable_end)
+ return blink::WebTimeRanges();
+
+ blink::WebTimeRange seekable_range(0.0, seekable_end);
+ return blink::WebTimeRanges(&seekable_range, 1);
}
bool WebMediaPlayerImpl::didLoadingProgress() {
« no previous file with comments | « media/blink/webmediaplayer_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698