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

Unified Diff: content/renderer/media/webmediaplayer_impl.cc

Issue 526443003: Have WebMediaPlayerImpl track ended state. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 4 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 | « content/renderer/media/webmediaplayer_impl.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/media/webmediaplayer_impl.cc
diff --git a/content/renderer/media/webmediaplayer_impl.cc b/content/renderer/media/webmediaplayer_impl.cc
index 5b1cf2bdeb3e7ebb26dce33351f2ec07533c498c..6db95e7277843ced8655598b7027666a203721ab 100644
--- a/content/renderer/media/webmediaplayer_impl.cc
+++ b/content/renderer/media/webmediaplayer_impl.cc
@@ -155,6 +155,7 @@ WebMediaPlayerImpl::WebMediaPlayerImpl(
paused_(true),
seeking_(false),
playback_rate_(0.0f),
+ ended_(false),
pending_seek_(false),
pending_seek_seconds_(0.0f),
should_notify_time_changed_(false),
@@ -312,6 +313,8 @@ void WebMediaPlayerImpl::seek(double seconds) {
DVLOG(1) << __FUNCTION__ << "(" << seconds << ")";
DCHECK(main_task_runner_->BelongsToCurrentThread());
+ ended_ = false;
+
if (ready_state_ > WebMediaPlayer::ReadyStateHaveMetadata)
SetReadyState(WebMediaPlayer::ReadyStateHaveMetadata);
@@ -445,6 +448,12 @@ double WebMediaPlayerImpl::timelineOffset() const {
double WebMediaPlayerImpl::currentTime() const {
DCHECK(main_task_runner_->BelongsToCurrentThread());
+
acolwell GONE FROM CHROMIUM 2014/08/30 01:00:28 nit: Add a DCHECK here to make sure you are never
scherkus (not reviewing) 2014/09/02 20:58:25 Sadly Blink does call this when we HAVE_NOTHING du
+ // TODO(scherkus): Replace with an explicit ended signal to HTMLMediaElement,
+ // see http://crbug.com/409280
+ if (ended_)
+ return duration();
+
return (paused_ ? paused_time_ : pipeline_.GetMediaTime()).InSecondsF();
}
@@ -700,6 +709,7 @@ void WebMediaPlayerImpl::OnPipelineSeeked(bool time_changed,
void WebMediaPlayerImpl::OnPipelineEnded() {
DVLOG(1) << __FUNCTION__;
DCHECK(main_task_runner_->BelongsToCurrentThread());
+ ended_ = true;
acolwell GONE FROM CHROMIUM 2014/08/30 01:00:28 I don't think you can blindly update it here. At a
scherkus (not reviewing) 2014/09/02 20:58:25 Good catch -- done. We have a similar check in OnB
client_->timeChanged();
}
« no previous file with comments | « content/renderer/media/webmediaplayer_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698