evr/mixer: Fix output filling behaviour regarding sample properties.

Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Nikolay Sivov 2020-11-16 17:50:21 +03:00 committed by Alexandre Julliard
parent 35d7dc9040
commit 6ae872e855
2 changed files with 24 additions and 6 deletions

View File

@ -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, &timestamp, &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);
}

View File

@ -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. */