mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-25 05:41:12 +00:00
Bug 1170143 - Add some error checks around the creation of dxgi ycbcr video frames. r=Bas
This commit is contained in:
parent
79367a49c7
commit
e845d9219c
@ -98,7 +98,7 @@ InitTextures(IDirect3DDevice9* aDevice,
|
||||
return result.forget();
|
||||
}
|
||||
|
||||
static void
|
||||
static bool
|
||||
FinishTextures(IDirect3DDevice9* aDevice,
|
||||
IDirect3DTexture9* aTexture,
|
||||
IDirect3DSurface9* aSurface)
|
||||
@ -107,10 +107,22 @@ FinishTextures(IDirect3DDevice9* aDevice,
|
||||
return;
|
||||
}
|
||||
|
||||
aSurface->UnlockRect();
|
||||
HRESULT hr = aSurface->UnlockRect();
|
||||
if (FAILED(hr)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
nsRefPtr<IDirect3DSurface9> dstSurface;
|
||||
aTexture->GetSurfaceLevel(0, getter_AddRefs(dstSurface));
|
||||
aDevice->UpdateSurface(aSurface, nullptr, dstSurface, nullptr);
|
||||
hr = aTexture->GetSurfaceLevel(0, getter_AddRefs(dstSurface));
|
||||
if (FAILED(hr)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
hr = aDevice->UpdateSurface(aSurface, nullptr, dstSurface, nullptr);
|
||||
if (FAILED(hr)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool UploadData(IDirect3DDevice9* aDevice,
|
||||
@ -137,8 +149,7 @@ static bool UploadData(IDirect3DDevice9* aDevice,
|
||||
}
|
||||
}
|
||||
|
||||
FinishTextures(aDevice, aTexture, surf);
|
||||
return true;
|
||||
return FinishTextures(aDevice, aTexture, surf);
|
||||
}
|
||||
|
||||
TextureClient*
|
||||
|
@ -564,6 +564,11 @@ DXGIYCbCrTextureClient::Create(ISurfaceAllocator* aAllocator,
|
||||
const gfx::IntSize& aSizeY,
|
||||
const gfx::IntSize& aSizeCbCr)
|
||||
{
|
||||
if (!aHandleY || !aHandleCb || !aHandleCr ||
|
||||
!aTextureY, || !aTextureCb || !aTextureCr) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
RefPtr<DXGIYCbCrTextureClient> texture =
|
||||
new DXGIYCbCrTextureClient(aAllocator, aFlags);
|
||||
texture->mHandles[0] = aHandleY;
|
||||
|
Loading…
Reference in New Issue
Block a user