Commit e0f4e10e authored by magjed's avatar magjed Committed by Commit bot

Revert of Mac Video Capture: Add support for pixel format NV12 for...

Revert of Mac Video Capture: Add support for pixel format NV12 for AVFoundation (patchset #2 id:60001 of https://codereview.chromium.org/860333003/)

Reason for revert:
Crashes on the assert that biplanar NV12 is tightly packed.

BUG=455618

Original issue's description:
> Mac Video Capture: Add support for pixel format NV12 for AVFoundation
>
> BUG=346634
>
> Committed: https://crrev.com/40c2c94fbd52f9748ee082573e07404ae2621b9b
> Cr-Commit-Position: refs/heads/master@{#313886}

TBR=perkj@chromium.org,tommi@chromium.org,mcasas@chromium.org
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=346634

Review URL: https://codereview.chromium.org/886933006

Cr-Commit-Position: refs/heads/master@{#314788}
parent bf657464
......@@ -8,7 +8,6 @@
#include "base/logging.h"
#include "base/mac/foundation_util.h"
#include "media/base/mac/corevideo_glue.h"
#include "media/video/capture/mac/video_capture_device_mac.h"
#include "ui/gfx/geometry/size.h"
......@@ -26,8 +25,6 @@ media::VideoPixelFormat FourCCToChromiumPixelFormat(FourCharCode code) {
return media::PIXEL_FORMAT_YUY2;
case CoreMediaGlue::kCMVideoCodecType_JPEG_OpenDML:
return media::PIXEL_FORMAT_MJPEG;
case CoreVideoGlue::kCVPixelFormatType_420YpCbCr8BiPlanarVideoRange:
return media::PIXEL_FORMAT_NV12;
default:
return media::PIXEL_FORMAT_UNKNOWN;
}
......@@ -315,31 +312,9 @@ media::VideoPixelFormat FourCCToChromiumPixelFormat(FourCharCode code) {
// Lock the frame and calculate frame size.
if (CVPixelBufferLockBaseAddress(videoFrame, kCVPixelBufferLock_ReadOnly) ==
kCVReturnSuccess) {
baseAddress = static_cast<char*>(
CVPixelBufferGetPlaneCount(videoFrame) == 0
? CVPixelBufferGetBaseAddress(videoFrame)
: CVPixelBufferGetBaseAddressOfPlane(videoFrame, 0));
// Chromium expects the data to be tightly packed, i.e. no row padding
// and the planes should follow consecutively.
switch (captureFormat.pixel_format) {
case media::PIXEL_FORMAT_YUY2:
case media::PIXEL_FORMAT_UYVY:
CHECK_EQ(CVPixelBufferGetBytesPerRow(videoFrame),
static_cast<size_t>(2 * captureFormat.frame_size.width()));
frameSize = captureFormat.frame_size.GetArea() * 16 / 8; // 16bpp.
break;
case media::PIXEL_FORMAT_NV12:
CHECK_EQ(CVPixelBufferGetBytesPerRowOfPlane(videoFrame, 0),
static_cast<size_t>(captureFormat.frame_size.width()));
CHECK_EQ(CVPixelBufferGetBytesPerRowOfPlane(videoFrame, 1),
static_cast<size_t>(captureFormat.frame_size.width()));
CHECK_EQ(CVPixelBufferGetBaseAddressOfPlane(videoFrame, 1),
baseAddress + captureFormat.frame_size.GetArea());
frameSize = captureFormat.frame_size.GetArea() * 12 / 8; // 12bpp.
break;
default:
NOTREACHED();
}
baseAddress = static_cast<char*>(CVPixelBufferGetBaseAddress(videoFrame));
frameSize = CVPixelBufferGetHeight(videoFrame) *
CVPixelBufferGetBytesPerRow(videoFrame);
} else {
videoFrame = nil;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment