mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-15 22:35:43 +00:00
Bug 1206708 - Allow YUV images with gaps between planes in MediaPipelineTransmit. r=jesup
MozReview-Commit-ID: HZwQK8guBEr --HG-- extra : rebase_source : 6e6e7d17342d37315848ab516be4e7e5469cc684
This commit is contained in:
parent
4abd5e4c78
commit
4626d0a22c
@ -352,44 +352,23 @@ protected:
|
||||
uint8_t *y = data->mYChannel;
|
||||
uint8_t *cb = data->mCbChannel;
|
||||
uint8_t *cr = data->mCrChannel;
|
||||
int32_t yStride = data->mYStride;
|
||||
int32_t cbCrStride = data->mCbCrStride;
|
||||
uint32_t width = yuv->GetSize().width;
|
||||
uint32_t height = yuv->GetSize().height;
|
||||
uint32_t length = yuv->GetDataSize();
|
||||
// NOTE: length may be rounded up or include 'other' data (see
|
||||
// YCbCrImageDataDeserializerBase::ComputeMinBufferSize())
|
||||
|
||||
// XXX Consider modifying these checks if we ever implement
|
||||
// any subclasses of PlanarYCbCrImage that allow disjoint buffers such
|
||||
// that y+3(width*height)/2 might go outside the allocation or there are
|
||||
// pads between y, cr and cb.
|
||||
// GrallocImage can have wider strides, and so in some cases
|
||||
// would encode as garbage. If we need to encode it we'll either want to
|
||||
// modify SendVideoFrame or copy/move the data in the buffer.
|
||||
if (cb == (y + YSIZE(width, height)) &&
|
||||
cr == (cb + CRSIZE(width, height)) &&
|
||||
length >= I420SIZE(width, height)) {
|
||||
MOZ_MTLOG(ML_DEBUG, "Sending an I420 video frame");
|
||||
VideoFrameConverted(y, I420SIZE(width, height), width, height, mozilla::kVideoI420, 0);
|
||||
webrtc::I420VideoFrame i420_frame;
|
||||
int rv = i420_frame.CreateFrame(y, cb, cr, width, height,
|
||||
yStride, cbCrStride, cbCrStride,
|
||||
webrtc::kVideoRotation_0);
|
||||
if (rv != 0) {
|
||||
NS_ERROR("Creating an I420 frame failed");
|
||||
return;
|
||||
} else {
|
||||
MOZ_MTLOG(ML_ERROR, "Unsupported PlanarYCbCrImage format: "
|
||||
"width=" << width << ", height=" << height << ", y=" << y
|
||||
<< "\n Expected: cb=y+" << YSIZE(width, height)
|
||||
<< ", cr=y+" << YSIZE(width, height)
|
||||
+ CRSIZE(width, height)
|
||||
<< "\n Observed: cb=y+" << cb - y
|
||||
<< ", cr=y+" << cr - y
|
||||
<< "\n ystride=" << data->mYStride
|
||||
<< ", yskip=" << data->mYSkip
|
||||
<< "\n cbcrstride=" << data->mCbCrStride
|
||||
<< ", cbskip=" << data->mCbSkip
|
||||
<< ", crskip=" << data->mCrSkip
|
||||
<< "\n ywidth=" << data->mYSize.width
|
||||
<< ", yheight=" << data->mYSize.height
|
||||
<< "\n cbcrwidth=" << data->mCbCrSize.width
|
||||
<< ", cbcrheight=" << data->mCbCrSize.height);
|
||||
NS_ASSERTION(false, "Unsupported PlanarYCbCrImage format");
|
||||
}
|
||||
|
||||
MOZ_MTLOG(ML_DEBUG, "Sending an I420 video frame");
|
||||
VideoFrameConverted(i420_frame);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user