Nikolay Sivov : evr/mixer: Fix output filling behaviour regarding sample properties.
Alexandre Julliard
julliard at winehq.org
Mon Nov 16 15:28:57 CST 2020
Module: wine
Branch: master
Commit: 6ae872e855e74a377f977fcb741267c592224e13
URL: https://source.winehq.org/git/wine.git/?a=commit;h=6ae872e855e74a377f977fcb741267c592224e13
Author: Nikolay Sivov <nsivov at codeweavers.com>
Date: Mon Nov 16 17:50:21 2020 +0300
evr/mixer: Fix output filling behaviour regarding sample properties.
Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/evr/mixer.c | 28 ++++++++++++++++++++++++----
dlls/evr/tests/evr.c | 2 --
2 files changed, 24 insertions(+), 6 deletions(-)
diff --git a/dlls/evr/mixer.c b/dlls/evr/mixer.c
index 66cb9b021a7..997c5054f12 100644
--- a/dlls/evr/mixer.c
+++ b/dlls/evr/mixer.c
@@ -1222,10 +1222,25 @@ static void video_mixer_render(struct video_mixer *mixer, IDirect3DSurface9 *rt)
IDirect3DSurface9_Release(surface);
}
+static HRESULT video_mixer_get_sample_desired_time(IMFSample *sample, LONGLONG *timestamp, LONGLONG *duration)
+{
+ IMFDesiredSample *desired;
+ HRESULT hr;
+
+ if (SUCCEEDED(hr = IMFSample_QueryInterface(sample, &IID_IMFDesiredSample, (void **)&desired)))
+ {
+ hr = IMFDesiredSample_GetDesiredSampleTimeAndDuration(desired, timestamp, duration);
+ IMFDesiredSample_Release(desired);
+ }
+
+ return hr;
+}
+
static HRESULT WINAPI video_mixer_transform_ProcessOutput(IMFTransform *iface, DWORD flags, DWORD count,
MFT_OUTPUT_DATA_BUFFER *buffers, DWORD *status)
{
struct video_mixer *mixer = impl_from_IMFTransform(iface);
+ LONGLONG timestamp, duration;
IDirect3DSurface9 *surface;
IDirect3DDevice9 *device;
unsigned int i;
@@ -1272,12 +1287,17 @@ static HRESULT WINAPI video_mixer_transform_ProcessOutput(IMFTransform *iface, D
}
else
{
- if (SUCCEEDED(hr = video_mixer_get_d3d_device(mixer, &device)))
+ if (SUCCEEDED(video_mixer_get_sample_desired_time(buffers->pSample, ×tamp, &duration)))
{
- IDirect3DDevice9_ColorFill(device, surface, NULL, 0);
- IDirect3DDeviceManager9_UnlockDevice(mixer->device_manager, mixer->device_handle, FALSE);
- IDirect3DDevice9_Release(device);
+ if (SUCCEEDED(hr = video_mixer_get_d3d_device(mixer, &device)))
+ {
+ IDirect3DDevice9_ColorFill(device, surface, NULL, 0);
+ IDirect3DDeviceManager9_UnlockDevice(mixer->device_manager, mixer->device_handle, FALSE);
+ IDirect3DDevice9_Release(device);
+ }
}
+ else
+ hr = MF_E_TRANSFORM_NEED_MORE_INPUT;
}
IDirect3DSurface9_Release(surface);
}
diff --git a/dlls/evr/tests/evr.c b/dlls/evr/tests/evr.c
index f1831b58f89..dbc3bcbc582 100644
--- a/dlls/evr/tests/evr.c
+++ b/dlls/evr/tests/evr.c
@@ -2324,11 +2324,9 @@ static void test_mixer_samples(void)
buffers[0].pSample = sample;
hr = IMFTransform_ProcessOutput(mixer, 0, 1, buffers, &status);
-todo_wine
ok(hr == MF_E_TRANSFORM_NEED_MORE_INPUT, "Unexpected hr %#x.\n", hr);
color = get_surface_color(surface, 0, 0);
-todo_wine
ok(color == D3DCOLOR_ARGB(0x10, 0xff, 0x00, 0x00), "Unexpected color %#x.\n", color);
/* Streaming is not started yet. Output is colored black, but only if desired timestamps were set. */
More information about the wine-cvs
mailing list