Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/quartz/tests/dsoundrender.c | 243 +++++++++++++++++++++++-------- 1 file changed, 186 insertions(+), 57 deletions(-)
diff --git a/dlls/quartz/tests/dsoundrender.c b/dlls/quartz/tests/dsoundrender.c index d5c18d389a4..a11036f6c19 100644 --- a/dlls/quartz/tests/dsoundrender.c +++ b/dlls/quartz/tests/dsoundrender.c @@ -20,6 +20,7 @@ */
#define COBJMACROS +#include <math.h> #include "dshow.h" #include "initguid.h" #include "dsound.h" @@ -674,8 +675,174 @@ static void test_allocator(IMemInputPin *input) IMemAllocator_Release(ret_allocator); }
+struct frame_thread_params +{ + IMemInputPin *sink; + IMediaSample *sample; +}; + +static DWORD WINAPI frame_thread(void *arg) +{ + struct frame_thread_params *params = arg; + HRESULT hr; + + if (winetest_debug > 1) trace("%04x: Sending frame.\n", GetCurrentThreadId()); + hr = IMemInputPin_Receive(params->sink, params->sample); + if (winetest_debug > 1) trace("%04x: Returned %#x.\n", GetCurrentThreadId(), hr); + IMediaSample_Release(params->sample); + free(params); + return hr; +} + +static HRESULT send_frame(IMemInputPin *sink) +{ + struct frame_thread_params *params = malloc(sizeof(params)); + REFERENCE_TIME start_time, end_time; + IMemAllocator *allocator; + unsigned short *words; + IMediaSample *sample; + unsigned int i; + HANDLE thread; + HRESULT hr; + BYTE *data; + DWORD ret; + + hr = IMemInputPin_GetAllocator(sink, &allocator); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + hr = IMemAllocator_GetBuffer(allocator, &sample, NULL, NULL, 0); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + hr = IMediaSample_GetPointer(sample, &data); + ok(hr == S_OK, "Got hr %#x.\n", hr); + words = (unsigned short *)data; + for (i = 0; i < 44100 * 2; i += 2) + words[i] = words[i+1] = sinf(i / 20.0f) * 0x7fff; + + hr = IMediaSample_SetActualDataLength(sample, 44100 * 4); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + start_time = 0; + end_time = start_time + 10000000; + hr = IMediaSample_SetTime(sample, &start_time, &end_time); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + params->sink = sink; + params->sample = sample; + thread = CreateThread(NULL, 0, frame_thread, params, 0, NULL); + ret = WaitForSingleObject(thread, 500); + todo_wine_if (ret) ok(!ret, "Wait failed.\n"); + GetExitCodeThread(thread, &ret); + CloseHandle(thread); + + IMemAllocator_Release(allocator); + return ret; +} + +static void test_filter_state(IMemInputPin *input, IFilterGraph2 *graph) +{ + IMemAllocator *allocator; + IMediaControl *control; + IMediaSample *sample; + OAFilterState state; + HRESULT hr; + + hr = IMemInputPin_GetAllocator(input, &allocator); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + IFilterGraph2_QueryInterface(graph, &IID_IMediaControl, (void **)&control); + + hr = send_frame(input); + ok(hr == VFW_E_WRONG_STATE, "Got hr %#x.\n", hr); + + /* The renderer is not fully paused until it receives a sample. The + * DirectSound renderer never blocks in Receive(), despite returning S_OK + * from ReceiveCanBlock(). Instead it holds on to each sample until its + * presentation time, then writes it into the buffer. This is more work + * than it's worth to emulate, so for now, we'll ignore this behaviour. */ + + hr = IMediaControl_Pause(control); + ok(hr == S_FALSE, "Got hr %#x.\n", hr); + + /* It's possible to queue multiple samples while paused. The number of + * samples that can be queued depends on the length of each sample, but + * it's not particularly clear how. */ + + hr = IMediaControl_GetState(control, 0, &state); + ok(hr == VFW_S_STATE_INTERMEDIATE, "Got hr %#x.\n", hr); + + hr = send_frame(input); + todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr); + + hr = IMediaControl_GetState(control, 1000, &state); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + hr = IMediaControl_Stop(control); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + hr = IMemAllocator_GetBuffer(allocator, &sample, NULL, NULL, AM_GBF_NOWAIT); + todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr); + if (hr == S_OK) IMediaSample_Release(sample); + + hr = send_frame(input); + ok(hr == VFW_E_WRONG_STATE, "Got hr %#x.\n", hr); + + hr = IMediaControl_Pause(control); + ok(hr == S_FALSE, "Got hr %#x.\n", hr); + + hr = IMediaControl_GetState(control, 0, &state); + ok(hr == VFW_S_STATE_INTERMEDIATE, "Got hr %#x.\n", hr); + + hr = send_frame(input); + todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr); + + hr = IMediaControl_GetState(control, 1000, &state); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + hr = IMediaControl_Run(control); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + hr = IMediaControl_GetState(control, 0, &state); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + hr = send_frame(input); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + hr = send_frame(input); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + hr = IMediaControl_GetState(control, 0, &state); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + hr = IMediaControl_Run(control); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + hr = IMediaControl_GetState(control, 0, &state); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + hr = IMediaControl_Pause(control); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + hr = IMediaControl_GetState(control, 0, &state); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + hr = IMediaControl_Stop(control); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + hr = IMediaControl_GetState(control, 0, &state); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + /* The DirectSound renderer will silently refuse to transition to running + * if it hasn't finished pausing yet. Once it does it reports itself as + * completely paused. */ + + IMediaControl_Release(control); + IMemAllocator_Release(allocator); +} + static void test_connect_pin(void) { + ALLOCATOR_PROPERTIES req_props = {1, 4 * 44100, 1, 0}, ret_props; WAVEFORMATEX wfx = { .wFormatTag = WAVE_FORMAT_PCM, @@ -695,6 +862,7 @@ static void test_connect_pin(void) }; IBaseFilter *filter = create_dsound_render(); struct testfilter source; + IMemAllocator *allocator; IFilterGraph2 *graph; IMemInputPin *input; AM_MEDIA_TYPE mt; @@ -734,6 +902,22 @@ static void test_connect_pin(void)
test_allocator(input);
+ hr = CoCreateInstance(&CLSID_MemoryAllocator, NULL, CLSCTX_INPROC_SERVER, + &IID_IMemAllocator, (void **)&allocator); + ok(hr == S_OK, "Got hr %#x.\n", hr); + hr = IMemAllocator_SetProperties(allocator, &req_props, &ret_props); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(!memcmp(&ret_props, &req_props, sizeof(req_props)), "Properties did not match.\n"); + hr = IMemInputPin_NotifyAllocator(input, allocator, TRUE); + ok(hr == S_OK, "Got hr %#x.\n", hr); + hr = IMemAllocator_Commit(allocator); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + hr = IMemInputPin_ReceiveCanBlock(input); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + test_filter_state(input, graph); + hr = IFilterGraph2_Disconnect(graph, pin); ok(hr == S_OK, "Got hr %#x.\n", hr); hr = IFilterGraph2_Disconnect(graph, pin); @@ -749,6 +933,8 @@ static void test_connect_pin(void) hr = IPin_ConnectionMediaType(pin, &mt); ok(hr == VFW_E_NOT_CONNECTED, "Got hr %#x.\n", hr);
+ ref = IMemAllocator_Release(allocator); + ok(!ref, "Got outstanding refcount %d.\n", ref); IMemInputPin_Release(input); IPin_Release(pin); ref = IFilterGraph2_Release(graph); @@ -759,62 +945,6 @@ static void test_connect_pin(void) ok(!ref, "Got outstanding refcount %d.\n", ref); }
-static void test_pin(IPin *pin) -{ - IMemInputPin *mpin = NULL; - - IPin_QueryInterface(pin, &IID_IMemInputPin, (void **)&mpin); - - ok(mpin != NULL, "No IMemInputPin found!\n"); - if (mpin) - { - ok(IMemInputPin_ReceiveCanBlock(mpin) == S_OK, "Receive can't block for pin!\n"); - ok(IMemInputPin_NotifyAllocator(mpin, NULL, 0) == E_POINTER, "NotifyAllocator likes a NULL pointer argument\n"); - IMemInputPin_Release(mpin); - } - /* TODO */ -} - -static void test_basefilter(void) -{ - IEnumPins *pin_enum = NULL; - IBaseFilter *base = create_dsound_render(); - IPin *pins[2]; - ULONG ref; - HRESULT hr; - - hr = IBaseFilter_EnumPins(base, NULL); - ok(hr == E_POINTER, "hr = %08x and not E_POINTER\n", hr); - - hr= IBaseFilter_EnumPins(base, &pin_enum); - ok(hr == S_OK, "hr = %08x and not S_OK\n", hr); - - hr = IEnumPins_Next(pin_enum, 1, NULL, NULL); - ok(hr == E_POINTER, "hr = %08x and not E_POINTER\n", hr); - - hr = IEnumPins_Next(pin_enum, 2, pins, NULL); - ok(hr == E_INVALIDARG, "hr = %08x and not E_INVALIDARG\n", hr); - - pins[0] = (void *)0xdead; - pins[1] = (void *)0xdeed; - - hr = IEnumPins_Next(pin_enum, 2, pins, &ref); - ok(hr == S_FALSE, "hr = %08x instead of S_FALSE\n", hr); - ok(pins[0] != (void *)0xdead && pins[0] != NULL, "pins[0] = %p\n", pins[0]); - if (pins[0] != (void *)0xdead && pins[0] != NULL) - { - test_pin(pins[0]); - IPin_Release(pins[0]); - } - - ok(pins[1] == (void *)0xdeed, "pins[1] = %p\n", pins[1]); - - ref = IEnumPins_Release(pin_enum); - ok(ref == 0, "ref is %u and not 0!\n", ref); - - IBaseFilter_Release(base); -} - static void test_unconnected_filter_state(void) { IBaseFilter *filter = create_dsound_render(); @@ -1016,7 +1146,6 @@ START_TEST(dsoundrender) test_unconnected_filter_state(); test_media_types(); test_connect_pin(); - test_basefilter();
CoUninitialize(); }
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- Note that the base renderer still sends quality messages in some circumstances; this will be addressed in a follow-up patch.
dlls/quartz/dsoundrender.c | 18 +----------------- dlls/quartz/tests/dsoundrender.c | 8 ++++++++ 2 files changed, 9 insertions(+), 17 deletions(-)
diff --git a/dlls/quartz/dsoundrender.c b/dlls/quartz/dsoundrender.c index 225c1e07b96..fba206ecb60 100644 --- a/dlls/quartz/dsoundrender.c +++ b/dlls/quartz/dsoundrender.c @@ -360,23 +360,7 @@ static HRESULT WINAPI DSoundRender_DoRenderSample(struct strmbase_renderer *ifac cbSrcStream = IMediaSample_GetActualDataLength(pSample); TRACE("Sample data ptr = %p, size = %d\n", pbSrcStream, cbSrcStream);
- hr = DSoundRender_SendSampleData(This, tStart, tStop, pbSrcStream, cbSrcStream); - if (This->renderer.filter.state == State_Running && This->renderer.filter.clock && tStart >= 0) { - REFERENCE_TIME jitter, now = 0; - Quality q; - IReferenceClock_GetTime(This->renderer.filter.clock, &now); - jitter = now - This->renderer.stream_start - tStart; - if (jitter <= -DSoundRenderer_Max_Fill) - jitter += DSoundRenderer_Max_Fill; - else if (jitter < 0) - jitter = 0; - q.Type = (jitter > 0 ? Famine : Flood); - q.Proportion = 1000; - q.Late = jitter; - q.TimeStamp = tStart; - IQualityControl_Notify((IQualityControl *)This->renderer.qcimpl, &This->renderer.filter.IBaseFilter_iface, q); - } - return hr; + return DSoundRender_SendSampleData(This, tStart, tStop, pbSrcStream, cbSrcStream); }
static HRESULT WINAPI DSoundRender_CheckMediaType(struct strmbase_renderer *iface, const AM_MEDIA_TYPE * pmt) diff --git a/dlls/quartz/tests/dsoundrender.c b/dlls/quartz/tests/dsoundrender.c index a11036f6c19..6ade98d99db 100644 --- a/dlls/quartz/tests/dsoundrender.c +++ b/dlls/quartz/tests/dsoundrender.c @@ -613,6 +613,13 @@ static const struct strmbase_filter_ops testfilter_ops = .filter_destroy = testfilter_destroy, };
+static HRESULT testsource_query_interface(struct strmbase_pin *iface, REFIID iid, void **out) +{ + todo_wine_if (IsEqualGUID(iid, &IID_IQualityControl)) + ok(!IsEqualGUID(iid, &IID_IQualityControl), "Unexpected query for IQualityControl.\n"); + return E_NOINTERFACE; +} + static HRESULT WINAPI testsource_DecideAllocator(struct strmbase_source *iface, IMemInputPin *peer, IMemAllocator **allocator) { @@ -621,6 +628,7 @@ static HRESULT WINAPI testsource_DecideAllocator(struct strmbase_source *iface,
static const struct strmbase_source_ops testsource_ops = { + .base.pin_query_interface = testsource_query_interface, .pfnAttemptConnection = BaseOutputPinImpl_AttemptConnection, .pfnDecideAllocator = testsource_DecideAllocator, };
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=75646
Your paranoid android.
=== w864 (64 bit report) ===
Report validation errors: quartz:dsoundrender crashed (c0000374)
=== w1064v1507 (64 bit report) ===
Report validation errors: quartz:dsoundrender crashed (c0000374)
On 7/16/20 9:44 PM, Marvin wrote:
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=75646
Your paranoid android.
=== w864 (64 bit report) ===
Report validation errors: quartz:dsoundrender crashed (c0000374)
=== w1064v1507 (64 bit report) ===
Report validation errors: quartz:dsoundrender crashed (c0000374)
Sorry, this message in particular is legitimate. Please ignore these patches for now.
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/strmbase/qualitycontrol.c | 32 ++++++++++++++++---------------- dlls/strmbase/strmbase_private.h | 17 +++++++++-------- include/wine/strmbase.h | 2 +- 3 files changed, 26 insertions(+), 25 deletions(-)
diff --git a/dlls/strmbase/qualitycontrol.c b/dlls/strmbase/qualitycontrol.c index 763108d46ac..918757caa81 100644 --- a/dlls/strmbase/qualitycontrol.c +++ b/dlls/strmbase/qualitycontrol.c @@ -27,10 +27,10 @@
WINE_DEFAULT_DEBUG_CHANNEL(strmbase_qc);
-HRESULT QualityControlImpl_Create(struct strmbase_pin *pin, QualityControlImpl **ppv) +HRESULT QualityControlImpl_Create(struct strmbase_pin *pin, struct strmbase_qc **ppv) { - QualityControlImpl *This; - *ppv = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(QualityControlImpl)); + struct strmbase_qc *This; + *ppv = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(struct strmbase_qc)); if (!*ppv) return E_OUTOFMEMORY; This = *ppv; @@ -41,37 +41,37 @@ HRESULT QualityControlImpl_Create(struct strmbase_pin *pin, QualityControlImpl * return S_OK; }
-void QualityControlImpl_Destroy(QualityControlImpl *This) +void QualityControlImpl_Destroy(struct strmbase_qc *This) { HeapFree(GetProcessHeap(),0,This); }
-static inline QualityControlImpl *impl_from_IQualityControl(IQualityControl *iface) +static inline struct strmbase_qc *impl_from_IQualityControl(IQualityControl *iface) { - return CONTAINING_RECORD(iface, QualityControlImpl, IQualityControl_iface); + return CONTAINING_RECORD(iface, struct strmbase_qc, IQualityControl_iface); }
HRESULT WINAPI QualityControlImpl_QueryInterface(IQualityControl *iface, REFIID riid, void **ppv) { - QualityControlImpl *This = impl_from_IQualityControl(iface); + struct strmbase_qc *This = impl_from_IQualityControl(iface); return IBaseFilter_QueryInterface(&This->pin->filter->IBaseFilter_iface, riid, ppv); }
ULONG WINAPI QualityControlImpl_AddRef(IQualityControl *iface) { - QualityControlImpl *This = impl_from_IQualityControl(iface); + struct strmbase_qc *This = impl_from_IQualityControl(iface); return IBaseFilter_AddRef(&This->pin->filter->IBaseFilter_iface); }
ULONG WINAPI QualityControlImpl_Release(IQualityControl *iface) { - QualityControlImpl *This = impl_from_IQualityControl(iface); + struct strmbase_qc *This = impl_from_IQualityControl(iface); return IBaseFilter_Release(&This->pin->filter->IBaseFilter_iface); }
HRESULT WINAPI QualityControlImpl_Notify(IQualityControl *iface, IBaseFilter *sender, Quality qm) { - QualityControlImpl *This = impl_from_IQualityControl(iface); + struct strmbase_qc *This = impl_from_IQualityControl(iface); HRESULT hr = S_FALSE;
TRACE("iface %p, sender %p, type %#x, proportion %u, late %s, timestamp %s.\n", @@ -96,7 +96,7 @@ HRESULT WINAPI QualityControlImpl_Notify(IQualityControl *iface, IBaseFilter *se
HRESULT WINAPI QualityControlImpl_SetSink(IQualityControl *iface, IQualityControl *tonotify) { - QualityControlImpl *This = impl_from_IQualityControl(iface); + struct strmbase_qc *This = impl_from_IQualityControl(iface); TRACE("%p %p\n", This, tonotify); This->tonotify = tonotify; return S_OK; @@ -114,7 +114,7 @@ HRESULT WINAPI QualityControlImpl_SetSink(IQualityControl *iface, IQualityContro #define UPDATE_RUNNING_AVG_P(avg,val) DO_RUNNING_AVG(avg,val,16) #define UPDATE_RUNNING_AVG_N(avg,val) DO_RUNNING_AVG(avg,val,4)
-void QualityControlRender_Start(QualityControlImpl *This, REFERENCE_TIME tStart) +void QualityControlRender_Start(struct strmbase_qc *This, REFERENCE_TIME tStart) { This->avg_render = This->last_in_time = This->last_left = This->avg_duration = This->avg_pt = -1; This->clockstart = tStart; @@ -124,7 +124,7 @@ void QualityControlRender_Start(QualityControlImpl *This, REFERENCE_TIME tStart) This->qos_handled = TRUE; /* Lie that will be corrected on first adjustment */ }
-static BOOL QualityControlRender_IsLate(QualityControlImpl *This, REFERENCE_TIME jitter, +static BOOL QualityControlRender_IsLate(struct strmbase_qc *This, REFERENCE_TIME jitter, REFERENCE_TIME start, REFERENCE_TIME stop) { REFERENCE_TIME max_lateness = 200000; @@ -153,7 +153,7 @@ static BOOL QualityControlRender_IsLate(QualityControlImpl *This, REFERENCE_TIME return FALSE; }
-void QualityControlRender_DoQOS(QualityControlImpl *priv) +void QualityControlRender_DoQOS(struct strmbase_qc *priv) { REFERENCE_TIME start, stop, jitter, pt, entered, left, duration; double rate; @@ -266,7 +266,7 @@ void QualityControlRender_DoQOS(QualityControlImpl *priv) }
-void QualityControlRender_BeginRender(QualityControlImpl *This, REFERENCE_TIME start, REFERENCE_TIME stop) +void QualityControlRender_BeginRender(struct strmbase_qc *This, REFERENCE_TIME start, REFERENCE_TIME stop) { This->start = -1;
@@ -299,7 +299,7 @@ void QualityControlRender_BeginRender(QualityControlImpl *This, REFERENCE_TIME s TRACE("Starting at %s.\n", debugstr_time(This->start)); }
-void QualityControlRender_EndRender(QualityControlImpl *This) +void QualityControlRender_EndRender(struct strmbase_qc *This) { REFERENCE_TIME elapsed;
diff --git a/dlls/strmbase/strmbase_private.h b/dlls/strmbase/strmbase_private.h index 0a23592bd28..8df1cac71eb 100644 --- a/dlls/strmbase/strmbase_private.h +++ b/dlls/strmbase/strmbase_private.h @@ -54,7 +54,8 @@ static inline const char *debugstr_time(REFERENCE_TIME time) }
/* Quality Control */ -typedef struct QualityControlImpl { +struct strmbase_qc +{ IQualityControl IQualityControl_iface; struct strmbase_pin *pin; IQualityControl *tonotify; @@ -65,20 +66,20 @@ typedef struct QualityControlImpl { double avg_rate; LONG64 rendered, dropped; BOOL qos_handled, is_dropped; -} QualityControlImpl; +};
-HRESULT QualityControlImpl_Create(struct strmbase_pin *pin, QualityControlImpl **out); -void QualityControlImpl_Destroy(QualityControlImpl *This); +HRESULT QualityControlImpl_Create(struct strmbase_pin *pin, struct strmbase_qc **out); +void QualityControlImpl_Destroy(struct strmbase_qc *qc); HRESULT WINAPI QualityControlImpl_QueryInterface(IQualityControl *iface, REFIID riid, void **ppv); ULONG WINAPI QualityControlImpl_AddRef(IQualityControl *iface); ULONG WINAPI QualityControlImpl_Release(IQualityControl *iface); HRESULT WINAPI QualityControlImpl_Notify(IQualityControl *iface, IBaseFilter *sender, Quality qm); HRESULT WINAPI QualityControlImpl_SetSink(IQualityControl *iface, IQualityControl *tonotify);
-void QualityControlRender_Start(QualityControlImpl *This, REFERENCE_TIME tStart); -void QualityControlRender_DoQOS(QualityControlImpl *priv); -void QualityControlRender_BeginRender(QualityControlImpl *This, REFERENCE_TIME start, REFERENCE_TIME stop); -void QualityControlRender_EndRender(QualityControlImpl *This); +void QualityControlRender_Start(struct strmbase_qc *This, REFERENCE_TIME tStart); +void QualityControlRender_DoQOS(struct strmbase_qc *priv); +void QualityControlRender_BeginRender(struct strmbase_qc *This, REFERENCE_TIME start, REFERENCE_TIME stop); +void QualityControlRender_EndRender(struct strmbase_qc *This);
void strmbase_passthrough_update_time(struct strmbase_passthrough *passthrough, REFERENCE_TIME time); void strmbase_passthrough_invalidate_time(struct strmbase_passthrough *passthrough); diff --git a/include/wine/strmbase.h b/include/wine/strmbase.h index 02a5469de17..b0fa68ecf10 100644 --- a/include/wine/strmbase.h +++ b/include/wine/strmbase.h @@ -291,7 +291,7 @@ struct strmbase_renderer REFERENCE_TIME stream_start;
IQualityControl *pQSink; - struct QualityControlImpl *qcimpl; + struct strmbase_qc *qcimpl;
const struct strmbase_renderer_ops *pFuncsTable;
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=75647
Your paranoid android.
=== debiant (32 bit report) ===
quartz: dsoundrender.c:792: Test succeeded inside todo block: Got hr 0.
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/strmbase/qualitycontrol.c | 48 +++++++++++++++++++------------- dlls/strmbase/renderer.c | 9 ------ dlls/strmbase/strmbase_private.h | 5 ---- 3 files changed, 29 insertions(+), 33 deletions(-)
diff --git a/dlls/strmbase/qualitycontrol.c b/dlls/strmbase/qualitycontrol.c index 918757caa81..c4e055858ef 100644 --- a/dlls/strmbase/qualitycontrol.c +++ b/dlls/strmbase/qualitycontrol.c @@ -27,20 +27,6 @@
WINE_DEFAULT_DEBUG_CHANNEL(strmbase_qc);
-HRESULT QualityControlImpl_Create(struct strmbase_pin *pin, struct strmbase_qc **ppv) -{ - struct strmbase_qc *This; - *ppv = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(struct strmbase_qc)); - if (!*ppv) - return E_OUTOFMEMORY; - This = *ppv; - This->pin = pin; - This->tonotify = NULL; - This->current_rstart = This->current_rstop = -1; - TRACE("-> %p\n", This); - return S_OK; -} - void QualityControlImpl_Destroy(struct strmbase_qc *This) { HeapFree(GetProcessHeap(),0,This); @@ -51,25 +37,25 @@ static inline struct strmbase_qc *impl_from_IQualityControl(IQualityControl *ifa return CONTAINING_RECORD(iface, struct strmbase_qc, IQualityControl_iface); }
-HRESULT WINAPI QualityControlImpl_QueryInterface(IQualityControl *iface, REFIID riid, void **ppv) +static HRESULT WINAPI quality_control_QueryInterface(IQualityControl *iface, REFIID riid, void **ppv) { struct strmbase_qc *This = impl_from_IQualityControl(iface); return IBaseFilter_QueryInterface(&This->pin->filter->IBaseFilter_iface, riid, ppv); }
-ULONG WINAPI QualityControlImpl_AddRef(IQualityControl *iface) +static ULONG WINAPI quality_control_AddRef(IQualityControl *iface) { struct strmbase_qc *This = impl_from_IQualityControl(iface); return IBaseFilter_AddRef(&This->pin->filter->IBaseFilter_iface); }
-ULONG WINAPI QualityControlImpl_Release(IQualityControl *iface) +static ULONG WINAPI quality_control_Release(IQualityControl *iface) { struct strmbase_qc *This = impl_from_IQualityControl(iface); return IBaseFilter_Release(&This->pin->filter->IBaseFilter_iface); }
-HRESULT WINAPI QualityControlImpl_Notify(IQualityControl *iface, IBaseFilter *sender, Quality qm) +static HRESULT WINAPI quality_control_Notify(IQualityControl *iface, IBaseFilter *sender, Quality qm) { struct strmbase_qc *This = impl_from_IQualityControl(iface); HRESULT hr = S_FALSE; @@ -94,7 +80,7 @@ HRESULT WINAPI QualityControlImpl_Notify(IQualityControl *iface, IBaseFilter *se return hr; }
-HRESULT WINAPI QualityControlImpl_SetSink(IQualityControl *iface, IQualityControl *tonotify) +static HRESULT WINAPI quality_control_SetSink(IQualityControl *iface, IQualityControl *tonotify) { struct strmbase_qc *This = impl_from_IQualityControl(iface); TRACE("%p %p\n", This, tonotify); @@ -102,6 +88,15 @@ HRESULT WINAPI QualityControlImpl_SetSink(IQualityControl *iface, IQualityContro return S_OK; }
+static const IQualityControlVtbl quality_control_vtbl = +{ + quality_control_QueryInterface, + quality_control_AddRef, + quality_control_Release, + quality_control_Notify, + quality_control_SetSink, +}; + /* Macros copied from gstreamer, weighted average between old average and new ones */ #define DO_RUNNING_AVG(avg,val,size) (((val) + ((size)-1) * (avg)) / (size))
@@ -317,3 +312,18 @@ void QualityControlRender_EndRender(struct strmbase_qc *This) else This->avg_render = UPDATE_RUNNING_AVG (This->avg_render, elapsed); } + +HRESULT QualityControlImpl_Create(struct strmbase_pin *pin, struct strmbase_qc **ppv) +{ + struct strmbase_qc *This; + *ppv = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(struct strmbase_qc)); + if (!*ppv) + return E_OUTOFMEMORY; + This = *ppv; + This->pin = pin; + This->tonotify = NULL; + This->current_rstart = This->current_rstop = -1; + This->IQualityControl_iface.lpVtbl = &quality_control_vtbl; + TRACE("-> %p\n", This); + return S_OK; +} diff --git a/dlls/strmbase/renderer.c b/dlls/strmbase/renderer.c index f1e74f64764..3895cb31194 100644 --- a/dlls/strmbase/renderer.c +++ b/dlls/strmbase/renderer.c @@ -27,14 +27,6 @@ static inline struct strmbase_renderer *impl_from_strmbase_filter(struct strmbas return CONTAINING_RECORD(iface, struct strmbase_renderer, filter); }
-static const IQualityControlVtbl Renderer_QualityControl_Vtbl = { - QualityControlImpl_QueryInterface, - QualityControlImpl_AddRef, - QualityControlImpl_Release, - QualityControlImpl_Notify, - QualityControlImpl_SetSink -}; - static inline struct strmbase_renderer *impl_from_IPin(IPin *iface) { return CONTAINING_RECORD(iface, struct strmbase_renderer, sink.pin.IPin_iface); @@ -406,5 +398,4 @@ void strmbase_renderer_init(struct strmbase_renderer *filter, IUnknown *outer, filter->flush_event = CreateEventW(NULL, TRUE, TRUE, NULL);
QualityControlImpl_Create(&filter->sink.pin, &filter->qcimpl); - filter->qcimpl->IQualityControl_iface.lpVtbl = &Renderer_QualityControl_Vtbl; } diff --git a/dlls/strmbase/strmbase_private.h b/dlls/strmbase/strmbase_private.h index 8df1cac71eb..15be9498e7d 100644 --- a/dlls/strmbase/strmbase_private.h +++ b/dlls/strmbase/strmbase_private.h @@ -70,11 +70,6 @@ struct strmbase_qc
HRESULT QualityControlImpl_Create(struct strmbase_pin *pin, struct strmbase_qc **out); void QualityControlImpl_Destroy(struct strmbase_qc *qc); -HRESULT WINAPI QualityControlImpl_QueryInterface(IQualityControl *iface, REFIID riid, void **ppv); -ULONG WINAPI QualityControlImpl_AddRef(IQualityControl *iface); -ULONG WINAPI QualityControlImpl_Release(IQualityControl *iface); -HRESULT WINAPI QualityControlImpl_Notify(IQualityControl *iface, IBaseFilter *sender, Quality qm); -HRESULT WINAPI QualityControlImpl_SetSink(IQualityControl *iface, IQualityControl *tonotify);
void QualityControlRender_Start(struct strmbase_qc *This, REFERENCE_TIME tStart); void QualityControlRender_DoQOS(struct strmbase_qc *priv);
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=75648
Your paranoid android.
=== debiant (32 bit WoW report) ===
quartz: dsoundrender.c:792: Test succeeded inside todo block: Got hr 0.
=== debiant (64 bit WoW report) ===
quartz: dsoundrender.c:792: Test succeeded inside todo block: Got hr 0.
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/strmbase/qualitycontrol.c | 22 +++++----------------- dlls/strmbase/renderer.c | 16 +++++++--------- dlls/strmbase/strmbase_private.h | 18 ------------------ include/wine/strmbase.h | 20 +++++++++++++++++--- 4 files changed, 29 insertions(+), 47 deletions(-)
diff --git a/dlls/strmbase/qualitycontrol.c b/dlls/strmbase/qualitycontrol.c index c4e055858ef..d0bd070d447 100644 --- a/dlls/strmbase/qualitycontrol.c +++ b/dlls/strmbase/qualitycontrol.c @@ -27,11 +27,6 @@
WINE_DEFAULT_DEBUG_CHANNEL(strmbase_qc);
-void QualityControlImpl_Destroy(struct strmbase_qc *This) -{ - HeapFree(GetProcessHeap(),0,This); -} - static inline struct strmbase_qc *impl_from_IQualityControl(IQualityControl *iface) { return CONTAINING_RECORD(iface, struct strmbase_qc, IQualityControl_iface); @@ -313,17 +308,10 @@ void QualityControlRender_EndRender(struct strmbase_qc *This) This->avg_render = UPDATE_RUNNING_AVG (This->avg_render, elapsed); }
-HRESULT QualityControlImpl_Create(struct strmbase_pin *pin, struct strmbase_qc **ppv) +void strmbase_qc_init(struct strmbase_qc *qc, struct strmbase_pin *pin) { - struct strmbase_qc *This; - *ppv = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(struct strmbase_qc)); - if (!*ppv) - return E_OUTOFMEMORY; - This = *ppv; - This->pin = pin; - This->tonotify = NULL; - This->current_rstart = This->current_rstop = -1; - This->IQualityControl_iface.lpVtbl = &quality_control_vtbl; - TRACE("-> %p\n", This); - return S_OK; + memset(qc, 0, sizeof(*qc)); + qc->pin = pin; + qc->current_rstart = qc->current_rstop = -1; + qc->IQualityControl_iface.lpVtbl = &quality_control_vtbl; } diff --git a/dlls/strmbase/renderer.c b/dlls/strmbase/renderer.c index 3895cb31194..939811bfa90 100644 --- a/dlls/strmbase/renderer.c +++ b/dlls/strmbase/renderer.c @@ -63,7 +63,7 @@ static HRESULT renderer_query_interface(struct strmbase_filter *iface, REFIID ii else if (IsEqualGUID(iid, &IID_IMediaSeeking)) *out = &filter->passthrough.IMediaSeeking_iface; else if (IsEqualGUID(iid, &IID_IQualityControl)) - *out = &filter->qcimpl->IQualityControl_iface; + *out = &filter->qc.IQualityControl_iface; else return E_NOINTERFACE;
@@ -93,7 +93,7 @@ static HRESULT renderer_start_stream(struct strmbase_filter *iface, REFERENCE_TI SetEvent(filter->state_event); if (filter->sink.pin.peer) filter->eos = FALSE; - QualityControlRender_Start(filter->qcimpl, filter->stream_start); + QualityControlRender_Start(&filter->qc, filter->stream_start); if (filter->sink.pin.peer && filter->pFuncsTable->renderer_start_stream) filter->pFuncsTable->renderer_start_stream(filter);
@@ -234,7 +234,7 @@ static HRESULT sink_end_flush(struct strmbase_sink *iface) EnterCriticalSection(&filter->csRenderLock);
filter->eos = FALSE; - QualityControlRender_Start(filter->qcimpl, filter->stream_start); + QualityControlRender_Start(&filter->qc, filter->stream_start); strmbase_passthrough_invalidate_time(&filter->passthrough); ResetEvent(filter->flush_event);
@@ -272,7 +272,6 @@ void strmbase_renderer_cleanup(struct strmbase_renderer *filter) CloseHandle(filter->state_event); CloseHandle(filter->advise_event); CloseHandle(filter->flush_event); - QualityControlImpl_Destroy(filter->qcimpl); strmbase_filter_cleanup(&filter->filter); }
@@ -367,12 +366,12 @@ HRESULT WINAPI BaseRendererImpl_Receive(struct strmbase_renderer *This, IMediaSa
if (SUCCEEDED(hr)) { - QualityControlRender_BeginRender(This->qcimpl, start, stop); + QualityControlRender_BeginRender(&This->qc, start, stop); hr = This->pFuncsTable->pfnDoRenderSample(This, pSample); - QualityControlRender_EndRender(This->qcimpl); + QualityControlRender_EndRender(&This->qc); }
- QualityControlRender_DoQOS(This->qcimpl); + QualityControlRender_DoQOS(&This->qc);
LeaveCriticalSection(&This->csRenderLock);
@@ -386,6 +385,7 @@ void strmbase_renderer_init(struct strmbase_renderer *filter, IUnknown *outer, strmbase_filter_init(&filter->filter, outer, clsid, &filter_ops); strmbase_passthrough_init(&filter->passthrough, (IUnknown *)&filter->filter.IBaseFilter_iface); ISeekingPassThru_Init(&filter->passthrough.ISeekingPassThru_iface, TRUE, &filter->sink.pin.IPin_iface); + strmbase_qc_init(&filter->qc, &filter->sink.pin);
filter->pFuncsTable = ops;
@@ -396,6 +396,4 @@ void strmbase_renderer_init(struct strmbase_renderer *filter, IUnknown *outer, filter->state_event = CreateEventW(NULL, TRUE, TRUE, NULL); filter->advise_event = CreateEventW(NULL, FALSE, FALSE, NULL); filter->flush_event = CreateEventW(NULL, TRUE, TRUE, NULL); - - QualityControlImpl_Create(&filter->sink.pin, &filter->qcimpl); } diff --git a/dlls/strmbase/strmbase_private.h b/dlls/strmbase/strmbase_private.h index 15be9498e7d..d589213b713 100644 --- a/dlls/strmbase/strmbase_private.h +++ b/dlls/strmbase/strmbase_private.h @@ -53,24 +53,6 @@ static inline const char *debugstr_time(REFERENCE_TIME time) return wine_dbg_sprintf("%s", rev); }
-/* Quality Control */ -struct strmbase_qc -{ - IQualityControl IQualityControl_iface; - struct strmbase_pin *pin; - IQualityControl *tonotify; - - /* Render stuff */ - REFERENCE_TIME last_in_time, last_left, avg_duration, avg_pt, avg_render, start, stop; - REFERENCE_TIME current_jitter, current_rstart, current_rstop, clockstart; - double avg_rate; - LONG64 rendered, dropped; - BOOL qos_handled, is_dropped; -}; - -HRESULT QualityControlImpl_Create(struct strmbase_pin *pin, struct strmbase_qc **out); -void QualityControlImpl_Destroy(struct strmbase_qc *qc); - void QualityControlRender_Start(struct strmbase_qc *This, REFERENCE_TIME tStart); void QualityControlRender_DoQOS(struct strmbase_qc *priv); void QualityControlRender_BeginRender(struct strmbase_qc *This, REFERENCE_TIME start, REFERENCE_TIME stop); diff --git a/include/wine/strmbase.h b/include/wine/strmbase.h index b0fa68ecf10..2e84edb7cdd 100644 --- a/include/wine/strmbase.h +++ b/include/wine/strmbase.h @@ -271,10 +271,27 @@ struct strmbase_passthrough void strmbase_passthrough_init(struct strmbase_passthrough *passthrough, IUnknown *outer); void strmbase_passthrough_cleanup(struct strmbase_passthrough *passthrough);
+struct strmbase_qc +{ + IQualityControl IQualityControl_iface; + struct strmbase_pin *pin; + IQualityControl *tonotify; + + /* Render stuff */ + REFERENCE_TIME last_in_time, last_left, avg_duration, avg_pt, avg_render, start, stop; + REFERENCE_TIME current_jitter, current_rstart, current_rstop, clockstart; + double avg_rate; + LONG64 rendered, dropped; + BOOL qos_handled, is_dropped; +}; + +void strmbase_qc_init(struct strmbase_qc *qc, struct strmbase_pin *pin); + struct strmbase_renderer { struct strmbase_filter filter; struct strmbase_passthrough passthrough; + struct strmbase_qc qc;
struct strmbase_sink sink;
@@ -290,9 +307,6 @@ struct strmbase_renderer HANDLE flush_event; REFERENCE_TIME stream_start;
- IQualityControl *pQSink; - struct strmbase_qc *qcimpl; - const struct strmbase_renderer_ops *pFuncsTable;
BOOL eos;
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=75645
Your paranoid android.
=== debiant (64 bit WoW report) ===
quartz: dsoundrender.c:784: Test succeeded inside todo block: Got hr 0.