From d5b79e6a795811b4316a3df4b8fe811e583f9425 Mon Sep 17 00:00:00 2001 From: Nikolay Sivov Date: Tue, 8 Oct 2019 15:58:56 +0300 Subject: [PATCH] mf: Adjust sample grabber sink flags in rateless mode. Signed-off-by: Nikolay Sivov Signed-off-by: Alexandre Julliard --- dlls/mf/samplegrabber.c | 2 ++ dlls/mf/tests/mf.c | 26 ++++++++++++++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/dlls/mf/samplegrabber.c b/dlls/mf/samplegrabber.c index af9666c86c8..c3dc2e1b7f3 100644 --- a/dlls/mf/samplegrabber.c +++ b/dlls/mf/samplegrabber.c @@ -862,6 +862,8 @@ static HRESULT WINAPI sample_grabber_sink_GetCharacteristics(IMFMediaSink *iface return MF_E_SHUTDOWN; *flags = MEDIASINK_FIXED_STREAMS; + if (grabber->ignore_clock) + *flags |= MEDIASINK_RATELESS; return S_OK; } diff --git a/dlls/mf/tests/mf.c b/dlls/mf/tests/mf.c index 7f9edfe241c..830bb38259c 100644 --- a/dlls/mf/tests/mf.c +++ b/dlls/mf/tests/mf.c @@ -2166,6 +2166,32 @@ todo_wine refcount = IMFActivate_Release(activate); ok(!refcount, "Unexpected refcount %u.\n", refcount); + /* Rateless mode with MF_SAMPLEGRABBERSINK_IGNORE_CLOCK. */ + hr = MFCreateMediaType(&media_type); + ok(hr == S_OK, "Failed to create media type, hr %#x.\n", hr); + + hr = IMFMediaType_SetGUID(media_type, &MF_MT_MAJOR_TYPE, &MFMediaType_Audio); + ok(hr == S_OK, "Failed to set attribute, hr %#x.\n", hr); + hr = IMFMediaType_SetGUID(media_type, &MF_MT_SUBTYPE, &MFAudioFormat_PCM); + ok(hr == S_OK, "Failed to set attribute, hr %#x.\n", hr); + + hr = MFCreateSampleGrabberSinkActivate(media_type, &grabber_callback, &activate); + ok(hr == S_OK, "Failed to create grabber activate, hr %#x.\n", hr); + + hr = IMFActivate_SetUINT32(activate, &MF_SAMPLEGRABBERSINK_IGNORE_CLOCK, 1); + ok(hr == S_OK, "Failed to set attribute, hr %#x.\n", hr); + + hr = IMFActivate_ActivateObject(activate, &IID_IMFMediaSink, (void **)&sink); + ok(hr == S_OK, "Failed to activate object, hr %#x.\n", hr); + + hr = IMFMediaSink_GetCharacteristics(sink, &flags); + ok(hr == S_OK, "Failed to get sink flags, hr %#x.\n", hr); + ok(flags & MEDIASINK_RATELESS, "Unexpected flags %#x.\n", flags); + + IMFMediaSink_Release(sink); + IMFActivate_Release(activate); + IMFMediaType_Release(media_type); + hr = MFShutdown(); ok(hr == S_OK, "Failed to shut down, hr %#x.\n", hr); }