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

Unified Diff: media/capture/content/android/java/src/org/chromium/media/ScreenCapture.java

Issue 2584933002: Android ScreenCapture: fix crash on Nexus 5X (Closed)
Patch Set: address comments Created 4 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/capture/content/android/java/src/org/chromium/media/ScreenCapture.java
diff --git a/media/capture/content/android/java/src/org/chromium/media/ScreenCapture.java b/media/capture/content/android/java/src/org/chromium/media/ScreenCapture.java
index 8577beaf275374ec1ab59240af928f7ac0b4c523..f0bc74b240677e28e172d465cfdacf598f306c82 100644
--- a/media/capture/content/android/java/src/org/chromium/media/ScreenCapture.java
+++ b/media/capture/content/android/java/src/org/chromium/media/ScreenCapture.java
@@ -157,11 +157,13 @@ public class ScreenCapture extends Fragment {
Log.e(TAG, "acquireLatestImage():" + ex);
} catch (UnsupportedOperationException ex) {
Log.i(TAG, "acquireLatestImage():" + ex);
- // YUV_420_888 is the preference, but not all devices support it,
- // fall-back to RGBA_8888 then.
- mFormat = PixelFormat.RGBA_8888;
- createImageReaderWithFormat();
- createVirtualDisplay();
+ if (mFormat == ImageFormat.YUV_420_888) {
+ // YUV_420_888 is the preference, but not all devices support it,
+ // fall-back to RGBA_8888 then.
+ mFormat = PixelFormat.RGBA_8888;
+ createImageReaderWithFormat();
+ createVirtualDisplay();
+ }
}
}
}
@@ -296,13 +298,12 @@ public class ScreenCapture extends Fragment {
mThread.start();
mBackgroundHandler = new Handler(mThread.getLooper());
- // On Android M and above, YUV420 is prefered. Some Android L devices will silently
- // fail with YUV420, so keep with RGBA_8888 on L.
- if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) {
- mFormat = PixelFormat.RGBA_8888;
- } else {
- mFormat = ImageFormat.YUV_420_888;
- }
+ // YUV420 is preferred. But not all devices supports it and it even will
+ // crash some devices. See https://crbug.com/674989 . A feature request
+ // was already filed to support YUV420 in VirturalDisplay. Before YUV420
+ // is available, stay with RGBA_8888 at present.
+ mFormat = PixelFormat.RGBA_8888;
+
maybeDoRotation();
createImageReaderWithFormat();
createVirtualDisplay();
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698