Commit b0e6f3fc authored by philipj's avatar philipj Committed by Commit bot

Switch from WebMediaPlayer::maxTimeSeekable() to seekable()

BUG=417669

Review URL: https://codereview.chromium.org/599103003

Cr-Commit-Position: refs/heads/master@{#297395}
parent bf24e5ea
...@@ -64,7 +64,6 @@ static const int kSDKVersionToSupportSecurityOriginCheck = 20; ...@@ -64,7 +64,6 @@ static const int kSDKVersionToSupportSecurityOriginCheck = 20;
using blink::WebMediaPlayer; using blink::WebMediaPlayer;
using blink::WebSize; using blink::WebSize;
using blink::WebString; using blink::WebString;
using blink::WebTimeRanges;
using blink::WebURL; using blink::WebURL;
using gpu::gles2::GLES2Interface; using gpu::gles2::GLES2Interface;
using media::MediaPlayerAndroid; using media::MediaPlayerAndroid;
...@@ -514,19 +513,25 @@ WebMediaPlayer::ReadyState WebMediaPlayerAndroid::readyState() const { ...@@ -514,19 +513,25 @@ WebMediaPlayer::ReadyState WebMediaPlayerAndroid::readyState() const {
return ready_state_; return ready_state_;
} }
WebTimeRanges WebMediaPlayerAndroid::buffered() const { blink::WebTimeRanges WebMediaPlayerAndroid::buffered() const {
if (media_source_delegate_) if (media_source_delegate_)
return media_source_delegate_->Buffered(); return media_source_delegate_->Buffered();
return buffered_; return buffered_;
} }
double WebMediaPlayerAndroid::maxTimeSeekable() const { blink::WebTimeRanges WebMediaPlayerAndroid::seekable() const {
// If we haven't even gotten to ReadyStateHaveMetadata yet then just // If we haven't even gotten to ReadyStateHaveMetadata yet then there
// return 0 so that the seekable range is empty. // are no seekable ranges.
if (ready_state_ < WebMediaPlayer::ReadyStateHaveMetadata) if (ready_state_ < WebMediaPlayer::ReadyStateHaveMetadata)
return 0.0; return blink::WebTimeRanges();
return duration(); // 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 WebMediaPlayerAndroid::didLoadingProgress() { bool WebMediaPlayerAndroid::didLoadingProgress() {
......
...@@ -112,7 +112,7 @@ class WebMediaPlayerAndroid : public blink::WebMediaPlayer, ...@@ -112,7 +112,7 @@ class WebMediaPlayerAndroid : public blink::WebMediaPlayer,
virtual void requestRemotePlayback(); virtual void requestRemotePlayback();
virtual void requestRemotePlaybackControl(); virtual void requestRemotePlaybackControl();
virtual blink::WebTimeRanges buffered() const; virtual blink::WebTimeRanges buffered() const;
virtual double maxTimeSeekable() const; virtual blink::WebTimeRanges seekable() const;
// Poster image, as defined in the <video> element. // Poster image, as defined in the <video> element.
virtual void setPoster(const blink::WebURL& poster) OVERRIDE; virtual void setPoster(const blink::WebURL& poster) OVERRIDE;
......
...@@ -309,9 +309,9 @@ blink::WebTimeRanges WebMediaPlayerMS::buffered() const { ...@@ -309,9 +309,9 @@ blink::WebTimeRanges WebMediaPlayerMS::buffered() const {
return buffered_; return buffered_;
} }
double WebMediaPlayerMS::maxTimeSeekable() const { blink::WebTimeRanges WebMediaPlayerMS::seekable() const {
DCHECK(thread_checker_.CalledOnValidThread()); DCHECK(thread_checker_.CalledOnValidThread());
return 0.0; return blink::WebTimeRanges();
} }
bool WebMediaPlayerMS::didLoadingProgress() { bool WebMediaPlayerMS::didLoadingProgress() {
......
...@@ -76,7 +76,7 @@ class WebMediaPlayerMS ...@@ -76,7 +76,7 @@ class WebMediaPlayerMS
virtual void setVolume(double volume); virtual void setVolume(double volume);
virtual void setPreload(blink::WebMediaPlayer::Preload preload); virtual void setPreload(blink::WebMediaPlayer::Preload preload);
virtual blink::WebTimeRanges buffered() const; virtual blink::WebTimeRanges buffered() const;
virtual double maxTimeSeekable() const; virtual blink::WebTimeRanges seekable() const;
// Methods for painting. // Methods for painting.
virtual void paint(blink::WebCanvas* canvas, virtual void paint(blink::WebCanvas* canvas,
......
...@@ -484,18 +484,25 @@ blink::WebTimeRanges WebMediaPlayerImpl::buffered() const { ...@@ -484,18 +484,25 @@ blink::WebTimeRanges WebMediaPlayerImpl::buffered() const {
return ConvertToWebTimeRanges(buffered_time_ranges); return ConvertToWebTimeRanges(buffered_time_ranges);
} }
double WebMediaPlayerImpl::maxTimeSeekable() const { blink::WebTimeRanges WebMediaPlayerImpl::seekable() const {
DCHECK(main_task_runner_->BelongsToCurrentThread()); DCHECK(main_task_runner_->BelongsToCurrentThread());
// If we haven't even gotten to ReadyStateHaveMetadata yet then just // If we haven't even gotten to ReadyStateHaveMetadata yet then there
// return 0 so that the seekable range is empty. // are no seekable ranges.
if (ready_state_ < WebMediaPlayer::ReadyStateHaveMetadata) if (ready_state_ < WebMediaPlayer::ReadyStateHaveMetadata)
return 0.0; return blink::WebTimeRanges();
// We don't support seeking in streaming media. // We don't support seeking in streaming media.
if (data_source_ && data_source_->IsStreaming()) if (data_source_ && data_source_->IsStreaming())
return 0.0; return blink::WebTimeRanges();
return duration();
// 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() { bool WebMediaPlayerImpl::didLoadingProgress() {
......
...@@ -83,7 +83,7 @@ class MEDIA_EXPORT WebMediaPlayerImpl ...@@ -83,7 +83,7 @@ class MEDIA_EXPORT WebMediaPlayerImpl
virtual void setVolume(double volume); virtual void setVolume(double volume);
virtual void setPreload(blink::WebMediaPlayer::Preload preload); virtual void setPreload(blink::WebMediaPlayer::Preload preload);
virtual blink::WebTimeRanges buffered() const; virtual blink::WebTimeRanges buffered() const;
virtual double maxTimeSeekable() const; virtual blink::WebTimeRanges seekable() const;
// Methods for painting. // Methods for painting.
virtual void paint(blink::WebCanvas* canvas, virtual void paint(blink::WebCanvas* canvas,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment