qcap: Get rid of an unnecessary allocation and copy.
Signed-off-by: Zebediah Figura <z.figura12@gmail.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
e32dead363
commit
2011518d30
|
@ -367,7 +367,7 @@ static DWORD WINAPI ReadThread(LPVOID lParam)
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
IMediaSample *pSample = NULL;
|
IMediaSample *pSample = NULL;
|
||||||
ULONG framecount = 0;
|
ULONG framecount = 0;
|
||||||
unsigned char *pTarget, *pOutput;
|
unsigned char *pTarget;
|
||||||
|
|
||||||
capBox->image_size = capBox->height * capBox->width * 3;
|
capBox->image_size = capBox->height * capBox->width * 3;
|
||||||
if (!(capBox->image_data = heap_alloc(capBox->image_size)))
|
if (!(capBox->image_data = heap_alloc(capBox->image_size)))
|
||||||
|
@ -378,8 +378,6 @@ static DWORD WINAPI ReadThread(LPVOID lParam)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
pOutput = CoTaskMemAlloc(capBox->width * capBox->height * capBox->bitDepth / 8);
|
|
||||||
|
|
||||||
while (1)
|
while (1)
|
||||||
{
|
{
|
||||||
EnterCriticalSection(&capBox->CritSect);
|
EnterCriticalSection(&capBox->CritSect);
|
||||||
|
@ -410,8 +408,7 @@ static DWORD WINAPI ReadThread(LPVOID lParam)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
memcpy(pOutput, capBox->image_data, len);
|
Resize(capBox, pTarget, capBox->image_data);
|
||||||
Resize(capBox, pTarget, pOutput);
|
|
||||||
hr = BaseOutputPinImpl_Deliver((BaseOutputPin *)capBox->pOut, pSample);
|
hr = BaseOutputPinImpl_Deliver((BaseOutputPin *)capBox->pOut, pSample);
|
||||||
TRACE("%p -> Frame %u: %x\n", capBox, ++framecount, hr);
|
TRACE("%p -> Frame %u: %x\n", capBox, ++framecount, hr);
|
||||||
IMediaSample_Release(pSample);
|
IMediaSample_Release(pSample);
|
||||||
|
@ -428,7 +425,6 @@ static DWORD WINAPI ReadThread(LPVOID lParam)
|
||||||
}
|
}
|
||||||
|
|
||||||
LeaveCriticalSection(&capBox->CritSect);
|
LeaveCriticalSection(&capBox->CritSect);
|
||||||
CoTaskMemFree(pOutput);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue