[Android] Benchmark: now receive screenshot directory location from intent

Duncan McNamara git at videolan.org
Thu Jun 1 15:00:49 CEST 2017


vlc-android | branch: master | Duncan McNamara <dcn.mcnamara at gmail.com> | Wed May 31 18:42:27 2017 +0200| [50920183e551768547cc2d829bfe30e005459554] | committer: Geoffrey Métais

Benchmark: now receive screenshot directory location from intent

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

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

 .../org/videolan/vlc/gui/video/benchmark/BenchActivity.java  | 12 ++++++++++--
 1 file changed, 10 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 791c99c0d..a4af0cf23 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
@@ -68,6 +68,7 @@ public class BenchActivity extends ShallowVideoPlayer {
     private static final String PLAYBACK = "org.videolan.vlc.gui.video.benchmark.ACTION_PLAYBACK";
 
     private static final String TIMESTAMPS = "org.videolan.vlc.gui.video.benchmark.TIMESTAMPS";
+    private static final String INTENT_SCREENSHOT_DIR = "SCREENSHOT_DIR";
     private static final String TAG = "VLCBenchmark";
     private static final int REQUEST_SCREENSHOT = 666;
 
@@ -101,6 +102,8 @@ public class BenchActivity extends ShallowVideoPlayer {
     /* set to true when Vout event is received
      * used to check if hardware decoder works */
     private boolean mHasVout = false;
+    /* screenshot directory location */
+    private String screenshotDir;
 
     @Override
     protected void loadMedia() {
@@ -126,6 +129,11 @@ public class BenchActivity extends ShallowVideoPlayer {
         }
         mIsBenchmark = true;
 
+        if (!intent.hasExtra(INTENT_SCREENSHOT_DIR)) {
+            errorFinish("Failed to get screenshot directory location");
+        }
+        screenshotDir = intent.getStringExtra(INTENT_SCREENSHOT_DIR);
+
         super.onCreate(savedInstanceState);
 
         /* Determining the benchmark mode */
@@ -422,11 +430,11 @@ public class BenchActivity extends ShallowVideoPlayer {
                         if (bitmap != null) {
                             bitmap.copyPixelsFromBuffer(buffer);
 
-                            File folder = new File(Environment.getExternalStorageDirectory() + File.separator + "screenshotFolder");
+                            File folder = new File(screenshotDir);
 
                             if (!folder.exists()) {
                                 if (!folder.mkdir()) {
-                                    errorFinish("Failed to create screenshotFolder");
+                                    errorFinish("Failed to create screenshot directory");
                                 }
                             }
 



More information about the Android mailing list