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

Unified Diff: media/blink/webmediaplayer_impl.cc

Issue 533543004: WebMediaPlayerImpl should notify ended event Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase 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 | « content/renderer/media/android/webmediaplayer_android.cc ('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 75efccf7d53fba8b0573c36250d4e895e62306c6..db1583cb6a9962b885bf9e0ecdf593ce8025ca1e 100644
--- a/media/blink/webmediaplayer_impl.cc
+++ b/media/blink/webmediaplayer_impl.cc
@@ -436,6 +436,9 @@ double WebMediaPlayerImpl::duration() const {
if (ready_state_ == WebMediaPlayer::ReadyStateHaveNothing)
return std::numeric_limits<double>::quiet_NaN();
+ if (ended_)
+ return currentTime();
+
return GetPipelineDuration();
}
@@ -452,11 +455,6 @@ double WebMediaPlayerImpl::currentTime() const {
DCHECK(main_task_runner_->BelongsToCurrentThread());
DCHECK_NE(ready_state_, WebMediaPlayer::ReadyStateHaveNothing);
- // 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();
}
@@ -718,7 +716,11 @@ void WebMediaPlayerImpl::OnPipelineEnded() {
return;
ended_ = true;
- client_->timeChanged();
+
+ // If the duration in the metadata is not correct, then actual duration should
+ // be updated in blink.
+ client_->durationChanged();
+ client_->mediaEnded();
}
void WebMediaPlayerImpl::OnPipelineError(PipelineStatus error) {
« no previous file with comments | « content/renderer/media/android/webmediaplayer_android.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698