diff options
author | qinmin@chromium.org <qinmin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-03-14 22:06:08 +0000 |
---|---|---|
committer | qinmin@chromium.org <qinmin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-03-14 22:06:08 +0000 |
commit | e8049646ccd465e3110bfed2d67ace60afb69bbb (patch) | |
tree | 10377f8208912c780ac44e316e195bf7b0f23d69 | |
parent | 4f99782b60caec061f62def550f0ef16a2d42bd0 (diff) | |
download | chromium_src-e8049646ccd465e3110bfed2d67ace60afb69bbb.zip chromium_src-e8049646ccd465e3110bfed2d67ace60afb69bbb.tar.gz chromium_src-e8049646ccd465e3110bfed2d67ace60afb69bbb.tar.bz2 |
Don't call playbackStateChanged() if player is stuck in an error state
Calling playbackStateChanged() could get the WebMediaPlayer instance get deleted in such a state.
So bypass this call after we set the network state to an error.
The player will get released anyway afterwards.
BUG=161878
Review URL: https://chromiumcodereview.appspot.com/12828004
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@188210 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | webkit/media/android/webmediaplayer_android.cc | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/webkit/media/android/webmediaplayer_android.cc b/webkit/media/android/webmediaplayer_android.cc index 5925bad..93cdcdc 100644 --- a/webkit/media/android/webmediaplayer_android.cc +++ b/webkit/media/android/webmediaplayer_android.cc @@ -358,10 +358,24 @@ void WebMediaPlayerAndroid::OnPlayerReleased() { } void WebMediaPlayerAndroid::ReleaseMediaResources() { - // Pause the media player first. - pause(); - client_->playbackStateChanged(); - + switch (network_state_) { + // Pause the media player and inform WebKit if the player is in a good + // shape. + case WebMediaPlayer::NetworkStateIdle: + case WebMediaPlayer::NetworkStateLoading: + case WebMediaPlayer::NetworkStateLoaded: + pause(); + client_->playbackStateChanged(); + break; + // If a WebMediaPlayer instance has entered into one of these states, + // the internal network state in HTMLMediaElement could be set to empty. + // And calling playbackStateChanged() could get this object deleted. + case WebMediaPlayer::NetworkStateEmpty: + case WebMediaPlayer::NetworkStateFormatError: + case WebMediaPlayer::NetworkStateNetworkError: + case WebMediaPlayer::NetworkStateDecodeError: + break; + } ReleaseResourcesInternal(); OnPlayerReleased(); } |