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

Unified Diff: media/blink/webmediaplayer_impl.cc

Issue 843863002: Revert current time clamp on ended; clamp paused time instead. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add comment. Created 5 years, 11 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 4b67c9d6ff347ca5db6484867903734d545be079..79324432bda15791083204260aee8fed5adc3c73 100644
--- a/media/blink/webmediaplayer_impl.cc
+++ b/media/blink/webmediaplayer_impl.cc
@@ -273,7 +273,7 @@ void WebMediaPlayerImpl::pause() {
pipeline_.SetPlaybackRate(0.0f);
if (data_source_)
data_source_->MediaIsPaused();
- paused_time_ = pipeline_.GetMediaTime();
+ UpdatePausedTime();
media_log_->AddEvent(media_log_->CreateEvent(MediaLogEvent::PAUSE));
@@ -713,7 +713,7 @@ void WebMediaPlayerImpl::OnPipelineSeeked(bool time_changed,
// Update our paused time.
if (paused_)
- paused_time_ = pipeline_.GetMediaTime();
+ UpdatePausedTime();
should_notify_time_changed_ = time_changed;
}
@@ -993,4 +993,15 @@ WebMediaPlayerImpl::GetCurrentFrameFromCompositor() {
return video_frame;
}
+void WebMediaPlayerImpl::UpdatePausedTime() {
+ DCHECK(main_task_runner_->BelongsToCurrentThread());
+
+ // pause() may be called after playback has ended and the HTMLMediaElement
+ // requires that currentTime() == duration() after ending. We want to ensure
+ // |paused_time_| matches currentTime() in this case or a future seek() may
+ // incorrectly discard what it thinks is a seek to the existing time.
+ paused_time_ =
+ ended_ ? pipeline_.GetMediaDuration() : pipeline_.GetMediaTime();
+}
+
} // namespace media
« 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