[Android] Benchmark: fix speed tests on older devices

Duncan McNamara git at videolan.org
Tue Oct 6 10:58:46 CEST 2020


vlc-android | branch: 3.3.x | Duncan McNamara <dcn.mcnamara at gmail.com> | Mon Sep 28 10:02:58 2020 +0200| [d827718d3a702faf6d82ad46c682a1039191ddec] | committer: Nicolas Pomepuy

Benchmark: fix speed tests on older devices

On most devices, when playback speed goes above 1.0, the metric used to
determine that playback is having trouble will be late frames, with
frame drop when speed is below 1. On some older devices, this behaviour changes,
which leads to an infinite loop because of the wrong metric being used
as a stop condition.
This is a workaround to get speed test to stop on older devices and get
a failure, with a score of zero.

(cherry picked from commit 4faaae49449cfacbab411416250da319bb776f0c)

> https://code.videolan.org/videolan/vlc-android/commit/d827718d3a702faf6d82ad46c682a1039191ddec
---

 .../src/org/videolan/vlc/gui/video/benchmark/BenchActivity.kt       | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/application/vlc-android/src/org/videolan/vlc/gui/video/benchmark/BenchActivity.kt b/application/vlc-android/src/org/videolan/vlc/gui/video/benchmark/BenchActivity.kt
index d346e116a..2c6d5ae74 100644
--- a/application/vlc-android/src/org/videolan/vlc/gui/video/benchmark/BenchActivity.kt
+++ b/application/vlc-android/src/org/videolan/vlc/gui/video/benchmark/BenchActivity.kt
@@ -343,6 +343,10 @@ class BenchActivity : ShallowVideoPlayer() {
         val metric: Int
         val drops = service!!.lastStats!!.lostPictures
         when {
+            (direction != 0 && speed >= 9 && drops >= 50) -> {
+                errorFinish("Failed speed test")
+                return false
+            }
             (direction == 0 && drops > 0) -> return true
             (direction != 0 && speed >= 1.0) -> {
                 metric = lateFrameCounter
@@ -373,7 +377,7 @@ class BenchActivity : ShallowVideoPlayer() {
             hasLimit = findLimit(goBack)
         }
         converge(goBack)
-        if (speedIteration == SPEED_TEST_ITERATION_LIMIT || speed == 0f) {
+        if (speedIteration == SPEED_TEST_ITERATION_LIMIT || speed == 0f || speed >= 10) {
             service!!.playlistManager.setRepeatType(oldRepeating)
             finish()
         }



More information about the Android mailing list