Android: Don't call release() unless it's necessary.

If the mediaplayer is in either Idle or Uninitialized state, then there
is no need to call release again.

Change-Id: Idb6f2d9ea7aad7a9036e7e9a534c3bd296324068
Reviewed-by: Yoann Lopes <yoann.lopes@digia.com>
This commit is contained in:
Christian Strømme
2014-03-26 12:13:49 +01:00
committed by The Qt Project
parent 09e3d8a28e
commit 3c3e2c324b

View File

@@ -289,7 +289,9 @@ void QAndroidMediaPlayerControl::setMedia(const QMediaContent &mediaContent,
mMediaStream = stream;
}
mMediaPlayer->release();
// Release the mediaplayer if it's not in in Idle or Uninitialized state
if ((mState & (JMediaPlayer::Idle | JMediaPlayer::Uninitialized)) == 0)
mMediaPlayer->release();
if (mediaContent.isNull()) {
setMediaStatus(QMediaPlayer::NoMedia);