Android: Don't call release() unless it's necessary.
authorChristian Strømme <christian.stromme@digia.com>
Wed, 26 Mar 2014 11:13:49 +0000 (12:13 +0100)
committerThe Qt Project <gerrit-noreply@qt-project.org>
Thu, 27 Mar 2014 15:43:59 +0000 (16:43 +0100)
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>
src/plugins/android/src/mediaplayer/qandroidmediaplayercontrol.cpp

index f678083..f5614a5 100644 (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);