We already rejected any other format types when connecting.
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/quartz/videorenderer.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-)
diff --git a/dlls/quartz/videorenderer.c b/dlls/quartz/videorenderer.c index b71d15a5d2..e38a773239 100644 --- a/dlls/quartz/videorenderer.c +++ b/dlls/quartz/videorenderer.c @@ -134,7 +134,7 @@ static void VideoRenderer_AutoShowWindow(VideoRendererImpl *This) ShowWindow(This->baseControlWindow.baseWindow.hWnd, SW_SHOW); }
-static DWORD VideoRenderer_SendSampleData(VideoRendererImpl* This, LPBYTE data, DWORD size) +static void VideoRenderer_SendSampleData(VideoRendererImpl* This, LPBYTE data, DWORD size) { const AM_MEDIA_TYPE *amt = &This->renderer.sink.pin.mt; BITMAPINFOHEADER *bmiHeader; @@ -150,11 +150,6 @@ static DWORD VideoRenderer_SendSampleData(VideoRendererImpl* This, LPBYTE data, { bmiHeader = &((VIDEOINFOHEADER2 *)amt->pbFormat)->bmiHeader; } - else - { - FIXME("Unknown subtype %s.\n", debugstr_guid(&amt->subtype)); - return VFW_E_RUNTIME_ERROR; - }
TRACE("Src Rect: %s\n", wine_dbgstr_rect(&This->SourceRect)); TRACE("Dst Rect: %s\n", wine_dbgstr_rect(&This->DestRect)); @@ -165,8 +160,6 @@ static DWORD VideoRenderer_SendSampleData(VideoRendererImpl* This, LPBYTE data, This->SourceRect.right - This->SourceRect.left, This->SourceRect.bottom - This->SourceRect.top, data, (BITMAPINFO *)bmiHeader, DIB_RGB_COLORS, SRCCOPY); ReleaseDC(This->baseControlWindow.baseWindow.hWnd, dc); - - return S_OK; }
static HRESULT WINAPI VideoRenderer_ShouldDrawSampleNow(struct strmbase_renderer *filter,
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/strmbase/renderer.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/dlls/strmbase/renderer.c b/dlls/strmbase/renderer.c index 0c33b5ea84..aa134ba5da 100644 --- a/dlls/strmbase/renderer.c +++ b/dlls/strmbase/renderer.c @@ -394,15 +394,22 @@ HRESULT WINAPI BaseRendererImpl_Receive(struct strmbase_renderer *This, IMediaSa if (now - This->stream_start - start <= -10000) { HANDLE handles[2] = {This->advise_event, This->flush_event}; + DWORD ret;
IReferenceClock_AdviseTime(This->filter.pClock, This->stream_start, start, (HEVENT)This->advise_event, &cookie);
LeaveCriticalSection(&This->csRenderLock);
- WaitForMultipleObjects(2, handles, FALSE, INFINITE); + ret = WaitForMultipleObjects(2, handles, FALSE, INFINITE); IReferenceClock_Unadvise(This->filter.pClock, cookie);
+ if (ret == 1) + { + TRACE("Flush signaled, discarding current sample.\n"); + return S_OK; + } + EnterCriticalSection(&This->csRenderLock); } }
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/quartz/videorenderer.c | 65 ++++++++++++------------------------- 1 file changed, 20 insertions(+), 45 deletions(-)
diff --git a/dlls/quartz/videorenderer.c b/dlls/quartz/videorenderer.c index e38a773239..bc5791dd5c 100644 --- a/dlls/quartz/videorenderer.c +++ b/dlls/quartz/videorenderer.c @@ -134,34 +134,6 @@ static void VideoRenderer_AutoShowWindow(VideoRendererImpl *This) ShowWindow(This->baseControlWindow.baseWindow.hWnd, SW_SHOW); }
-static void VideoRenderer_SendSampleData(VideoRendererImpl* This, LPBYTE data, DWORD size) -{ - const AM_MEDIA_TYPE *amt = &This->renderer.sink.pin.mt; - BITMAPINFOHEADER *bmiHeader; - HDC dc; - - TRACE("(%p)->(%p, %d)\n", This, data, size); - - if (IsEqualGUID(&amt->formattype, &FORMAT_VideoInfo)) - { - bmiHeader = &((VIDEOINFOHEADER *)amt->pbFormat)->bmiHeader; - } - else if (IsEqualGUID(&amt->formattype, &FORMAT_VideoInfo2)) - { - bmiHeader = &((VIDEOINFOHEADER2 *)amt->pbFormat)->bmiHeader; - } - - TRACE("Src Rect: %s\n", wine_dbgstr_rect(&This->SourceRect)); - TRACE("Dst Rect: %s\n", wine_dbgstr_rect(&This->DestRect)); - - dc = GetDC(This->baseControlWindow.baseWindow.hWnd); - StretchDIBits(dc, This->DestRect.left, This->DestRect.top, This->DestRect.right -This->DestRect.left, - This->DestRect.bottom - This->DestRect.top, This->SourceRect.left, This->SourceRect.top, - This->SourceRect.right - This->SourceRect.left, This->SourceRect.bottom - This->SourceRect.top, - data, (BITMAPINFO *)bmiHeader, DIB_RGB_COLORS, SRCCOPY); - ReleaseDC(This->baseControlWindow.baseWindow.hWnd, dc); -} - static HRESULT WINAPI VideoRenderer_ShouldDrawSampleNow(struct strmbase_renderer *filter, IMediaSample *pSample, REFERENCE_TIME *start, REFERENCE_TIME *end) { @@ -173,12 +145,15 @@ static HRESULT WINAPI VideoRenderer_ShouldDrawSampleNow(struct strmbase_renderer
static HRESULT WINAPI VideoRenderer_DoRenderSample(struct strmbase_renderer *iface, IMediaSample *pSample) { - VideoRendererImpl *This = impl_from_strmbase_renderer(iface); + VideoRendererImpl *filter = impl_from_strmbase_renderer(iface); + const AM_MEDIA_TYPE *mt = &filter->renderer.sink.pin.mt; LPBYTE pbSrcStream = NULL; + BITMAPINFOHEADER *bih; LONG cbSrcStream = 0; HRESULT hr; + HDC dc;
- TRACE("(%p)->(%p)\n", This, pSample); + TRACE("filter %p, sample %p.\n", filter, pSample);
hr = IMediaSample_GetPointer(pSample, &pbSrcStream); if (FAILED(hr)) @@ -204,21 +179,21 @@ static HRESULT WINAPI VideoRenderer_DoRenderSample(struct strmbase_renderer *ifa } #endif
- if (This->renderer.filter.state == State_Paused) - { - VideoRenderer_SendSampleData(This, pbSrcStream, cbSrcStream); - if (This->renderer.filter.state == State_Paused) - { - /* Flushing */ - return S_OK; - } - if (This->renderer.filter.state == State_Stopped) - { - return VFW_E_WRONG_STATE; - } - } else { - VideoRenderer_SendSampleData(This, pbSrcStream, cbSrcStream); - } + if (IsEqualGUID(&mt->formattype, &FORMAT_VideoInfo)) + bih = &((VIDEOINFOHEADER *)mt->pbFormat)->bmiHeader; + else + bih = &((VIDEOINFOHEADER2 *)mt->pbFormat)->bmiHeader; + + dc = GetDC(filter->baseControlWindow.baseWindow.hWnd); + StretchDIBits(dc, filter->DestRect.left, filter->DestRect.top, + filter->DestRect.right - filter->DestRect.left, + filter->DestRect.bottom - filter->DestRect.top, + filter->SourceRect.left, filter->SourceRect.top, + filter->SourceRect.right - filter->SourceRect.left, + filter->SourceRect.bottom - filter->SourceRect.top, + pbSrcStream, (BITMAPINFO *)bih, DIB_RGB_COLORS, SRCCOPY); + ReleaseDC(filter->baseControlWindow.baseWindow.hWnd, dc); + return S_OK; }
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=60623
Your paranoid android.
=== debian10 (32 bit report) ===
quartz: filtergraph.c:3170: Test failed: Expected time near 38063aded0, got 38063a69a0.
=== debian10 (32 bit WoW report) ===
quartz: filtergraph.c:781: Test failed: Wait timed out.
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/quartz/videorenderer.c | 18 ------------------ 1 file changed, 18 deletions(-)
diff --git a/dlls/quartz/videorenderer.c b/dlls/quartz/videorenderer.c index bc5791dd5c..db889bb661 100644 --- a/dlls/quartz/videorenderer.c +++ b/dlls/quartz/videorenderer.c @@ -149,7 +149,6 @@ static HRESULT WINAPI VideoRenderer_DoRenderSample(struct strmbase_renderer *ifa const AM_MEDIA_TYPE *mt = &filter->renderer.sink.pin.mt; LPBYTE pbSrcStream = NULL; BITMAPINFOHEADER *bih; - LONG cbSrcStream = 0; HRESULT hr; HDC dc;
@@ -162,23 +161,6 @@ static HRESULT WINAPI VideoRenderer_DoRenderSample(struct strmbase_renderer *ifa return hr; }
- cbSrcStream = IMediaSample_GetActualDataLength(pSample); - - TRACE("val %p %d\n", pbSrcStream, cbSrcStream); - -#if 0 /* For debugging purpose */ - { - int i; - for(i = 0; i < cbSrcStream; i++) - { - if ((i!=0) && !(i%16)) - TRACE("\n"); - TRACE("%02x ", pbSrcStream[i]); - } - TRACE("\n"); - } -#endif - if (IsEqualGUID(&mt->formattype, &FORMAT_VideoInfo)) bih = &((VIDEOINFOHEADER *)mt->pbFormat)->bmiHeader; else
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/quartz/tests/videorenderer.c | 10 +++++----- dlls/quartz/videorenderer.c | 25 ++++++++++++++++++++++++- 2 files changed, 29 insertions(+), 6 deletions(-)
diff --git a/dlls/quartz/tests/videorenderer.c b/dlls/quartz/tests/videorenderer.c index e7c0e15edd..046d94b0b8 100644 --- a/dlls/quartz/tests/videorenderer.c +++ b/dlls/quartz/tests/videorenderer.c @@ -744,7 +744,7 @@ static void test_filter_state(IMemInputPin *input, IFilterGraph2 *graph) hr = IMediaControl_GetState(control, 1000, &state); ok(hr == S_OK, "Got hr %#x.\n", hr);
- todo_wine ok(WaitForSingleObject(thread, 100) == WAIT_TIMEOUT, "Thread should block in Receive().\n"); + ok(WaitForSingleObject(thread, 100) == WAIT_TIMEOUT, "Thread should block in Receive().\n");
hr = IMediaControl_Stop(control); ok(hr == S_OK, "Got hr %#x.\n", hr); @@ -777,7 +777,7 @@ static void test_filter_state(IMemInputPin *input, IFilterGraph2 *graph) hr = IMediaControl_GetState(control, 1000, &state); ok(hr == S_OK, "Got hr %#x.\n", hr);
- todo_wine ok(WaitForSingleObject(thread, 100) == WAIT_TIMEOUT, "Thread should block in Receive().\n"); + ok(WaitForSingleObject(thread, 100) == WAIT_TIMEOUT, "Thread should block in Receive().\n");
hr = IMediaControl_Run(control); todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr); @@ -803,7 +803,7 @@ static void test_filter_state(IMemInputPin *input, IFilterGraph2 *graph) hr = IMediaControl_GetState(control, 1000, &state); ok(hr == S_OK, "Got hr %#x.\n", hr);
- todo_wine ok(WaitForSingleObject(thread, 100) == WAIT_TIMEOUT, "Thread should block in Receive().\n"); + ok(WaitForSingleObject(thread, 100) == WAIT_TIMEOUT, "Thread should block in Receive().\n");
hr = IMediaControl_Run(control); todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr); @@ -868,7 +868,7 @@ static void test_flushing(IPin *pin, IMemInputPin *input, IFilterGraph2 *graph) ok(hr == S_FALSE, "Got hr %#x.\n", hr);
thread = send_frame(input); - todo_wine ok(WaitForSingleObject(thread, 100) == WAIT_TIMEOUT, "Thread should block in Receive().\n"); + ok(WaitForSingleObject(thread, 100) == WAIT_TIMEOUT, "Thread should block in Receive().\n");
hr = IMediaControl_GetState(control, 0, &state); ok(hr == S_OK, "Got hr %#x.\n", hr); @@ -892,7 +892,7 @@ static void test_flushing(IPin *pin, IMemInputPin *input, IFilterGraph2 *graph) todo_wine ok(hr == VFW_S_STATE_INTERMEDIATE, "Got hr %#x.\n", hr);
thread = send_frame(input); - todo_wine ok(WaitForSingleObject(thread, 100) == WAIT_TIMEOUT, "Thread should block in Receive().\n"); + ok(WaitForSingleObject(thread, 100) == WAIT_TIMEOUT, "Thread should block in Receive().\n");
hr = IMediaControl_Run(control); todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr); diff --git a/dlls/quartz/videorenderer.c b/dlls/quartz/videorenderer.c index db889bb661..bd228277cb 100644 --- a/dlls/quartz/videorenderer.c +++ b/dlls/quartz/videorenderer.c @@ -54,6 +54,8 @@ typedef struct VideoRendererImpl LONG FullScreenMode;
DWORD saved_style; + + HANDLE run_event; } VideoRendererImpl;
static inline VideoRendererImpl *impl_from_BaseWindow(BaseWindow *iface) @@ -176,6 +178,15 @@ static HRESULT WINAPI VideoRenderer_DoRenderSample(struct strmbase_renderer *ifa pbSrcStream, (BITMAPINFO *)bih, DIB_RGB_COLORS, SRCCOPY); ReleaseDC(filter->baseControlWindow.baseWindow.hWnd, dc);
+ if (filter->renderer.filter.state == State_Paused) + { + const HANDLE events[2] = {filter->run_event, filter->renderer.flush_event}; + + LeaveCriticalSection(&filter->renderer.csRenderLock); + WaitForMultipleObjects(2, events, FALSE, INFINITE); + EnterCriticalSection(&filter->renderer.csRenderLock); + } + return S_OK; }
@@ -234,7 +245,7 @@ static void video_renderer_destroy(struct strmbase_renderer *iface)
BaseControlWindow_Destroy(&filter->baseControlWindow); BaseControlVideo_Destroy(&filter->baseControlVideo); - + CloseHandle(filter->run_event); strmbase_renderer_cleanup(&filter->renderer); CoTaskMemFree(filter); } @@ -267,6 +278,13 @@ static HRESULT video_renderer_pin_query_interface(struct strmbase_renderer *ifac return S_OK; }
+static void video_renderer_start_stream(struct strmbase_renderer *iface) +{ + VideoRendererImpl *filter = impl_from_strmbase_renderer(iface); + + SetEvent(filter->run_event); +} + static void video_renderer_stop_stream(struct strmbase_renderer *iface) { VideoRendererImpl *This = impl_from_strmbase_renderer(iface); @@ -276,6 +294,8 @@ static void video_renderer_stop_stream(struct strmbase_renderer *iface) if (This->baseControlWindow.AutoShow) /* Black it out */ RedrawWindow(This->baseControlWindow.baseWindow.hWnd, NULL, NULL, RDW_INVALIDATE|RDW_ERASE); + + ResetEvent(This->run_event); }
static void video_renderer_init_stream(struct strmbase_renderer *iface) @@ -315,6 +335,7 @@ static const struct strmbase_renderer_ops renderer_ops = .pfnCheckMediaType = VideoRenderer_CheckMediaType, .pfnDoRenderSample = VideoRenderer_DoRenderSample, .renderer_init_stream = video_renderer_init_stream, + .renderer_start_stream = video_renderer_start_stream, .renderer_stop_stream = video_renderer_stop_stream, .pfnShouldDrawSampleNow = VideoRenderer_ShouldDrawSampleNow, .renderer_destroy = video_renderer_destroy, @@ -722,6 +743,8 @@ HRESULT VideoRenderer_create(IUnknown *outer, void **out) if (FAILED(hr = BaseWindowImpl_PrepareWindow(&pVideoRenderer->baseControlWindow.baseWindow))) goto fail;
+ pVideoRenderer->run_event = CreateEventW(NULL, TRUE, FALSE, NULL); + *out = &pVideoRenderer->renderer.filter.IUnknown_inner; return S_OK;
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=60625
Your paranoid android.
=== debian10 (32 bit report) ===
quartz: filtergraph.c:3170: Test failed: Expected time near 3809418f20, got 3809416810.
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/quartz/tests/vmr7.c | 10 +++++----- dlls/quartz/tests/vmr9.c | 10 +++++----- dlls/quartz/vmr9.c | 15 +++++++++++++++ 3 files changed, 25 insertions(+), 10 deletions(-)
diff --git a/dlls/quartz/tests/vmr7.c b/dlls/quartz/tests/vmr7.c index 50a1521f6e..22ddb63746 100644 --- a/dlls/quartz/tests/vmr7.c +++ b/dlls/quartz/tests/vmr7.c @@ -1106,7 +1106,7 @@ static void test_filter_state(IMemInputPin *input, IFilterGraph2 *graph) hr = IMediaControl_GetState(control, 1000, &state); ok(hr == S_OK, "Got hr %#x.\n", hr);
- todo_wine ok(WaitForSingleObject(thread, 100) == WAIT_TIMEOUT, "Thread should block in Receive().\n"); + ok(WaitForSingleObject(thread, 100) == WAIT_TIMEOUT, "Thread should block in Receive().\n");
hr = IMediaControl_Stop(control); ok(hr == S_OK, "Got hr %#x.\n", hr); @@ -1139,7 +1139,7 @@ static void test_filter_state(IMemInputPin *input, IFilterGraph2 *graph) hr = IMediaControl_GetState(control, 1000, &state); ok(hr == S_OK, "Got hr %#x.\n", hr);
- todo_wine ok(WaitForSingleObject(thread, 100) == WAIT_TIMEOUT, "Thread should block in Receive().\n"); + ok(WaitForSingleObject(thread, 100) == WAIT_TIMEOUT, "Thread should block in Receive().\n");
hr = IMediaControl_Run(control); todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr); @@ -1165,7 +1165,7 @@ static void test_filter_state(IMemInputPin *input, IFilterGraph2 *graph) hr = IMediaControl_GetState(control, 1000, &state); ok(hr == S_OK, "Got hr %#x.\n", hr);
- todo_wine ok(WaitForSingleObject(thread, 100) == WAIT_TIMEOUT, "Thread should block in Receive().\n"); + ok(WaitForSingleObject(thread, 100) == WAIT_TIMEOUT, "Thread should block in Receive().\n");
hr = IMediaControl_Run(control); todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr); @@ -1240,7 +1240,7 @@ static void test_flushing(IPin *pin, IMemInputPin *input, IFilterGraph2 *graph) ok(hr == S_FALSE, "Got hr %#x.\n", hr);
thread = send_frame(input); - todo_wine ok(WaitForSingleObject(thread, 100) == WAIT_TIMEOUT, "Thread should block in Receive().\n"); + ok(WaitForSingleObject(thread, 100) == WAIT_TIMEOUT, "Thread should block in Receive().\n");
hr = IMediaControl_GetState(control, 0, &state); ok(hr == S_OK, "Got hr %#x.\n", hr); @@ -1264,7 +1264,7 @@ static void test_flushing(IPin *pin, IMemInputPin *input, IFilterGraph2 *graph) todo_wine ok(hr == VFW_S_STATE_INTERMEDIATE, "Got hr %#x.\n", hr);
thread = send_frame(input); - todo_wine ok(WaitForSingleObject(thread, 100) == WAIT_TIMEOUT, "Thread should block in Receive().\n"); + ok(WaitForSingleObject(thread, 100) == WAIT_TIMEOUT, "Thread should block in Receive().\n");
hr = IMediaControl_Run(control); todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr); diff --git a/dlls/quartz/tests/vmr9.c b/dlls/quartz/tests/vmr9.c index 93885e184d..d0ae25a969 100644 --- a/dlls/quartz/tests/vmr9.c +++ b/dlls/quartz/tests/vmr9.c @@ -1110,7 +1110,7 @@ static void test_filter_state(IMemInputPin *input, IFilterGraph2 *graph) hr = IMediaControl_GetState(control, 1000, &state); ok(hr == S_OK, "Got hr %#x.\n", hr);
- todo_wine ok(WaitForSingleObject(thread, 100) == WAIT_TIMEOUT, "Thread should block in Receive().\n"); + ok(WaitForSingleObject(thread, 100) == WAIT_TIMEOUT, "Thread should block in Receive().\n");
hr = IMediaControl_Stop(control); ok(hr == S_OK, "Got hr %#x.\n", hr); @@ -1143,7 +1143,7 @@ static void test_filter_state(IMemInputPin *input, IFilterGraph2 *graph) hr = IMediaControl_GetState(control, 1000, &state); ok(hr == S_OK, "Got hr %#x.\n", hr);
- todo_wine ok(WaitForSingleObject(thread, 100) == WAIT_TIMEOUT, "Thread should block in Receive().\n"); + ok(WaitForSingleObject(thread, 100) == WAIT_TIMEOUT, "Thread should block in Receive().\n");
hr = IMediaControl_Run(control); todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr); @@ -1169,7 +1169,7 @@ static void test_filter_state(IMemInputPin *input, IFilterGraph2 *graph) hr = IMediaControl_GetState(control, 1000, &state); ok(hr == S_OK, "Got hr %#x.\n", hr);
- todo_wine ok(WaitForSingleObject(thread, 100) == WAIT_TIMEOUT, "Thread should block in Receive().\n"); + ok(WaitForSingleObject(thread, 100) == WAIT_TIMEOUT, "Thread should block in Receive().\n");
hr = IMediaControl_Run(control); todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr); @@ -1244,7 +1244,7 @@ static void test_flushing(IPin *pin, IMemInputPin *input, IFilterGraph2 *graph) ok(hr == S_FALSE, "Got hr %#x.\n", hr);
thread = send_frame(input); - todo_wine ok(WaitForSingleObject(thread, 100) == WAIT_TIMEOUT, "Thread should block in Receive().\n"); + ok(WaitForSingleObject(thread, 100) == WAIT_TIMEOUT, "Thread should block in Receive().\n");
hr = IMediaControl_GetState(control, 0, &state); ok(hr == S_OK, "Got hr %#x.\n", hr); @@ -1268,7 +1268,7 @@ static void test_flushing(IPin *pin, IMemInputPin *input, IFilterGraph2 *graph) todo_wine ok(hr == VFW_S_STATE_INTERMEDIATE, "Got hr %#x.\n", hr);
thread = send_frame(input); - todo_wine ok(WaitForSingleObject(thread, 100) == WAIT_TIMEOUT, "Thread should block in Receive().\n"); + ok(WaitForSingleObject(thread, 100) == WAIT_TIMEOUT, "Thread should block in Receive().\n");
hr = IMediaControl_Run(control); todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr); diff --git a/dlls/quartz/vmr9.c b/dlls/quartz/vmr9.c index 36c91c2ef7..994e309165 100644 --- a/dlls/quartz/vmr9.c +++ b/dlls/quartz/vmr9.c @@ -86,6 +86,8 @@ struct quartz_vmr RECT target_rect; LONG VideoWidth; LONG VideoHeight; + + HANDLE run_event; };
static inline struct quartz_vmr *impl_from_BaseWindow(BaseWindow *wnd) @@ -259,6 +261,7 @@ static DWORD VMR9_SendSampleData(struct quartz_vmr *This, VMR9PresentationInfo * static HRESULT WINAPI VMR9_DoRenderSample(struct strmbase_renderer *iface, IMediaSample *pSample) { struct quartz_vmr *This = impl_from_IBaseFilter(&iface->filter.IBaseFilter_iface); + const HANDLE events[2] = {This->run_event, This->renderer.flush_event}; LPBYTE pbSrcStream = NULL; long cbSrcStream = 0; REFERENCE_TIME tStart, tStop; @@ -318,6 +321,13 @@ static HRESULT WINAPI VMR9_DoRenderSample(struct strmbase_renderer *iface, IMedi VMR9_SendSampleData(This, &info, pbSrcStream, cbSrcStream); IDirect3DSurface9_Release(info.lpSurf);
+ if (This->renderer.filter.state == State_Paused) + { + LeaveCriticalSection(&This->renderer.csRenderLock); + WaitForMultipleObjects(2, events, FALSE, INFINITE); + EnterCriticalSection(&This->renderer.csRenderLock); + } + return hr; }
@@ -428,6 +438,7 @@ static void vmr_start_stream(struct strmbase_renderer *iface) SWP_NOZORDER|SWP_NOMOVE|SWP_DEFERERASE); ShowWindow(This->baseControlWindow.baseWindow.hWnd, SW_SHOW); GetClientRect(This->baseControlWindow.baseWindow.hWnd, &This->target_rect); + SetEvent(This->run_event); }
static void vmr_stop_stream(struct strmbase_renderer *iface) @@ -438,6 +449,7 @@ static void vmr_stop_stream(struct strmbase_renderer *iface)
if (This->renderer.filter.state == State_Running) IVMRImagePresenter9_StopPresenting(This->presenter, This->cookie); + ResetEvent(This->run_event); }
static HRESULT WINAPI VMR9_ShouldDrawSampleNow(struct strmbase_renderer *iface, @@ -502,6 +514,7 @@ static void vmr_destroy(struct strmbase_renderer *iface) filter->allocator_d3d9_dev = NULL; }
+ CloseHandle(filter->run_event); FreeLibrary(filter->hD3d9); strmbase_renderer_cleanup(&filter->renderer); CoTaskMemFree(filter); @@ -2243,6 +2256,8 @@ static HRESULT vmr_create(IUnknown *outer, void **out, const CLSID *clsid) if (FAILED(hr)) goto fail;
+ pVMR->run_event = CreateEventW(NULL, TRUE, FALSE, NULL); + *out = &pVMR->renderer.filter.IUnknown_inner; ZeroMemory(&pVMR->source_rect, sizeof(RECT)); ZeroMemory(&pVMR->target_rect, sizeof(RECT));
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=60626
Your paranoid android.
=== w7u (32 bit report) ===
quartz: vmr7.c:1091: Test failed: Wait failed. vmr7.c:1092: Test failed: Got hr 0x103.
=== debian10 (32 bit report) ===
quartz: filtergraph: Timeout