Skip to content
Snippets Groups Projects
Commit 4d2cb477 authored by Duncan McNamara's avatar Duncan McNamara Committed by Nicolas Pomepuy
Browse files

Benchmark: fix repeating stuck to REPEAT_MODE_ONE

This caused a playback loop if the first sample was played in hardware
decoding and the user previously had set his player to REPEAT_MODE_ONE.
parent 459b0c90
No related branches found
No related tags found
1 merge request!1111Benchmark: fix repeating stuck to REPEAT_MODE_ONE
Pipeline #144771 passed with stage
in 5 minutes and 18 seconds
......@@ -124,6 +124,14 @@ class BenchActivity : ShallowVideoPlayer() {
override fun onServiceChanged(service: PlaybackService?) {
super.onServiceChanged(service)
if (isSpeed && this.service != null) {
oldRate = service!!.rate
oldRepeating = service.playlistManager.repeating
service.playlistManager.setRepeatType(PlaybackStateCompat.REPEAT_MODE_ONE)
} else if (!isSpeed && this.service != null) {
oldRepeating = service!!.playlistManager.repeating
service.playlistManager.setRepeatType(PlaybackStateCompat.REPEAT_MODE_NONE)
}
if (isHardware && this.service != null) {
val sharedPref = Settings.getInstance(this)
oldOpenglValue = sharedPref.getString(PREFERENCE_OPENGL, "-1")
......@@ -136,13 +144,6 @@ class BenchActivity : ShallowVideoPlayer() {
}
VLCInstance.restart()
this.service?.restartMediaPlayer()
} else if (isSpeed && this.service != null) {
oldRate = service!!.rate
oldRepeating = service.playlistManager.repeating
service.playlistManager.setRepeatType(PlaybackStateCompat.REPEAT_MODE_ONE)
} else if (!isSpeed && this.service != null) {
oldRepeating = service!!.playlistManager.repeating
service.playlistManager.setRepeatType(PlaybackStateCompat.REPEAT_MODE_NONE)
}
}
......@@ -543,6 +544,11 @@ class BenchActivity : ShallowVideoPlayer() {
* before calling super
*/
override fun finish() {
if (isSpeed) {
service!!.setRate(oldRate, true)
} else {
service!!.playlistManager.setRepeatType(oldRepeating)
}
/* Resetting vout preference to it value before the benchmark */
if (isHardware && oldOpenglValue != "-2") {
val sharedPref = Settings.getInstance(this)
......@@ -552,11 +558,6 @@ class BenchActivity : ShallowVideoPlayer() {
putBoolean(PREFERENCE_PLAYBACK_HISTORY, oldHistoryBoolean)
}
}
if (isSpeed) {
service!!.setRate(oldRate, true)
} else {
service!!.playlistManager.setRepeatType(oldRepeating)
}
VLCInstance.restart()
}
/* Case of error in VideoPlayerActivity, then finish is not overridden */
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment