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

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

Issue 304353005: Eliminate MediaPlayer & MediaPlayerClient abstractions(rate, setRate and other APIs) (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase with latest Created 6 years, 6 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 | « no previous file | Source/platform/graphics/media/MediaPlayer.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/html/HTMLMediaElement.cpp
diff --git a/Source/core/html/HTMLMediaElement.cpp b/Source/core/html/HTMLMediaElement.cpp
index ed492e581334d7b474003da397eae42f9782ab7c..c4f798079a48bc2b655b7e4da715b9a10e8483bc 100644
--- a/Source/core/html/HTMLMediaElement.cpp
+++ b/Source/core/html/HTMLMediaElement.cpp
@@ -1706,7 +1706,7 @@ void HTMLMediaElement::changeNetworkStateFromLoadingToIdle()
// Schedule one last progress event so we guarantee that at least one is fired
// for files that load very quickly.
- if (m_player->didLoadingProgress())
+ if (webMediaPlayer() && webMediaPlayer()->didLoadingProgress())
scheduleEvent(EventTypeNames::progress);
scheduleEvent(EventTypeNames::suspend);
m_networkState = NETWORK_IDLE;
@@ -1845,7 +1845,7 @@ void HTMLMediaElement::progressEventTimerFired(Timer<HTMLMediaElement>*)
double time = WTF::currentTime();
double timedelta = time - m_previousProgressTime;
- if (m_player->didLoadingProgress()) {
+ if (webMediaPlayer() && webMediaPlayer()->didLoadingProgress()) {
scheduleEvent(EventTypeNames::progress);
m_previousProgressTime = time;
m_sentStalledEvent = false;
@@ -2134,8 +2134,8 @@ HTMLMediaElement::DirectionOfPlayback HTMLMediaElement::directionOfPlayback() co
void HTMLMediaElement::updatePlaybackRate()
{
double effectiveRate = effectivePlaybackRate();
- if (m_player && potentiallyPlaying() && m_player->rate() != effectiveRate)
- m_player->setRate(effectiveRate);
+ if (m_player && potentiallyPlaying())
+ webMediaPlayer()->setRate(effectiveRate);
}
bool HTMLMediaElement::ended() const
@@ -3152,13 +3152,13 @@ void HTMLMediaElement::mediaPlayerSizeChanged()
PassRefPtr<TimeRanges> HTMLMediaElement::buffered() const
{
- if (!m_player)
- return TimeRanges::create();
-
if (m_mediaSource)
return m_mediaSource->buffered();
- return m_player->buffered();
+ if (!webMediaPlayer())
+ return TimeRanges::create();
+
+ return TimeRanges::create(webMediaPlayer()->buffered());
}
PassRefPtr<TimeRanges> HTMLMediaElement::played()
@@ -3177,8 +3177,8 @@ PassRefPtr<TimeRanges> HTMLMediaElement::played()
PassRefPtr<TimeRanges> HTMLMediaElement::seekable() const
{
- if (m_player) {
- double maxTimeSeekable = m_player->maxTimeSeekable();
+ if (webMediaPlayer()) {
+ double maxTimeSeekable = webMediaPlayer()->maxTimeSeekable();
if (maxTimeSeekable)
return TimeRanges::create(0, maxTimeSeekable);
}
@@ -3286,7 +3286,7 @@ void HTMLMediaElement::updatePlayState()
if (playerPaused) {
// Set rate, muted before calling play in case they were set before the media engine was setup.
// The media engine should just stash the rate and muted values since it isn't already playing.
- m_player->setRate(effectivePlaybackRate());
+ webMediaPlayer()->setRate(effectivePlaybackRate());
updateVolume();
m_player->play();
« no previous file with comments | « no previous file | Source/platform/graphics/media/MediaPlayer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698