strmbase: Use !list_empty() instead of list_count() > 0.

This commit is contained in:
Jörg Höhle 2011-06-15 22:21:50 +02:00 committed by Alexandre Julliard
parent bcd2d0ec5b
commit 155e4fb6d3
1 changed files with 18 additions and 21 deletions

View File

@ -171,10 +171,10 @@ HRESULT WINAPI OutputQueue_ReceiveMultiple(OutputQueue *pOutputQueue, IMediaSamp
list_add_tail(pOutputQueue->SampleList, &qev->entry); list_add_tail(pOutputQueue->SampleList, &qev->entry);
(*nSamplesProcessed)++; (*nSamplesProcessed)++;
} }
LeaveCriticalSection(&pOutputQueue->csQueue);
if (!pOutputQueue->bBatchExact || list_count(pOutputQueue->SampleList) >= pOutputQueue->lBatchSize) if (!pOutputQueue->bBatchExact || list_count(pOutputQueue->SampleList) >= pOutputQueue->lBatchSize)
SetEvent(pOutputQueue->hProcessQueue); SetEvent(pOutputQueue->hProcessQueue);
LeaveCriticalSection(&pOutputQueue->csQueue);
} }
return hr; return hr;
} }
@ -190,7 +190,7 @@ VOID WINAPI OutputQueue_SendAnyway(OutputQueue *pOutputQueue)
if (pOutputQueue->hThread) if (pOutputQueue->hThread)
{ {
EnterCriticalSection(&pOutputQueue->csQueue); EnterCriticalSection(&pOutputQueue->csQueue);
if (list_count(pOutputQueue->SampleList) > 0) if (!list_empty(pOutputQueue->SampleList))
{ {
pOutputQueue->bSendAnyway = TRUE; pOutputQueue->bSendAnyway = TRUE;
SetEvent(pOutputQueue->hProcessQueue); SetEvent(pOutputQueue->hProcessQueue);
@ -235,14 +235,14 @@ DWORD WINAPI OutputQueueImpl_ThreadProc(OutputQueue *pOutputQueue)
do do
{ {
EnterCriticalSection(&pOutputQueue->csQueue); EnterCriticalSection(&pOutputQueue->csQueue);
if (list_count(pOutputQueue->SampleList) > 0 && if (!list_empty(pOutputQueue->SampleList) &&
(!pOutputQueue->bBatchExact || (!pOutputQueue->bBatchExact ||
list_count(pOutputQueue->SampleList) >= pOutputQueue->lBatchSize || list_count(pOutputQueue->SampleList) >= pOutputQueue->lBatchSize ||
pOutputQueue->bSendAnyway pOutputQueue->bSendAnyway
) )
) )
{ {
while (list_count(pOutputQueue->SampleList) > 0) while (!list_empty(pOutputQueue->SampleList))
{ {
IMediaSample **ppSamples; IMediaSample **ppSamples;
LONG nSamples; LONG nSamples;
@ -278,28 +278,25 @@ DWORD WINAPI OutputQueueImpl_ThreadProc(OutputQueue *pOutputQueue)
HeapFree(GetProcessHeap(),0,ppSamples); HeapFree(GetProcessHeap(),0,ppSamples);
/* Process Non-Samples */ /* Process Non-Samples */
if (list_count(pOutputQueue->SampleList) > 0) LIST_FOR_EACH_SAFE(cursor, cursor2, pOutputQueue->SampleList)
{ {
LIST_FOR_EACH_SAFE(cursor, cursor2, pOutputQueue->SampleList) QueuedEvent *qev = LIST_ENTRY(cursor, QueuedEvent, entry);
if (qev->type == EOS_PACKET)
{ {
QueuedEvent *qev = LIST_ENTRY(cursor, QueuedEvent, entry); IPin* ppin = NULL;
if (qev->type == EOS_PACKET) IPin_ConnectedTo((IPin*)pOutputQueue->pInputPin, &ppin);
if (ppin)
{ {
IPin* ppin = NULL; IPin_EndOfStream(ppin);
IPin_ConnectedTo((IPin*)pOutputQueue->pInputPin, &ppin); IPin_Release(ppin);
if (ppin)
{
IPin_EndOfStream(ppin);
IPin_Release(ppin);
}
} }
else if (qev->type == SAMPLE_PACKET)
break;
else
FIXME("Unhandled Event type %i\n",qev->type);
list_remove(cursor);
HeapFree(GetProcessHeap(),0,qev);
} }
else if (qev->type == SAMPLE_PACKET)
break;
else
FIXME("Unhandled Event type %i\n",qev->type);
list_remove(cursor);
HeapFree(GetProcessHeap(),0,qev);
} }
} }
pOutputQueue->bSendAnyway = FALSE; pOutputQueue->bSendAnyway = FALSE;