Bug 1296298 - Don't try to add a presentation surface unless Gecko is running r=jchen a=ritu
authorJames Willcox <snorp@snorp.net>
Fri, 26 Aug 2016 16:52:46 -0500
changeset 348072 8f259d3c70b9192923644f3317eb670ab06e3c13
parent 348071 c580c468fdb4a396bde95c2d2b69d2302e88d3ba
child 348073 7a8b1ac451d942a5faa6f3a9dfa0c3c55eeed155
push id6389
push userraliiev@mozilla.com
push dateMon, 19 Sep 2016 13:38:22 +0000
treeherdermozilla-beta@01d67bfe6c81 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjchen, ritu
bugs1296298
milestone50.0a2
Bug 1296298 - Don't try to add a presentation surface unless Gecko is running r=jchen a=ritu
mobile/android/base/java/org/mozilla/gecko/PresentationMediaPlayerManager.java
--- a/mobile/android/base/java/org/mozilla/gecko/PresentationMediaPlayerManager.java
+++ b/mobile/android/base/java/org/mozilla/gecko/PresentationMediaPlayerManager.java
@@ -95,23 +95,29 @@ public class PresentationMediaPlayerMana
         }
     }
 
     private static class SurfaceListener implements SurfaceHolder.Callback {
         @Override
         public void surfaceChanged(SurfaceHolder holder, int format, int width,
                                    int height) {
             // Surface changed so force a composite
-            GeckoAppShell.invalidateAndScheduleComposite();
+            if (GeckoThread.isStateAtLeast(GeckoThread.State.PROFILE_READY)) {
+                GeckoAppShell.invalidateAndScheduleComposite();
+            }
         }
 
         @Override
         public void surfaceCreated(SurfaceHolder holder) {
-            GeckoAppShell.addPresentationSurface(holder.getSurface());
-            GeckoAppShell.invalidateAndScheduleComposite();
+            if (GeckoThread.isStateAtLeast(GeckoThread.State.PROFILE_READY)) {
+                GeckoAppShell.addPresentationSurface(holder.getSurface());
+                GeckoAppShell.invalidateAndScheduleComposite();
+            }
         }
 
         @Override
         public void surfaceDestroyed(SurfaceHolder holder) {
-            GeckoAppShell.removePresentationSurface(holder.getSurface());
+            if (GeckoThread.isStateAtLeast(GeckoThread.State.PROFILE_READY)) {
+                GeckoAppShell.removePresentationSurface(holder.getSurface());
+            }
         }
     }
 }