From: Charlotte Pabst cpabst@codeweavers.com
--- dlls/mf/tests/mf.c | 7 ------- dlls/winegstreamer/media_source.c | 28 +++++++++++++++++++++------- 2 files changed, 21 insertions(+), 14 deletions(-)
diff --git a/dlls/mf/tests/mf.c b/dlls/mf/tests/mf.c index dc31e0c2228..c812344d38e 100644 --- a/dlls/mf/tests/mf.c +++ b/dlls/mf/tests/mf.c @@ -6951,16 +6951,13 @@ static void test_media_session_thinning(void) hr = IMFRateControl_SetRate(rate_control, TRUE, 5.0f); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); hr = wait_media_event(session, callback, MESessionRateChanged, 1000, &propvar); - todo_wine ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
rate = 0.0f; thin = FALSE; hr = IMFRateControl_GetRate(rate_control, &thin, &rate); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - todo_wine ok(thin, "Unexpected !thin.\n"); - todo_wine ok(rate == 5.0f, "Unexpected rate %f.\n", rate);
/* clock is unaware of thinning */ @@ -6976,7 +6973,6 @@ static void test_media_session_thinning(void) hr = IMFRateControl_GetRate(clock_rate_control, &thin, &rate); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); ok(!thin, "Unexpected thin.\n"); - todo_wine ok(rate == 5.0f, "Unexpected rate %f.\n", rate);
/* get first sample time */ @@ -7002,9 +6998,6 @@ static void test_media_session_thinning(void)
/* test thinned */
- thin_sample_desc[1].todo_time = TRUE; - thin_sample_desc[2].todo_time = TRUE; - grab_samples_from_start(session, callback, grabber_callback, 3); check_mf_sample_collection(grabber_callback->samples, thin_sample_desc, L"rgb32-3frames.bmp");
diff --git a/dlls/winegstreamer/media_source.c b/dlls/winegstreamer/media_source.c index ab842b3e438..1255d2ccebd 100644 --- a/dlls/winegstreamer/media_source.c +++ b/dlls/winegstreamer/media_source.c @@ -202,6 +202,7 @@ struct media_source SOURCE_SHUTDOWN, } state; float rate; + BOOL thin;
HANDLE read_thread; bool read_thread_shutdown; @@ -1279,23 +1280,36 @@ static HRESULT WINAPI media_source_rate_control_SetRate(IMFRateControl *iface, B { struct media_source *source = impl_from_IMFRateControl(iface); HRESULT hr; + BOOL old_thin;
FIXME("%p, %d, %f.\n", iface, thin, rate);
if (rate < 0.0f) return MF_E_REVERSE_UNSUPPORTED;
- if (thin) - return MF_E_THINNING_UNSUPPORTED; - if (FAILED(hr = IMFRateSupport_IsRateSupported(&source->IMFRateSupport_iface, thin, rate, NULL))) return hr;
EnterCriticalSection(&source->cs); + old_thin = thin; source->rate = rate; + source->thin = thin; LeaveCriticalSection(&source->cs);
- return IMFMediaEventQueue_QueueEventParamVar(source->event_queue, MESourceRateChanged, &GUID_NULL, S_OK, NULL); + wg_parser_set_thinning(source->wg_parser, thin); + + if (FAILED(hr = IMFMediaEventQueue_QueueEventParamVar(source->event_queue, MESourceRateChanged, &GUID_NULL, S_OK, NULL))) + return hr; + + if (old_thin != thin) + { + PROPVARIANT param; + param.vt = VT_BOOL; + param.boolVal = thin; + hr = IMFMediaEventQueue_QueueEventParamVar(source->event_queue, MEStreamThinMode, &GUID_NULL, S_OK, ¶m); + } + + return hr; }
static HRESULT WINAPI media_source_rate_control_GetRate(IMFRateControl *iface, BOOL *thin, float *rate) @@ -1304,11 +1318,10 @@ static HRESULT WINAPI media_source_rate_control_GetRate(IMFRateControl *iface, B
TRACE("%p, %p, %p.\n", iface, thin, rate);
- if (thin) - *thin = FALSE; - EnterCriticalSection(&source->cs); *rate = source->rate; + if (thin) + *thin = source->thin; LeaveCriticalSection(&source->cs);
return S_OK; @@ -1734,6 +1747,7 @@ static HRESULT media_source_create(struct object_context *context, IMFMediaSourc IMFByteStream_AddRef(context->stream); object->file_size = context->file_size; object->rate = 1.0f; + object->thin = FALSE; InitializeCriticalSectionEx(&object->cs, 0, RTL_CRITICAL_SECTION_FLAG_FORCE_DEBUG_INFO); object->cs.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": cs");