Android: fix two race conditions in the media player.
start() could be called before the media player was marked as prepared. When changing media, setMediaPath() could be called before the media player was reset. Task-number: QTBUG-34558 Change-Id: I886fd5f5008f76dcbc88c57d7b16a439b394d4a7 Reviewed-by: Christian Stromme <christian.stromme@digia.com>
This commit is contained in:
committed by
The Qt Project
parent
fb199a5045
commit
2412c298d4
@@ -159,7 +159,6 @@ public class QtAndroidMediaPlayer extends MediaPlayer
|
||||
public void onCompletion(final MediaPlayer mp)
|
||||
{
|
||||
onMediaPlayerInfoNative(MEDIA_PLAYER_FINISHED, 0, mID);
|
||||
reset();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -191,9 +190,9 @@ public class QtAndroidMediaPlayer extends MediaPlayer
|
||||
@Override
|
||||
public void onPrepared(final MediaPlayer mp)
|
||||
{
|
||||
mPreparing = false;
|
||||
onMediaPlayerInfoNative(MEDIA_PLAYER_READY, 0, mID);
|
||||
onMediaPlayerInfoNative(MEDIA_PLAYER_DURATION, getDuration(), mID);
|
||||
mPreparing = false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -344,7 +344,7 @@ void QAndroidMediaPlayerControl::onMediaPlayerInfo(qint32 what, qint32 extra)
|
||||
Q_EMIT positionChanged(extra);
|
||||
break;
|
||||
case JMediaPlayer::MEDIA_PLAYER_FINISHED:
|
||||
setState(QMediaPlayer::StoppedState);
|
||||
stop();
|
||||
setMediaStatus(QMediaPlayer::EndOfMedia);
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user