Nikolay Sivov : strmbase: Allocate sample list as a part of queue structure.
Alexandre Julliard
julliard at winehq.org
Fri Nov 25 14:19:18 CST 2016
Module: wine
Branch: master
Commit: 89763f0e954c751975f70acd3fe40676d28bda89
URL: http://source.winehq.org/git/wine.git/?a=commit;h=89763f0e954c751975f70acd3fe40676d28bda89
Author: Nikolay Sivov <nsivov at codeweavers.com>
Date: Fri Nov 25 12:10:45 2016 +0300
strmbase: Allocate sample list as a part of queue structure.
Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/strmbase/outputqueue.c | 33 ++++++++++++---------------------
include/wine/strmbase.h | 4 +++-
2 files changed, 15 insertions(+), 22 deletions(-)
diff --git a/dlls/strmbase/outputqueue.c b/dlls/strmbase/outputqueue.c
index 842a9f0..5513193 100644
--- a/dlls/strmbase/outputqueue.c
+++ b/dlls/strmbase/outputqueue.c
@@ -49,7 +49,7 @@ static DWORD WINAPI OutputQueue_InitialThreadProc(LPVOID data)
static void OutputQueue_FreeSamples(OutputQueue *pOutputQueue)
{
struct list *cursor, *cursor2;
- LIST_FOR_EACH_SAFE(cursor, cursor2, pOutputQueue->SampleList)
+ LIST_FOR_EACH_SAFE(cursor, cursor2, &pOutputQueue->SampleList)
{
QueuedEvent *qev = LIST_ENTRY(cursor, QueuedEvent, entry);
list_remove(cursor);
@@ -86,14 +86,7 @@ HRESULT WINAPI OutputQueue_Construct(
This->bBatchExact = bBatchExact;
InitializeCriticalSection(&This->csQueue);
This->csQueue.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": OutputQueue.csQueue");
- This->SampleList = HeapAlloc(GetProcessHeap(),0,sizeof(struct list));
- if (!This->SampleList)
- {
- OutputQueue_Destroy(This);
- *ppOutputQueue = NULL;
- return E_OUTOFMEMORY;
- }
- list_init(This->SampleList);
+ list_init(&This->SampleList);
This->pInputPin = pInputPin;
IPin_AddRef(&pInputPin->pin.IPin_iface);
@@ -130,8 +123,6 @@ HRESULT WINAPI OutputQueue_Destroy(OutputQueue *pOutputQueue)
DeleteCriticalSection(&pOutputQueue->csQueue);
CloseHandle(pOutputQueue->hProcessQueue);
- HeapFree(GetProcessHeap(),0,pOutputQueue->SampleList);
-
IPin_Release(&pOutputQueue->pInputPin->pin.IPin_iface);
HeapFree(GetProcessHeap(),0,pOutputQueue);
return S_OK;
@@ -168,11 +159,11 @@ HRESULT WINAPI OutputQueue_ReceiveMultiple(OutputQueue *pOutputQueue, IMediaSamp
qev->type = SAMPLE_PACKET;
qev->pSample = ppSamples[i];
IMediaSample_AddRef(ppSamples[i]);
- list_add_tail(pOutputQueue->SampleList, &qev->entry);
+ list_add_tail(&pOutputQueue->SampleList, &qev->entry);
(*nSamplesProcessed)++;
}
- if (!pOutputQueue->bBatchExact || list_count(pOutputQueue->SampleList) >= pOutputQueue->lBatchSize)
+ if (!pOutputQueue->bBatchExact || list_count(&pOutputQueue->SampleList) >= pOutputQueue->lBatchSize)
SetEvent(pOutputQueue->hProcessQueue);
LeaveCriticalSection(&pOutputQueue->csQueue);
}
@@ -190,7 +181,7 @@ VOID WINAPI OutputQueue_SendAnyway(OutputQueue *pOutputQueue)
if (pOutputQueue->hThread)
{
EnterCriticalSection(&pOutputQueue->csQueue);
- if (!list_empty(pOutputQueue->SampleList))
+ if (!list_empty(&pOutputQueue->SampleList))
{
pOutputQueue->bSendAnyway = TRUE;
SetEvent(pOutputQueue->hProcessQueue);
@@ -213,7 +204,7 @@ VOID WINAPI OutputQueue_EOS(OutputQueue *pOutputQueue)
}
qev->type = EOS_PACKET;
qev->pSample = NULL;
- list_add_tail(pOutputQueue->SampleList, &qev->entry);
+ list_add_tail(&pOutputQueue->SampleList, &qev->entry);
}
else
{
@@ -235,14 +226,14 @@ DWORD WINAPI OutputQueueImpl_ThreadProc(OutputQueue *pOutputQueue)
do
{
EnterCriticalSection(&pOutputQueue->csQueue);
- if (!list_empty(pOutputQueue->SampleList) &&
+ if (!list_empty(&pOutputQueue->SampleList) &&
(!pOutputQueue->bBatchExact ||
- list_count(pOutputQueue->SampleList) >= pOutputQueue->lBatchSize ||
+ list_count(&pOutputQueue->SampleList) >= pOutputQueue->lBatchSize ||
pOutputQueue->bSendAnyway
)
)
{
- while (!list_empty(pOutputQueue->SampleList))
+ while (!list_empty(&pOutputQueue->SampleList))
{
IMediaSample **ppSamples;
LONG nSamples;
@@ -251,10 +242,10 @@ DWORD WINAPI OutputQueueImpl_ThreadProc(OutputQueue *pOutputQueue)
int i = 0;
/* First Pass Process Samples */
- i = list_count(pOutputQueue->SampleList);
+ i = list_count(&pOutputQueue->SampleList);
ppSamples = HeapAlloc(GetProcessHeap(),0,sizeof(IMediaSample*) * i);
nSamples = 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 == SAMPLE_PACKET)
@@ -278,7 +269,7 @@ DWORD WINAPI OutputQueueImpl_ThreadProc(OutputQueue *pOutputQueue)
HeapFree(GetProcessHeap(),0,ppSamples);
/* Process Non-Samples */
- 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)
diff --git a/include/wine/strmbase.h b/include/wine/strmbase.h
index 841359d..abe92ae 100644
--- a/include/wine/strmbase.h
+++ b/include/wine/strmbase.h
@@ -19,6 +19,8 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
+#include "wine/list.h"
+
HRESULT WINAPI CopyMediaType(AM_MEDIA_TYPE * pDest, const AM_MEDIA_TYPE *pSrc);
void WINAPI FreeMediaType(AM_MEDIA_TYPE * pMediaType);
AM_MEDIA_TYPE * WINAPI CreateMediaType(AM_MEDIA_TYPE const * pSrc);
@@ -351,7 +353,7 @@ typedef struct tagOutputQueue {
BOOL bTerminate;
BOOL bSendAnyway;
- struct list *SampleList;
+ struct list SampleList;
const struct OutputQueueFuncTable* pFuncsTable;
} OutputQueue;
More information about the wine-cvs
mailing list