Bug 1346258: Fix disabling of sync texture usage. r=mattwoodrow
MozReview-Commit-ID: 4hIyoM7o6OQ
--- a/dom/media/platforms/wmf/DXVA2Manager.cpp
+++ b/dom/media/platforms/wmf/DXVA2Manager.cpp
@@ -878,17 +878,16 @@ D3D11DXVA2Manager::CreateOutputSample(Re
HRESULT
D3D11DXVA2Manager::CopyToImage(IMFSample* aVideoSample,
const nsIntRect& aRegion,
Image** aOutImage)
{
NS_ENSURE_TRUE(aVideoSample, E_POINTER);
NS_ENSURE_TRUE(aOutImage, E_POINTER);
- NS_ENSURE_TRUE(mSyncObject, E_FAIL);
MOZ_ASSERT(mTextureClientAllocator);
RefPtr<D3D11ShareHandleImage> image =
new D3D11ShareHandleImage(gfx::IntSize(mWidth, mHeight), aRegion);
bool ok = image->AllocateTexture(mTextureClientAllocator, mDevice);
NS_ENSURE_TRUE(ok, E_FAIL);
RefPtr<TextureClient> client = image->GetTextureClient(ImageBridgeChild::GetSingleton().get());
@@ -898,16 +897,18 @@ D3D11DXVA2Manager::CopyToImage(IMFSample
HRESULT hr;
RefPtr<ID3D11Texture2D> texture = image->GetTexture();
texture->QueryInterface((IDXGIKeyedMutex**)getter_AddRefs(mutex));
if (mutex) {
hr = mutex->AcquireSync(0, 2000);
NS_ENSURE_TRUE(SUCCEEDED(hr), hr);
+ } else {
+ NS_ENSURE_TRUE(mSyncObject, E_FAIL);
}
if (client && client->GetFormat() == SurfaceFormat::NV12) {
// Our video frame is stored in a non-sharable ID3D11Texture2D. We need
// to create a copy of that frame as a sharable resource, save its share
// handle, and put that handle into the rendering pipeline.
RefPtr<IMFMediaBuffer> buffer;