Bug 1067442 - OMXCodecWrapper image validation supports input from WebrtcOMXH264VideoEncoder r=jesup

This commit is contained in:
John Lin 2014-09-24 09:21:16 -04:00
Родитель cc0da71edc
Коммит 1ede1934fa
2 изменённых файлов: 5 добавлений и 2 удалений

Просмотреть файл

@ -396,8 +396,10 @@ OMXVideoEncoder::Encode(const Image* aImage, int aWidth, int aHeight,
NS_ENSURE_TRUE(aWidth == size.width, NS_ERROR_INVALID_ARG);
NS_ENSURE_TRUE(aHeight == size.height, NS_ERROR_INVALID_ARG);
if (format == ImageFormat::PLANAR_YCBCR) {
NS_ENSURE_TRUE(static_cast<PlanarYCbCrImage*>(img)->IsValid(),
NS_ERROR_INVALID_ARG);
// Test for data, allowing SetDataNoCopy() on an image without an mBuffer
// (as used from WebrtcOMXH264VideoCodec, and a few other places) - bug 1067442
const PlanarYCbCrData* yuv = static_cast<PlanarYCbCrImage*>(img)->GetData();
NS_ENSURE_TRUE(yuv->mYChannel, NS_ERROR_INVALID_ARG);
} else if (format == ImageFormat::GRALLOC_PLANAR_YCBCR) {
// Reject unsupported gralloc-ed buffers.
int halFormat = static_cast<GrallocImage*>(img)->GetGraphicBuffer()->getPixelFormat();

Просмотреть файл

@ -958,6 +958,7 @@ WebrtcOMXH264VideoEncoder::Encode(const webrtc::I420VideoFrame& aInputImage,
yuvData.mPicSize = yuvData.mYSize;
yuvData.mStereoMode = StereoMode::MONO;
layers::PlanarYCbCrImage img(nullptr);
// SetDataNoCopy() doesn't need AllocateAndGetNewBuffer(); OMXVideoEncoder is ok with this
img.SetDataNoCopy(yuvData);
CODEC_LOGD("Encode frame: %dx%d, timestamp %u (%lld), renderTimeMs %u",