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

Unified Diff: ui/gl/android/scoped_java_surface.cc

Issue 1398703003: Fix an issue that an invalid surface could be passed to MediaPlayerBridge (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 months 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: ui/gl/android/scoped_java_surface.cc
diff --git a/ui/gl/android/scoped_java_surface.cc b/ui/gl/android/scoped_java_surface.cc
index ae4f81a44bd82a23e9e83f0b5a9f4c7b0bea2e27..ff0862300acdf0ce4c963ac64d4f086fe4eb3d7d 100644
--- a/ui/gl/android/scoped_java_surface.cc
+++ b/ui/gl/android/scoped_java_surface.cc
@@ -75,6 +75,14 @@ bool ScopedJavaSurface::IsEmpty() const {
return j_surface_.is_null();
}
+bool ScopedJavaSurface::IsValid() const {
+ // Null surface are considered valid as it can be passed to a MediaPlayer.
+ if (IsEmpty())
+ return true;
+ JNIEnv* env = base::android::AttachCurrentThread();
+ return JNI_Surface::Java_Surface_isValid(env, j_surface_.obj());
no sievers 2015/10/08 23:00:27 Are you sure we need to check this? Or is it good
qinmin 2015/10/08 23:47:23 removed this function. When surfaceDestroyed() is
+}
+
// static
ScopedJavaSurface ScopedJavaSurface::AcquireExternalSurface(jobject surface) {
JNIEnv* env = base::android::AttachCurrentThread();
« media/base/android/media_player_bridge.cc ('K') | « ui/gl/android/scoped_java_surface.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698