[Android] Deactivate mediarouter callbacks in benchmark
Geoffrey Métais
git at videolan.org
Tue May 29 11:32:02 CEST 2018
vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Tue May 29 11:31:38 2018 +0200| [9ad601771008ba0fd7b5da8ec9b31c9ee2d0576e] | committer: Geoffrey Métais
Deactivate mediarouter callbacks in benchmark
> https://code.videolan.org/videolan/vlc-android/commit/9ad601771008ba0fd7b5da8ec9b31c9ee2d0576e
---
vlc-android/src/org/videolan/vlc/gui/video/DisplayManager.kt | 8 ++++----
.../src/org/videolan/vlc/gui/video/VideoPlayerActivity.java | 8 ++++----
2 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/vlc-android/src/org/videolan/vlc/gui/video/DisplayManager.kt b/vlc-android/src/org/videolan/vlc/gui/video/DisplayManager.kt
index ef9ad9d8a..06995359e 100644
--- a/vlc-android/src/org/videolan/vlc/gui/video/DisplayManager.kt
+++ b/vlc-android/src/org/videolan/vlc/gui/video/DisplayManager.kt
@@ -57,8 +57,8 @@ class DisplayManager(private val activity: Activity, cloneMode: Boolean) {
}}
init {
- presentation = if (AndroidUtil.isJellyBeanMR1OrLater) createPresentation(cloneMode) else null
- displayType = getCurrentType()
+ presentation = if (AndroidUtil.isJellyBeanMR1OrLater && !cloneMode) createPresentation() else null
+ displayType = if (cloneMode) DisplayType.PRIMARY else getCurrentType()
if (!AndroidDevices.isChromeBook) RendererDelegate.selectedRenderer.observeForever(rendererObs)
}
@@ -85,8 +85,8 @@ class DisplayManager(private val activity: Activity, cloneMode: Boolean) {
}
@TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR1)
- private fun createPresentation(cloneMode: Boolean): SecondaryDisplay? {
- if (mediaRouter === null || cloneMode) return null
+ private fun createPresentation(): SecondaryDisplay? {
+ if (mediaRouter === null) return null
// Get the current route and its presentation display.
val route = mediaRouter?.getSelectedRoute(MediaRouter.ROUTE_TYPE_LIVE_VIDEO)
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 9138081be..8e7c5df39 100644
--- a/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
@@ -324,7 +324,7 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVLCVout.C
audioBoostEnabled = mSettings.getBoolean("audio_boost", false);
mEnableCloneMode = mSettings.getBoolean("enable_clone_mode", false);
- mDisplayManager = new DisplayManager(this, mEnableCloneMode);
+ mDisplayManager = new DisplayManager(this, mEnableCloneMode || mIsBenchmark);
setContentView(mDisplayManager.isPrimary() ? R.layout.player : R.layout.player_remote_control);
/** initialize Views an their Events */
@@ -777,7 +777,7 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVLCVout.C
surfaceFrameAddLayoutListener(true);
/* Listen for changes to media routes. */
- mDisplayManager.mediaRouterAddCallback(true);
+ if (!mIsBenchmark) mDisplayManager.mediaRouterAddCallback(true);
if (mRootView != null) mRootView.setKeepScreenOn(true);
}
@@ -845,7 +845,7 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVLCVout.C
if (mRootView != null) mRootView.setKeepScreenOn(false);
/* Stop listening for changes to media routes. */
- mDisplayManager.mediaRouterAddCallback(false);
+ if (!mIsBenchmark) mDisplayManager.mediaRouterAddCallback(false);
surfaceFrameAddLayoutListener(false);
@@ -933,7 +933,7 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVLCVout.C
}
};
- public void exit(int resultCode){
+ public void exit(int resultCode) {
if (isFinishing()) return;
final Intent resultIntent = new Intent(ACTION_RESULT);
if (mUri != null && mService != null) {
More information about the Android
mailing list