Index: chromecast/browser/android/apk/src/org/chromium/chromecast/shell/ExternalVideoSurfaceContainer.java |
diff --git a/chromecast/browser/android/apk/src/org/chromium/chromecast/shell/ExternalVideoSurfaceContainer.java b/chromecast/browser/android/apk/src/org/chromium/chromecast/shell/ExternalVideoSurfaceContainer.java |
index 2769be9f44019003aee374162b94b9c984b91cee..73b3e7f08c7071fe4314adf503046d7236252599 100644 |
--- a/chromecast/browser/android/apk/src/org/chromium/chromecast/shell/ExternalVideoSurfaceContainer.java |
+++ b/chromecast/browser/android/apk/src/org/chromium/chromecast/shell/ExternalVideoSurfaceContainer.java |
@@ -46,6 +46,7 @@ import java.lang.ref.WeakReference; |
@JNINamespace("chromecast::shell") |
public class ExternalVideoSurfaceContainer implements SurfaceHolder.Callback { |
protected static final int INVALID_PLAYER_ID = -1; |
+ protected static final int ANY_PLAYER_ID = -2; |
// Because WebView does hole-punching by itself, instead, the hole-punching logic |
// in SurfaceView can clear out some web elements like media control or subtitle. |
@@ -138,11 +139,12 @@ public class ExternalVideoSurfaceContainer implements SurfaceHolder.Callback { |
*/ |
@CalledByNative |
protected void releaseExternalVideoSurface(int playerId) { |
- if (mPlayerId != playerId) return; |
+ if (playerId == ANY_PLAYER_ID || playerId == mPlayerId) { |
- releaseIfActiveContainer(this); |
+ releaseIfActiveContainer(this); |
- mPlayerId = INVALID_PLAYER_ID; |
+ mPlayerId = INVALID_PLAYER_ID; |
+ } |
} |
@CalledByNative |