From 8d3392a8ce4e75eaca858c2c96f666f1ab57834e Mon Sep 17 00:00:00 2001 From: Akihiro Sagawa Date: Wed, 9 Nov 2016 22:28:20 +0900 Subject: [PATCH] winegstreamer: Always pass non-NULL preferred allocator to IAsyncReader::RequestAllocator. This fixes video playback issue in a certain application. The approach is very similar to 068593b23826c995f03559128041b922b68a916b. Signed-off-by: Akihiro Sagawa Signed-off-by: Andrew Eikum Signed-off-by: Alexandre Julliard --- dlls/winegstreamer/gstdemux.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/dlls/winegstreamer/gstdemux.c b/dlls/winegstreamer/gstdemux.c index 5db99c88ab..a6a41ab753 100644 --- a/dlls/winegstreamer/gstdemux.c +++ b/dlls/winegstreamer/gstdemux.c @@ -1963,6 +1963,7 @@ static HRESULT WINAPI GSTInPin_ReceiveConnection(IPin *iface, IPin *pReceivePin, EnterCriticalSection(This->pin.pCritSec); if (!This->pin.pConnectedTo) { ALLOCATOR_PROPERTIES props; + IMemAllocator *pAlloc = NULL; props.cBuffers = 8; props.cbBuffer = 16384; @@ -1986,8 +1987,19 @@ static HRESULT WINAPI GSTInPin_ReceiveConnection(IPin *iface, IPin *pReceivePin, hr = IPin_QueryInterface(pReceivePin, &IID_IAsyncReader, (LPVOID *)&This->pReader); if (SUCCEEDED(hr)) hr = GST_Connect(This, pReceivePin, &props); + + /* A certain IAsyncReader::RequestAllocator expects to be passed + non-NULL preferred allocator */ if (SUCCEEDED(hr)) - hr = IAsyncReader_RequestAllocator(This->pReader, NULL, &props, &This->pAlloc); + hr = CoCreateInstance(&CLSID_MemoryAllocator, NULL, CLSCTX_INPROC, + &IID_IMemAllocator, (LPVOID *)&pAlloc); + if (SUCCEEDED(hr)) { + hr = IAsyncReader_RequestAllocator(This->pReader, pAlloc, &props, &This->pAlloc); + if (FAILED(hr)) + WARN("Can't get an allocator, got %08x\n", hr); + } + if (pAlloc) + IMemAllocator_Release(pAlloc); if (SUCCEEDED(hr)) { CopyMediaType(&This->pin.mtCurrent, pmt); This->pin.pConnectedTo = pReceivePin;