[Android] [PATCH] Benchmark: force fit_screen when playing video

Duncan McNamara dcn.mcnamara at gmail.com
Thu May 11 17:03:42 CEST 2017


To compare screenshots, it is better to have
an image with no top and bottom black borders.
---
 .../src/org/videolan/vlc/gui/video/VideoPlayerActivity.java       | 8 +++++++-
 .../src/org/videolan/vlc/gui/video/benchmark/BenchActivity.java   | 1 +
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java b/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
index dcb5aed..fab2e97 100644
--- a/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
@@ -348,6 +348,8 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVLCVout.C
 
     DisplayMetrics mScreen = new DisplayMetrics();
 
+    protected boolean mIsBenchmark = false;
+
     private static LibVLC LibVLC() {
         return VLCInstance.get();
     }
@@ -488,7 +490,11 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVLCVout.C
         getWindowManager().getDefaultDisplay().getMetrics(mScreen);
         mSurfaceYDisplayRange = Math.min(mScreen.widthPixels, mScreen.heightPixels);
         mSurfaceXDisplayRange = Math.max(mScreen.widthPixels, mScreen.heightPixels);
-        mCurrentSize = mSettings.getInt(PreferencesActivity.VIDEO_RATIO, SURFACE_BEST_FIT);
+        if (mIsBenchmark) {
+            mCurrentSize = SURFACE_FIT_SCREEN;
+        } else {
+            mCurrentSize = mSettings.getInt(PreferencesActivity.VIDEO_RATIO, SURFACE_BEST_FIT);
+        }
         mMedialibrary = VLCApplication.getMLInstance();
     }
 
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 72cf34b..791c99c 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
@@ -124,6 +124,7 @@ public class BenchActivity extends ShallowVideoPlayer {
         if (!intent.hasExtra("disable_hardware")) {
             mIsHardware = true;
         }
+        mIsBenchmark = true;
 
         super.onCreate(savedInstanceState);
 
-- 
2.7.4



More information about the Android mailing list