[Android] benchmark: add bench related variables
Duncan McNamara
git at videolan.org
Fri Jan 6 17:56:21 CET 2017
vlc-android | branch: master | Duncan McNamara <dcn.mcnamara at gmail.com> | Fri Jan 6 16:48:01 2017 +0100| [8d252ef81c61bd80bc028fde53ec10fbf92f6ad9] | committer: Geoffrey Métais
benchmark: add bench related variables
hardware boolean to specify
hardware decoding only
> https://code.videolan.org/videolan/vlc-android/commit/8d252ef81c61bd80bc028fde53ec10fbf92f6ad9
---
.../src/org/videolan/vlc/PlaybackService.java | 25 ++++++++++++++++++++++
1 file changed, 25 insertions(+)
diff --git a/vlc-android/src/org/videolan/vlc/PlaybackService.java b/vlc-android/src/org/videolan/vlc/PlaybackService.java
index d322003..1244007 100644
--- a/vlc-android/src/org/videolan/vlc/PlaybackService.java
+++ b/vlc-android/src/org/videolan/vlc/PlaybackService.java
@@ -202,6 +202,11 @@ public class PlaybackService extends MediaBrowserServiceCompat implements IVLCVo
private ComponentName mRemoteControlClientReceiverComponent;
private PopupManager mPopupManager;
+ /* boolean indicating if the player is in benchmark mode */
+ private boolean mIsBenchmark = false;
+ /* boolenan indication if the player is in hardware mode */
+ private boolean mIsHardware = false;
+
private static LibVLC LibVLC() {
return VLCInstance.get();
}
@@ -541,6 +546,9 @@ public class PlaybackService extends MediaBrowserServiceCompat implements IVLCVo
}
};
+ public void setBenchmark() { mIsBenchmark = true; }
+ public void setHardware() { mIsHardware = true; }
+
/**
* Update current media meta and return true if player needs to be updated
*
@@ -556,6 +564,12 @@ public class PlaybackService extends MediaBrowserServiceCompat implements IVLCVo
return id != Media.Meta.NowPlaying || getCurrentMedia().getNowPlaying() != null;
}
+ private Media.Stats previousMediaStats = null;
+
+ public Media.Stats getLastStats() {
+ return previousMediaStats;
+ }
+
private final MediaPlayer.EventListener mMediaPlayerListener = new MediaPlayer.EventListener() {
KeyguardManager keyguardManager = (KeyguardManager) VLCApplication.getAppContext().getSystemService(Context.KEYGUARD_SERVICE);
@@ -606,6 +620,7 @@ public class PlaybackService extends MediaBrowserServiceCompat implements IVLCVo
case MediaPlayer.Event.EndReached:
mMedialibrary.updateProgress(getCurrentMediaWrapper(), 0L);
executeUpdateProgress();
+ previousMediaStats = mMediaPlayer.getMedia().getStats();
determinePrevAndNextIndices(true);
next();
if (mWakeLock.isHeld())
@@ -1795,6 +1810,16 @@ public class PlaybackService extends MediaBrowserServiceCompat implements IVLCVo
final Media media = new Media(VLCInstance.get(), mw.getUri());
VLCOptions.setMediaOptions(media, this, flags | mw.getFlags());
+ /* keeping only video during benchmark */
+ if (mIsBenchmark) {
+ media.addOption(":no-audio");
+ media.addOption(":no-spu");
+ if (mIsHardware) {
+ media.addOption(":codec=mediacodec_ndk,mediacodec_jni,none");
+ mIsHardware = false;
+ }
+ }
+
if (mw.getSlaves() != null) {
for (Media.Slave slave : mw.getSlaves())
media.addSlave(slave);
More information about the Android
mailing list