Fixed a crash with thread creation in DShowPlugin

master
palana 2013-07-06 23:45:57 +02:00
parent 093ef3eedb
commit d3102d28f5
2 changed files with 9 additions and 9 deletions

View File

@ -403,13 +403,6 @@ bool DeviceSource::LoadFilters()
AppWarning(TEXT("DShowPlugin: Could not create color space conversion pixel shader"));
goto cleanFinish;
}
int numThreads = MAX(OSGetTotalCores()-2, 1);
if(colorType == DeviceOutputType_YV12 || colorType == DeviceOutputType_I420)
{
for(int i=0; i<numThreads; i++)
hConvertThreads[i] = OSCreateThread((XTHREAD)PackPlanarThread, convertData+i);
}
//------------------------------------------------
// set chroma details
@ -659,6 +652,7 @@ bool DeviceSource::LoadFilters()
renderCX *= 2;
}
int numThreads = MAX(OSGetTotalCores()-2, 1);
for(int i=0; i<numThreads; i++)
{
convertData[i].width = lineSize;
@ -680,6 +674,12 @@ bool DeviceSource::LoadFilters()
convertData[i].endY = ((renderCY/numThreads)*(i+1)) & 0xFFFFFFFE;
}
if(colorType == DeviceOutputType_YV12 || colorType == DeviceOutputType_I420)
{
for(int i=0; i<numThreads; i++)
hConvertThreads[i] = OSCreateThread((XTHREAD)PackPlanarThread, convertData+i);
}
bSucceeded = true;
cleanFinish:

View File

@ -35,8 +35,8 @@ void PackPlanar(LPBYTE convertBuffer, LPBYTE lpPlanar, UINT renderCX, UINT rende
{
LPBYTE lpLum1 = input + y*2*linePitch;
LPBYTE lpLum2 = lpLum1 + linePitch;
LPBYTE lpChroma1 = input2 + y*linePitch/2;
LPBYTE lpChroma2 = input3 + y*linePitch/2;
LPBYTE lpChroma1 = input2 + y*(linePitch/2);
LPBYTE lpChroma2 = input3 + y*(linePitch/2);
LPDWORD output1 = (LPDWORD)(output + (y*2)*pitch);
LPDWORD output2 = (LPDWORD)(((LPBYTE)output1)+pitch);