From 068593b23826c995f03559128041b922b68a916b Mon Sep 17 00:00:00 2001 From: Erich Hoover Date: Sat, 14 May 2011 11:44:59 -0600 Subject: [PATCH] quartz: Create and hold onto a preferred allocator for IAsyncReader::RequestAllocator. --- dlls/quartz/pin.c | 18 +++++++++++++++++- dlls/quartz/pin.h | 1 + 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/dlls/quartz/pin.c b/dlls/quartz/pin.c index bd5cffde7b4..2a3b2d1bb6c 100644 --- a/dlls/quartz/pin.c +++ b/dlls/quartz/pin.c @@ -283,6 +283,7 @@ HRESULT WINAPI PullPin_ReceiveConnection(IPin * iface, IPin * pReceivePin, const This->pReader = NULL; This->pAlloc = NULL; + This->prefAlloc = NULL; if (SUCCEEDED(hr)) { hr = IPin_QueryInterface(pReceivePin, &IID_IAsyncReader, (LPVOID *)&This->pReader); @@ -293,9 +294,19 @@ HRESULT WINAPI PullPin_ReceiveConnection(IPin * iface, IPin * pReceivePin, const hr = This->fnPreConnect(iface, pReceivePin, &props); } + /* + * Some custom filters (such as the one used by Fallout 3 + * and Fallout: New Vegas) expect to be passed a non-NULL + * preferred allocator. + */ if (SUCCEEDED(hr)) { - hr = IAsyncReader_RequestAllocator(This->pReader, NULL, &props, &This->pAlloc); + hr = StdMemAllocator_create(NULL, (LPVOID *) &This->prefAlloc); + } + + if (SUCCEEDED(hr)) + { + hr = IAsyncReader_RequestAllocator(This->pReader, This->prefAlloc, &props, &This->pAlloc); } if (SUCCEEDED(hr)) @@ -314,6 +325,9 @@ HRESULT WINAPI PullPin_ReceiveConnection(IPin * iface, IPin * pReceivePin, const if (This->pReader) IAsyncReader_Release(This->pReader); This->pReader = NULL; + if (This->prefAlloc) + IMemAllocator_Release(This->prefAlloc); + This->prefAlloc = NULL; if (This->pAlloc) IMemAllocator_Release(This->pAlloc); This->pAlloc = NULL; @@ -366,6 +380,8 @@ ULONG WINAPI PullPin_Release(IPin *iface) WaitForSingleObject(This->hEventStateChanged, INFINITE); assert(!This->hThread); + if(This->prefAlloc) + IMemAllocator_Release(This->prefAlloc); if(This->pAlloc) IMemAllocator_Release(This->pAlloc); if(This->pReader) diff --git a/dlls/quartz/pin.h b/dlls/quartz/pin.h index 732606138c2..de2ccd60152 100644 --- a/dlls/quartz/pin.h +++ b/dlls/quartz/pin.h @@ -73,6 +73,7 @@ typedef struct PullPin REFERENCE_TIME rtStart, rtCurrent, rtNext, rtStop; IAsyncReader * pReader; + IMemAllocator * prefAlloc; IMemAllocator * pAlloc; QUERYACCEPTPROC fnQueryAccept; SAMPLEPROC_PULL fnSampleProc;