From db3c6e04050072cccc7626115143b529afa5b302 Mon Sep 17 00:00:00 2001 From: Maarten Lankhorst Date: Fri, 21 Mar 2008 14:56:40 -0700 Subject: [PATCH] quartz: Play silence in directsound renderer on end of stream notification --- dlls/quartz/dsoundrender.c | 16 +++++++++++++--- 1 files changed, 13 insertions(+), 3 deletions(-) diff --git a/dlls/quartz/dsoundrender.c b/dlls/quartz/dsoundrender.c index ec1b9fe..5cb1f61 100644 --- a/dlls/quartz/dsoundrender.c +++ b/dlls/quartz/dsoundrender.c @@ -252,7 +252,6 @@ static HRESULT DSoundRender_Sample(LPVOID iface, IMediaSample * pSample) ERR("Cannot get sample time (%x)\n", hr); cbSrcStream = IMediaSample_GetActualDataLength(pSample); - TRACE("Sample data ptr = %p, size = %ld\n", pbSrcStream, cbSrcStream); #if 0 /* For debugging purpose */ @@ -796,15 +795,26 @@ static HRESULT WINAPI DSoundRender_InputPin_Disconnect(IPin * iface) static HRESULT WINAPI DSoundRender_InputPin_EndOfStream(IPin * iface) { InputPin* This = (InputPin*)iface; + DSoundRenderImpl *me = (DSoundRenderImpl*)This->pin.pinInfo.pFilter; IMediaEventSink* pEventSink; HRESULT hr; TRACE("(%p/%p)->()\n", This, iface); + InputPin_EndOfStream(iface); - hr = IFilterGraph_QueryInterface(((DSoundRenderImpl*)This->pin.pinInfo.pFilter)->filterInfo.pGraph, &IID_IMediaEventSink, (LPVOID*)&pEventSink); + hr = IFilterGraph_QueryInterface(me->filterInfo.pGraph, &IID_IMediaEventSink, (LPVOID*)&pEventSink); if (SUCCEEDED(hr)) { - /* FIXME: We should wait that all audio data has been played */ + BYTE * silence; + + silence = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, me->buf_size); + if (silence) + { + memset(silence, 0, me->buf_size); + DSoundRender_SendSampleData((DSoundRenderImpl*)This->pin.pinInfo.pFilter, silence, me->buf_size); + HeapFree(GetProcessHeap(), 0, silence); + } + hr = IMediaEventSink_Notify(pEventSink, EC_COMPLETE, S_OK, 0); IMediaEventSink_Release(pEventSink); } -- 1.5.4.1