Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1483)

Unified Diff: android_webview/native/external_video_surface_container_impl.cc

Issue 714643002: Pause EME player whose external surface is stolen by another player (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add native version of INVALID_PLAYER_ID Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: android_webview/native/external_video_surface_container_impl.cc
diff --git a/android_webview/native/external_video_surface_container_impl.cc b/android_webview/native/external_video_surface_container_impl.cc
index 1a10ab547ac1b062f41778945d848e5e2e2c5df4..342fc5e3cfa75518f272ade201099ce2ca55f5c2 100644
--- a/android_webview/native/external_video_surface_container_impl.cc
+++ b/android_webview/native/external_video_surface_container_impl.cc
@@ -43,6 +43,22 @@ void ExternalVideoSurfaceContainerImpl::RequestExternalVideoSurface(
env, jobject_.obj(), static_cast<jint>(player_id));
}
+int ExternalVideoSurfaceContainerImpl::GetCurrentPlayerId() {
+ JNIEnv* env = AttachCurrentThread();
+ jclass cls = env->GetObjectClass(jobject_.obj());
+ jfieldID fid = env->GetStaticFieldID(cls, "INVALID_PLAYER_ID", "I");
+ int invalid_player = static_cast<int>(env->GetStaticIntField(cls, fid));
boliu 2014/12/09 18:15:18 We basically never write manual jni code in chromi
+
+ int current_player = static_cast<int>(
+ Java_ExternalVideoSurfaceContainer_getCurrentPlayerId(
+ env, jobject_.obj()));
+
+ if (current_player == invalid_player)
boliu 2014/12/09 18:15:18 You can just do if (current_player < 0) here.
+ return kInvalidPlayerId;
+ else
+ return current_player;
+}
+
void ExternalVideoSurfaceContainerImpl::ReleaseExternalVideoSurface(
int player_id) {
JNIEnv* env = AttachCurrentThread();

Powered by Google App Engine
This is Rietveld 408576698