Bug 1464698 - avoid creating wrapping source surface when GetBuffer fails. r=nical

We shouldn't be trying to create the wrapping source surface here here GetBuffer
fails - in this case because of a shmem allocation failure. There are already ample
log notes about the failure so just bailing out and not spewing more warning spam
here seems like the right thing to do. Downwind code already deals with mFirstSource
not being set, so we should be safe.

Differential Revision: https://phabricator.services.mozilla.com/D100739
This commit is contained in:
Lee Salzman 2021-01-05 10:58:39 +00:00
parent b3d468a5e8
commit f36bfe25d7

View File

@ -818,11 +818,14 @@ bool BufferTextureHost::EnsureWrappingTextureSource() {
if (mFormat == gfx::SurfaceFormat::YUV) {
mFirstSource = mProvider->CreateDataTextureSourceAroundYCbCr(this);
} else {
uint8_t* data = GetBuffer();
if (!data) {
return false;
}
RefPtr<gfx::DataSourceSurface> surf =
gfx::Factory::CreateWrappingDataSourceSurface(
GetBuffer(),
ImageDataSerializer::ComputeRGBStride(mFormat, mSize.width), mSize,
mFormat);
data, ImageDataSerializer::ComputeRGBStride(mFormat, mSize.width),
mSize, mFormat);
if (!surf) {
return false;
}