[Android] Fix renderer detection

Geoffrey Métais git at videolan.org
Wed Jan 16 16:51:25 CET 2019


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Wed Jan 16 16:44:53 2019 +0100| [1e9810fecdcf51be85a9031b88ded6e4c7d96698] | committer: Geoffrey Métais

Fix renderer detection

> https://code.videolan.org/videolan/vlc-android/commit/1e9810fecdcf51be85a9031b88ded6e4c7d96698
---

 libvlc/src/org/videolan/libvlc/util/DisplayManager.java | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/libvlc/src/org/videolan/libvlc/util/DisplayManager.java b/libvlc/src/org/videolan/libvlc/util/DisplayManager.java
index d7e7cbc6c..41538e46e 100644
--- a/libvlc/src/org/videolan/libvlc/util/DisplayManager.java
+++ b/libvlc/src/org/videolan/libvlc/util/DisplayManager.java
@@ -43,10 +43,10 @@ public class DisplayManager {
         mSelectedRenderer = selectedRender;
         mMediaRouter = (MediaRouter) activity.getApplicationContext().getSystemService(Context.MEDIA_ROUTER_SERVICE);
         mTextureView = textureView;
-        mPresentation = !(cloneMode || benchmark) ? createPresentation() : null;
+        mPresentation = !cloneMode && !benchmark && selectedRender.getValue() == null ? createPresentation() : null;
         if (mSelectedRenderer != null) {
-            mSelectedRenderer.observeForever(mRendererObs);
             mRendererItem = mSelectedRenderer.getValue();
+            mSelectedRenderer.observeForever(mRendererObs);
         }
         mDisplayType = benchmark ? DisplayType.PRIMARY : getCurrentType();
     }
@@ -66,8 +66,10 @@ public class DisplayManager {
     private Observer<RendererItem> mRendererObs = new Observer<RendererItem>() {
         @Override
         public void onChanged(RendererItem rendererItem) {
-            mRendererItem = rendererItem;
-            updateDisplayType();
+            if (mRendererItem != rendererItem) {
+                mRendererItem = rendererItem;
+                updateDisplayType();
+            }
         }
     };
 



More information about the Android mailing list