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

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

Issue 364033003: Eliminate MediaPlayer abstraction(network state) (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Modified the approach as suggested 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
« no previous file with comments | « Source/core/html/HTMLMediaElement.h ('k') | 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 6d5c10d55dfe3ce3ff77473f5b76730b946d5a8e..415c26e3cfeffae32144c4e788eec9d34f72628f 100644
--- a/Source/core/html/HTMLMediaElement.cpp
+++ b/Source/core/html/HTMLMediaElement.cpp
@@ -869,13 +869,13 @@ void HTMLMediaElement::selectMediaResource()
// If the src attribute's value is the empty string ... jump down to the failed step below
KURL mediaURL = getNonEmptyURLAttribute(srcAttr);
if (mediaURL.isEmpty()) {
- mediaLoadingFailed(MediaPlayer::FormatError);
+ mediaLoadingFailed(WebMediaPlayer::NetworkStateFormatError);
WTF_LOG(Media, "HTMLMediaElement::selectMediaResource, empty 'src'");
return;
}
if (!isSafeToLoadURL(mediaURL, Complain)) {
- mediaLoadingFailed(MediaPlayer::FormatError);
+ mediaLoadingFailed(WebMediaPlayer::NetworkStateFormatError);
return;
}
@@ -917,7 +917,7 @@ void HTMLMediaElement::loadResource(const KURL& url, ContentType& contentType, c
LocalFrame* frame = document().frame();
if (!frame) {
- mediaLoadingFailed(MediaPlayer::FormatError);
+ mediaLoadingFailed(WebMediaPlayer::NetworkStateFormatError);
return;
}
@@ -973,7 +973,7 @@ void HTMLMediaElement::loadResource(const KURL& url, ContentType& contentType, c
startPlayerLoad();
}
} else {
- mediaLoadingFailed(MediaPlayer::FormatError);
+ mediaLoadingFailed(WebMediaPlayer::NetworkStateFormatError);
}
// If there is no poster to display, allow the media engine to render video frames as soon as
@@ -1626,10 +1626,10 @@ void HTMLMediaElement::cancelPendingEventsAndCallbacks()
void HTMLMediaElement::mediaPlayerNetworkStateChanged()
{
- setNetworkState(m_player->networkState());
+ setNetworkState(webMediaPlayer()->networkState());
philipj_slow 2014/07/12 20:50:55 You should also be able to remove MediaPlayerClien
Srirama 2014/07/13 05:30:17 But that is not straightforward, it can be done on
}
-void HTMLMediaElement::mediaLoadingFailed(MediaPlayer::NetworkState error)
+void HTMLMediaElement::mediaLoadingFailed(WebMediaPlayer::NetworkState error)
{
stopPeriodicTimers();
@@ -1660,11 +1660,13 @@ void HTMLMediaElement::mediaLoadingFailed(MediaPlayer::NetworkState error)
return;
}
- if (error == MediaPlayer::NetworkError && m_readyState >= HAVE_METADATA)
+ if (error == WebMediaPlayer::NetworkStateNetworkError && m_readyState >= HAVE_METADATA)
mediaEngineError(MediaError::create(MediaError::MEDIA_ERR_NETWORK));
- else if (error == MediaPlayer::DecodeError)
+ else if (error == WebMediaPlayer::NetworkStateDecodeError)
mediaEngineError(MediaError::create(MediaError::MEDIA_ERR_DECODE));
- else if ((error == MediaPlayer::FormatError || error == MediaPlayer::NetworkError) && m_loadState == LoadingFromSrcAttr)
+ else if ((error == WebMediaPlayer::NetworkStateFormatError
+ || error == WebMediaPlayer::NetworkStateNetworkError)
+ && m_loadState == LoadingFromSrcAttr)
noneSupported();
updateDisplayState();
@@ -1672,22 +1674,24 @@ void HTMLMediaElement::mediaLoadingFailed(MediaPlayer::NetworkState error)
mediaControls()->reset();
}
-void HTMLMediaElement::setNetworkState(MediaPlayer::NetworkState state)
+void HTMLMediaElement::setNetworkState(WebMediaPlayer::NetworkState state)
{
WTF_LOG(Media, "HTMLMediaElement::setNetworkState(%d) - current state is %d", static_cast<int>(state), static_cast<int>(m_networkState));
- if (state == MediaPlayer::Empty) {
+ if (state == WebMediaPlayer::NetworkStateEmpty) {
// Just update the cached state and leave, we can't do anything.
m_networkState = NETWORK_EMPTY;
return;
}
- if (state == MediaPlayer::FormatError || state == MediaPlayer::NetworkError || state == MediaPlayer::DecodeError) {
+ if (state == WebMediaPlayer::NetworkStateFormatError
+ || state == WebMediaPlayer::NetworkStateNetworkError
+ || state == WebMediaPlayer::NetworkStateDecodeError) {
mediaLoadingFailed(state);
return;
}
- if (state == MediaPlayer::Idle) {
+ if (state == WebMediaPlayer::NetworkStateIdle) {
if (m_networkState > NETWORK_IDLE) {
changeNetworkStateFromLoadingToIdle();
setShouldDelayLoadEvent(false);
@@ -1696,13 +1700,13 @@ void HTMLMediaElement::setNetworkState(MediaPlayer::NetworkState state)
}
}
- if (state == MediaPlayer::Loading) {
+ if (state == WebMediaPlayer::NetworkStateLoading) {
if (m_networkState < NETWORK_LOADING || m_networkState == NETWORK_NO_SOURCE)
startProgressEventTimer();
m_networkState = NETWORK_LOADING;
}
- if (state == MediaPlayer::Loaded) {
+ if (state == WebMediaPlayer::NetworkStateLoaded) {
if (m_networkState != NETWORK_IDLE)
changeNetworkStateFromLoadingToIdle();
m_completelyLoaded = true;
« no previous file with comments | « Source/core/html/HTMLMediaElement.h ('k') | Source/platform/graphics/media/MediaPlayer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698