diff --git a/content/media/omx/OMXCodecWrapper.cpp b/content/media/omx/OMXCodecWrapper.cpp index 60eb854f7542..f8068d3babb2 100644 --- a/content/media/omx/OMXCodecWrapper.cpp +++ b/content/media/omx/OMXCodecWrapper.cpp @@ -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(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(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(img)->GetGraphicBuffer()->getPixelFormat(); diff --git a/media/webrtc/signaling/src/media-conduit/WebrtcOMXH264VideoCodec.cpp b/media/webrtc/signaling/src/media-conduit/WebrtcOMXH264VideoCodec.cpp index a12413e3d646..884cf64fcd40 100644 --- a/media/webrtc/signaling/src/media-conduit/WebrtcOMXH264VideoCodec.cpp +++ b/media/webrtc/signaling/src/media-conduit/WebrtcOMXH264VideoCodec.cpp @@ -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",