Bug 1295921 - PA: Return blank decoder to being green. r?jwwang
MozReview-Commit-ID: 44QZeHKlt3o
--- a/dom/media/platforms/agnostic/BlankDecoderModule.cpp
+++ b/dom/media/platforms/agnostic/BlankDecoderModule.cpp
@@ -39,50 +39,46 @@ public:
mInfo.mDisplay = nsIntSize(mFrameWidth, mFrameHeight);
mPicture = gfx::IntRect(0, 0, mFrameWidth, mFrameHeight);
}
already_AddRefed<MediaData> Create(MediaRawData* aSample)
{
// Create a fake YUV buffer in a 420 format. That is, an 8bpp Y plane,
// with a U and V plane that are half the size of the Y plane, i.e 8 bit,
- // 2x2 subsampled.
- const int sizeY = mFrameWidth * mFrameHeight;
- const int sizeCbCr = ((mFrameWidth + 1) / 2) * ((mFrameHeight + 1) / 2);
- auto frame = MakeUnique<uint8_t[]>(sizeY + sizeCbCr);
+ // 2x2 subsampled. Have the data pointer of each frame point to the
+ // first plane, they'll always be zero'd memory anyway.
+ auto frame = MakeUnique<uint8_t[]>(mFrameWidth * mFrameHeight);
+ memset(frame.get(), 0, mFrameWidth * mFrameHeight);
VideoData::YCbCrBuffer buffer;
// Y plane.
buffer.mPlanes[0].mData = frame.get();
buffer.mPlanes[0].mStride = mFrameWidth;
buffer.mPlanes[0].mHeight = mFrameHeight;
buffer.mPlanes[0].mWidth = mFrameWidth;
buffer.mPlanes[0].mOffset = 0;
buffer.mPlanes[0].mSkip = 0;
// Cb plane.
- buffer.mPlanes[1].mData = frame.get() + sizeY;
+ buffer.mPlanes[1].mData = frame.get();
buffer.mPlanes[1].mStride = mFrameWidth / 2;
buffer.mPlanes[1].mHeight = mFrameHeight / 2;
buffer.mPlanes[1].mWidth = mFrameWidth / 2;
buffer.mPlanes[1].mOffset = 0;
buffer.mPlanes[1].mSkip = 0;
// Cr plane.
- buffer.mPlanes[2].mData = frame.get() + sizeY;
+ buffer.mPlanes[2].mData = frame.get();
buffer.mPlanes[2].mStride = mFrameWidth / 2;
buffer.mPlanes[2].mHeight = mFrameHeight / 2;
buffer.mPlanes[2].mWidth = mFrameWidth / 2;
buffer.mPlanes[2].mOffset = 0;
buffer.mPlanes[2].mSkip = 0;
- // Set to color white.
- memset(buffer.mPlanes[0].mData, 255, sizeY);
- memset(buffer.mPlanes[1].mData, 128, sizeCbCr);
-
return VideoData::CreateAndCopyData(mInfo,
mImageContainer,
aSample->mOffset,
aSample->mTime,
aSample->mDuration,
buffer,
aSample->mKeyframe,
aSample->mTime,