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

Unified Diff: Source/core/html/HTMLMediaElement.cpp

Issue 370203004: Eliminate MediaPlayer abstraction(play/pause, other APIs) (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 5 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
Index: Source/core/html/HTMLMediaElement.cpp
diff --git a/Source/core/html/HTMLMediaElement.cpp b/Source/core/html/HTMLMediaElement.cpp
index 9883ca15e071d770a2e497b891f9e0ff648b4a53..ee4c93c99f33be5c1f24f3f5fe25c92372174a04 100644
--- a/Source/core/html/HTMLMediaElement.cpp
+++ b/Source/core/html/HTMLMediaElement.cpp
@@ -1866,7 +1866,7 @@ void HTMLMediaElement::addPlayedRange(double start, double end)
bool HTMLMediaElement::supportsSave() const
{
- return m_player ? m_player->supportsSave() : false;
+ return webMediaPlayer() && webMediaPlayer()->supportsSave();
}
void HTMLMediaElement::prepareToPlay()
@@ -1922,12 +1922,13 @@ void HTMLMediaElement::seek(double time, ExceptionState& exceptionState)
// time scale, we will ask the media engine to "seek" to the current movie time, which may be a noop and
// not generate a timechanged callback. This means m_seeking will never be cleared and we will never
// fire a 'seeked' event.
+ double mediaTime = webMediaPlayer()->mediaTimeForTimeValue(time);
+ if (time != mediaTime) {
#if !LOG_DISABLED
- double mediaTime = m_player->mediaTimeForTimeValue(time);
- if (time != mediaTime)
WTF_LOG(Media, "HTMLMediaElement::seek(%f) - media timeline equivalent is %f", time, mediaTime);
#endif
- time = m_player->mediaTimeForTimeValue(time);
+ time = mediaTime;
+ }
// 7 - If the (possibly now changed) new playback position is not in one of the ranges given in the
// seekable attribute, then let it be the position in one of the ranges given in the seekable attribute
@@ -3095,7 +3096,7 @@ void HTMLMediaElement::mediaPlayerPlaybackStateChanged()
if (!m_player || m_pausedInternal)
return;
- if (m_player->paused())
+ if (webMediaPlayer()->paused())
pause();
else
playInternal();
@@ -3259,8 +3260,8 @@ void HTMLMediaElement::updatePlayState()
return;
if (m_pausedInternal) {
- if (!m_player->paused())
- m_player->pause();
+ if (webMediaPlayer() && !webMediaPlayer()->paused())
acolwell GONE FROM CHROMIUM 2014/07/08 00:26:33 It seems like there are too many webMediaPlayer()
+ webMediaPlayer()->pause();
refreshCachedTime();
m_playbackProgressTimer.stop();
if (hasMediaControls())
@@ -3269,7 +3270,7 @@ void HTMLMediaElement::updatePlayState()
}
bool shouldBePlaying = potentiallyPlaying();
- bool playerPaused = m_player->paused();
+ bool playerPaused = webMediaPlayer() && webMediaPlayer()->paused();
acolwell GONE FROM CHROMIUM 2014/07/08 00:26:33 remove this in favor of isPlaying mentioned above.
Srirama 2014/07/08 05:06:52 Done.
WTF_LOG(Media, "HTMLMediaElement::updatePlayState - shouldBePlaying = %s, playerPaused = %s",
boolString(shouldBePlaying), boolString(playerPaused));
@@ -3283,8 +3284,7 @@ void HTMLMediaElement::updatePlayState()
// The media engine should just stash the rate and muted values since it isn't already playing.
webMediaPlayer()->setRate(effectivePlaybackRate());
updateVolume();
-
- m_player->play();
+ webMediaPlayer()->play();
}
if (hasMediaControls())
@@ -3293,8 +3293,8 @@ void HTMLMediaElement::updatePlayState()
m_playing = true;
} else { // Should not be playing right now
- if (!playerPaused)
- m_player->pause();
+ if (!playerPaused && webMediaPlayer())
acolwell GONE FROM CHROMIUM 2014/07/08 00:26:33 I think this could become "if (isPlaying)".
Srirama 2014/07/08 05:06:52 Done.
+ webMediaPlayer()->pause();
refreshCachedTime();
m_playbackProgressTimer.stop();

Powered by Google App Engine
This is Rietveld 408576698