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:
Zebediah Figura 2019-04-10 22:32:02 -05:00 committed by Alexandre Julliard
parent e32dead363
commit 2011518d30
1 changed files with 2 additions and 6 deletions

View File

@ -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;
} }