[Android] Benchmark: add timeout to playback test also

Duncan McNamara git at videolan.org
Fri Aug 31 15:38:47 CEST 2018


vlc-android | branch: master | Duncan McNamara <dcn.mcnamara at gmail.com> | Fri Aug 31 11:10:14 2018 +0200| [1fc0340a57b5b5ef034702702e60b1a0a76c1455] | committer: Geoffrey Métais

Benchmark: add timeout to playback test also

Signed-off-by: Geoffrey Métais <geoffrey.metais at gmail.com>

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

 .../vlc/gui/video/benchmark/BenchActivity.java     | 24 ++++++++++++++++++++--
 1 file changed, 22 insertions(+), 2 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/gui/video/benchmark/BenchActivity.java b/vlc-android/src/org/videolan/vlc/gui/video/benchmark/BenchActivity.java
index 93e0a0533..3fc90d067 100644
--- a/vlc-android/src/org/videolan/vlc/gui/video/benchmark/BenchActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/video/benchmark/BenchActivity.java
@@ -113,6 +113,10 @@ public class BenchActivity extends ShallowVideoPlayer {
     /* bool to wait in pause for user permission */
     private boolean mWritePermission = false;
 
+    /* Used to determine when a playback is stuck */
+    private float mPosition = 0;
+    private int mPositionCounter = 0;
+
 
     @Override
     protected void loadMedia() {
@@ -217,8 +221,8 @@ public class BenchActivity extends ShallowVideoPlayer {
             mTimeOut = new Runnable() {
                 @Override
                 public void run() {
-                    Log.e(TAG, "benchmark timeout: VLC Froze" );
-                    errorFinish("VLC Froze");
+                    Log.e(TAG, "VLC Seek Froze" );
+                    errorFinish("VLC Seek Froze");
                 }
             };
             mHandler.postDelayed(mTimeOut, 10000);
@@ -245,8 +249,23 @@ public class BenchActivity extends ShallowVideoPlayer {
         switch (event.type) {
             case MediaPlayer.Event.Vout:
                 mHasVout = true;
+                break;
             case MediaPlayer.Event.TimeChanged:
                 setTimeout();
+                break;
+            case MediaPlayer.Event.PositionChanged:
+                float pos = event.getPositionChanged();
+                if (!mIsScreenshot) {
+                    if (pos != mPosition) {
+                        mPosition = pos;
+                        mPositionCounter = 0;
+                    } else if (mPositionCounter > 50){
+                        errorFinish("VLC Playback Froze");
+                    } else {
+                        mPositionCounter += 1;
+                    }
+                }
+                break;
             case MediaPlayer.Event.Buffering:
                 if (event.getBuffering() == 100f) {
                     /* initial setup that has to be done when the video
@@ -307,6 +326,7 @@ public class BenchActivity extends ShallowVideoPlayer {
      */
     private void seekScreenshot() {
         if (mProjectionManager != null && mScreenshotCount < mTimestamp.size()) {
+            setTimeout();
             seek(mTimestamp.get(mScreenshotCount));
             ++mScreenshotCount;
             mSeeking = true;



More information about the Android mailing list