From: Santino Mazza smazza@codeweavers.com
--- dlls/amstream/ddrawstream.c | 7 +++++++ dlls/amstream/tests/amstream.c | 6 +++--- 2 files changed, 10 insertions(+), 3 deletions(-)
diff --git a/dlls/amstream/ddrawstream.c b/dlls/amstream/ddrawstream.c index 6e0cbb8b91e..4e0b1323619 100644 --- a/dlls/amstream/ddrawstream.c +++ b/dlls/amstream/ddrawstream.c @@ -684,6 +684,13 @@ static HRESULT WINAPI ddraw_IDirectDrawMediaStream_SetFormat(IDirectDrawMediaStr
if (stream->peer && !is_format_compatible(stream, old_format.width, old_format.height, &old_format.pf)) { + if (stream->sample_refs > 0) + { + stream->format = old_format; + LeaveCriticalSection(&stream->cs); + return MS_E_SAMPLEALLOC; + } + if (FAILED(hr = CopyMediaType(&old_media_type, &stream->mt))) { stream->format = old_format; diff --git a/dlls/amstream/tests/amstream.c b/dlls/amstream/tests/amstream.c index 24a90cce0d1..0991e902dcc 100644 --- a/dlls/amstream/tests/amstream.c +++ b/dlls/amstream/tests/amstream.c @@ -8712,7 +8712,7 @@ static void test_ddrawstream_mem_allocator(void) ok(hr == S_OK, "Got hr %#lx.\n", hr);
hr = IDirectDrawMediaStream_SetFormat(ddraw_stream, &rgb32_format, NULL); - todo_wine ok(hr == MS_E_SAMPLEALLOC, "Got hr %#lx.\n", hr); + ok(hr == MS_E_SAMPLEALLOC, "Got hr %#lx.\n", hr);
/* We cannot retrieve the sample from GetBuffer() without calling Update(). * Otherwise GetBuffer() will hang as there are no samples to return. */ @@ -8733,7 +8733,7 @@ static void test_ddrawstream_mem_allocator(void) ok(hr == S_OK, "Got hr %#lx.\n", hr); ok(IsEqualGUID(&sample_mt->majortype, &MEDIATYPE_Video), "Got major type %s.\n", debugstr_guid(&sample_mt->majortype)); - todo_wine ok(IsEqualGUID(&sample_mt->subtype, &MEDIASUBTYPE_RGB555), + ok(IsEqualGUID(&sample_mt->subtype, &MEDIASUBTYPE_RGB555), "Got subtype %s.\n", debugstr_guid(&sample_mt->subtype)); todo_wine ok(sample_mt->bFixedSizeSamples == TRUE, "Got fixed size %d.\n", sample_mt->bFixedSizeSamples); ok(!sample_mt->bTemporalCompression, "Got temporal compression %d.\n", sample_mt->bTemporalCompression); @@ -8769,7 +8769,7 @@ static void test_ddrawstream_mem_allocator(void) ok(hr == S_OK, "Got hr %#lx.\n", hr); hr = IMediaSample_GetMediaType(media_sample2, &sample_mt); ok(hr == S_OK, "Got hr %#lx.\n", hr); - todo_wine ok(IsEqualGUID(&sample_mt->subtype, &MEDIASUBTYPE_RGB555), + ok(IsEqualGUID(&sample_mt->subtype, &MEDIASUBTYPE_RGB555), "Got subtype %s.\n", wine_dbgstr_guid(&sample_mt->subtype)); DeleteMediaType(sample_mt);