Chromium Code Reviews| Index: talk/app/webrtc/java/android/org/webrtc/CameraEnumerationAndroid.java |
| diff --git a/talk/app/webrtc/java/android/org/webrtc/CameraEnumerationAndroid.java b/talk/app/webrtc/java/android/org/webrtc/CameraEnumerationAndroid.java |
| index 32341a342122acfaef980e0a67bcf511af9bbb3d..14c5ff171282ec5b5f3b05ef9c4ccb567d9141be 100644 |
| --- a/talk/app/webrtc/java/android/org/webrtc/CameraEnumerationAndroid.java |
| +++ b/talk/app/webrtc/java/android/org/webrtc/CameraEnumerationAndroid.java |
| @@ -71,7 +71,7 @@ public class CameraEnumerationAndroid { |
| // other image formats then this needs to be updated and |
| // VideoCapturerAndroid.getSupportedFormats need to return CaptureFormats of |
| // all imageFormats. |
| - public final int imageFormat = ImageFormat.YV12; |
| + public final int imageFormat = ImageFormat.NV21; |
| public CaptureFormat(int width, int height, int minFramerate, |
| int maxFramerate) { |
| @@ -87,20 +87,18 @@ public class CameraEnumerationAndroid { |
| } |
| // Calculates the frame size of the specified image format. Currently only |
| - // supporting ImageFormat.YV12. The YV12's stride is the closest rounded up |
| + // supporting ImageFormat.NV21. The stride is the closest rounded up |
| // multiple of 16 of the width and width and height are always even. |
|
magjed_webrtc
2015/12/17 08:02:42
Why did you remove the android link? I'm not sure
perkj_webrtc
2015/12/17 12:42:44
Done.
|
| - // Android guarantees this: |
| - // http://developer.android.com/reference/android/hardware/Camera.Parameters.html#setPreviewFormat%28int%29 |
| public static int frameSize(int width, int height, int imageFormat) { |
| - if (imageFormat != ImageFormat.YV12) { |
| + if (imageFormat != ImageFormat.NV21) { |
| throw new UnsupportedOperationException("Don't know how to calculate " |
| - + "the frame size of non-YV12 image formats."); |
| + + "the frame size of non-NV21 image formats."); |
| } |
| - int yStride = roundUp(width, 16); |
| - int uvStride = roundUp(yStride / 2, 16); |
| - int ySize = yStride * height; |
| - int uvSize = uvStride * height / 2; |
| - return ySize + uvSize * 2; |
| + final int stride = roundUp(width, 16); |
| + final int ySize = stride * height; |
| + final int uvHeight = (height + 1) / 2; |
| + final int uvSize = stride * uvHeight; |
| + return ySize + uvSize; |
| } |
| // Rounds up |x| to the closest value that is a multiple of |alignment|. |