Commit 3531c047 authored by Geoffrey Métais's avatar Geoffrey Métais

Deactivate mediarouter callbacks in benchmark

(cherry picked from commit 9ad60177)
parent a8cac232
......@@ -22,7 +22,7 @@ import org.videolan.vlc.RendererDelegate
import org.videolan.vlc.util.AndroidDevices
@TargetApi(Build.VERSION_CODES.JELLY_BEAN)
class DisplayManager(private val activity: Activity, cloneMode: Boolean) : RendererDelegate.RendererPlayer {
class DisplayManager(private val activity: Activity, cloneMode: Boolean, benchmark: Boolean) : RendererDelegate.RendererPlayer {
enum class DisplayType { PRIMARY, PRESENTATION, RENDERER }
......@@ -52,9 +52,9 @@ class DisplayManager(private val activity: Activity, cloneMode: Boolean) : Rende
}
init {
presentation = if (AndroidUtil.isJellyBeanMR1OrLater) createPresentation(cloneMode) else null
presentation = if (AndroidUtil.isJellyBeanMR1OrLater && !(cloneMode || benchmark)) createPresentation() else null
rendererItem = if (!AndroidDevices.isChromeBook) RendererDelegate.selectedRenderer else null
displayType = getCurrentType()
displayType = if (cloneMode) DisplayType.PRIMARY else getCurrentType()
if (!AndroidDevices.isChromeBook) RendererDelegate.addPlayerListener(this)
}
......@@ -80,8 +80,8 @@ class DisplayManager(private val activity: Activity, cloneMode: Boolean) : Rende
}
@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)
......
......@@ -366,7 +366,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 */
......@@ -831,7 +831,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);
}
......@@ -909,7 +909,7 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVLCVout.C
}
/* Stop listening for changes to media routes. */
mDisplayManager.mediaRouterAddCallback(false);
if (!mIsBenchmark) mDisplayManager.mediaRouterAddCallback(false);
surfaceFrameAddLayoutListener(false);
......@@ -997,10 +997,9 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVLCVout.C
}
};
public void exit(int resultCode){
if (isFinishing())
return;
Intent resultIntent = new Intent(ACTION_RESULT);
public void exit(int resultCode) {
if (isFinishing()) return;
final Intent resultIntent = new Intent(ACTION_RESULT);
if (mUri != null && mService != null) {
if (AndroidUtil.isNougatOrLater)
resultIntent.putExtra(EXTRA_URI, mUri.toString());
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment