| Index: media/base/android/java/src/org/chromium/media/VideoCapture.java
|
| diff --git a/media/base/android/java/src/org/chromium/media/VideoCapture.java b/media/base/android/java/src/org/chromium/media/VideoCapture.java
|
| index df9eb4dcffb61a8ea9a8bd8ea8d0e16d92d775a1..55e535c0bd40f16b2a16860a89f1c53c7328b599 100644
|
| --- a/media/base/android/java/src/org/chromium/media/VideoCapture.java
|
| +++ b/media/base/android/java/src/org/chromium/media/VideoCapture.java
|
| @@ -43,15 +43,17 @@ public class VideoCapture implements PreviewCallback, OnFrameAvailableListener {
|
|
|
| static int getImageFormat() {
|
| if (android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.JELLY_BEAN) {
|
| + Log.d(TAG, "NV21 colorspace");
|
| return ImageFormat.NV21;
|
| }
|
|
|
| for (String buggyDevice : sBUGGY_DEVICE_LIST) {
|
| if (buggyDevice.contentEquals(android.os.Build.MODEL)) {
|
| + Log.d(TAG, "NV21 colorspace");
|
| return ImageFormat.NV21;
|
| }
|
| }
|
| -
|
| + Log.d(TAG, "YV12 colorspace");
|
| return ImageFormat.YV12;
|
| }
|
| }
|
| @@ -238,6 +240,11 @@ public class VideoCapture implements PreviewCallback, OnFrameAvailableListener {
|
| }
|
|
|
| @CalledByNative
|
| + public int getColorspace() {
|
| + return mImageFormat;
|
| + }
|
| +
|
| + @CalledByNative
|
| public int startCapture() {
|
| if (mCamera == null) {
|
| Log.e(TAG, "startCapture: camera is null");
|
| @@ -325,9 +332,6 @@ public class VideoCapture implements PreviewCallback, OnFrameAvailableListener {
|
| } else {
|
| rotation = (mCameraOrientation - rotation + 360) % 360;
|
| }
|
| - if (mImageFormat == ImageFormat.NV21) {
|
| - convertNV21ToYV12(data);
|
| - }
|
| nativeOnFrameAvailable(mNativeVideoCaptureDeviceAndroid,
|
| data, mExpectedFrameSize,
|
| rotation, flipVertical, flipHorizontal);
|
| @@ -417,19 +421,5 @@ public class VideoCapture implements PreviewCallback, OnFrameAvailableListener {
|
|
|
| private void calculateImageFormat(int width, int height) {
|
| mImageFormat = DeviceImageFormatHack.getImageFormat();
|
| - if (mImageFormat == ImageFormat.NV21) {
|
| - mColorPlane = new byte[width * height / 4];
|
| - }
|
| - }
|
| -
|
| - private void convertNV21ToYV12(byte[] data) {
|
| - final int ySize = mCurrentCapability.mWidth * mCurrentCapability.mHeight;
|
| - final int uvSize = ySize / 4;
|
| - for (int i = 0; i < uvSize; i++) {
|
| - final int index = ySize + i * 2;
|
| - data[ySize + i] = data[index];
|
| - mColorPlane[i] = data[index + 1];
|
| - }
|
| - System.arraycopy(mColorPlane, 0, data, ySize + uvSize, uvSize);
|
| }
|
| }
|
|
|