quartz: Fix bug in memallocator with test.
This commit is contained in:
parent
928914c81e
commit
1fad872961
@ -237,13 +237,13 @@ static HRESULT WINAPI BaseMemAllocator_Commit(IMemAllocator * iface)
|
|||||||
{
|
{
|
||||||
if (!This->pProps)
|
if (!This->pProps)
|
||||||
hr = VFW_E_SIZENOTSET;
|
hr = VFW_E_SIZENOTSET;
|
||||||
else if (This->bCommitted)
|
else if (This->bDecommitQueued && This->bCommitted)
|
||||||
hr = S_OK;
|
|
||||||
else if (This->bDecommitQueued)
|
|
||||||
{
|
{
|
||||||
This->bDecommitQueued = FALSE;
|
This->bDecommitQueued = FALSE;
|
||||||
hr = S_OK;
|
hr = S_OK;
|
||||||
}
|
}
|
||||||
|
else if (This->bCommitted)
|
||||||
|
hr = S_OK;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (!(This->hSemWaiting = CreateSemaphoreW(NULL, This->pProps->cBuffers, This->pProps->cBuffers, NULL)))
|
if (!(This->hSemWaiting = CreateSemaphoreW(NULL, This->pProps->cBuffers, This->pProps->cBuffers, NULL)))
|
||||||
|
@ -37,13 +37,15 @@ static void CommitDecommitTest(void)
|
|||||||
|
|
||||||
if (hr == S_OK)
|
if (hr == S_OK)
|
||||||
{
|
{
|
||||||
ALLOCATOR_PROPERTIES RequestedProps;
|
ALLOCATOR_PROPERTIES RequestedProps;
|
||||||
ALLOCATOR_PROPERTIES ActualProps;
|
ALLOCATOR_PROPERTIES ActualProps;
|
||||||
|
|
||||||
RequestedProps.cBuffers = 1;
|
IMediaSample *sample = NULL, *sample2 = NULL;
|
||||||
RequestedProps.cbBuffer = 65536;
|
|
||||||
RequestedProps.cbAlign = 1;
|
RequestedProps.cBuffers = 2;
|
||||||
RequestedProps.cbPrefix = 0;
|
RequestedProps.cbBuffer = 65536;
|
||||||
|
RequestedProps.cbAlign = 1;
|
||||||
|
RequestedProps.cbPrefix = 0;
|
||||||
|
|
||||||
hr = IMemAllocator_SetProperties(pMemAllocator, &RequestedProps, &ActualProps);
|
hr = IMemAllocator_SetProperties(pMemAllocator, &RequestedProps, &ActualProps);
|
||||||
ok(hr==S_OK, "SetProperties returned: %x\n", hr);
|
ok(hr==S_OK, "SetProperties returned: %x\n", hr);
|
||||||
@ -53,12 +55,30 @@ static void CommitDecommitTest(void)
|
|||||||
hr = IMemAllocator_Commit(pMemAllocator);
|
hr = IMemAllocator_Commit(pMemAllocator);
|
||||||
ok(hr==S_OK, "Commit returned: %x\n", hr);
|
ok(hr==S_OK, "Commit returned: %x\n", hr);
|
||||||
|
|
||||||
|
hr = IMemAllocator_GetBuffer(pMemAllocator, &sample, NULL, NULL, 0);
|
||||||
|
ok(hr==S_OK, "Could not get a buffer: %x\n", hr);
|
||||||
|
|
||||||
hr = IMemAllocator_Decommit(pMemAllocator);
|
hr = IMemAllocator_Decommit(pMemAllocator);
|
||||||
ok(hr==S_OK, "Decommit returned: %x\n", hr);
|
ok(hr==S_OK, "Decommit returned: %x\n", hr);
|
||||||
hr = IMemAllocator_Decommit(pMemAllocator);
|
hr = IMemAllocator_Decommit(pMemAllocator);
|
||||||
ok(hr==S_OK, "Cecommit returned: %x\n", hr);
|
ok(hr==S_OK, "Cecommit returned: %x\n", hr);
|
||||||
|
|
||||||
IMemAllocator_Release(pMemAllocator);
|
/* Decommit and recommit while holding a sample */
|
||||||
|
if (sample)
|
||||||
|
{
|
||||||
|
hr = IMemAllocator_Commit(pMemAllocator);
|
||||||
|
ok(hr==S_OK, "Commit returned: %x\n", hr);
|
||||||
|
|
||||||
|
hr = IMemAllocator_GetBuffer(pMemAllocator, &sample2, NULL, NULL, 0);
|
||||||
|
ok(hr==S_OK, "Could not get a buffer: %x\n", hr);
|
||||||
|
IUnknown_Release(sample);
|
||||||
|
if (sample2)
|
||||||
|
IUnknown_Release(sample2);
|
||||||
|
|
||||||
|
hr = IMemAllocator_Decommit(pMemAllocator);
|
||||||
|
ok(hr==S_OK, "Cecommit returned: %x\n", hr);
|
||||||
|
}
|
||||||
|
IMemAllocator_Release(pMemAllocator);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user