-- v2: quartz: Hold the streaming lock while calling ICDecompressEnd. quartz: Use the correct stride when calculating image size in AVIDec. quartz: Get output format from source, not sink in AVIDec.
From: Anton Baskanov baskanov@gmail.com
--- dlls/quartz/avidec.c | 2 +- dlls/quartz/tests/avidec.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/dlls/quartz/avidec.c b/dlls/quartz/avidec.c index 8cc729748c1..f020d618fdb 100644 --- a/dlls/quartz/avidec.c +++ b/dlls/quartz/avidec.c @@ -552,7 +552,7 @@ static HRESULT avi_decompressor_init_stream(struct strmbase_filter *iface)
filter->late = -1;
- source_format = (VIDEOINFOHEADER *)filter->sink.pin.mt.pbFormat; + source_format = (VIDEOINFOHEADER *)filter->source.pin.mt.pbFormat; if ((res = ICDecompressBegin(filter->hvid, filter->pBihIn, &source_format->bmiHeader))) { ERR("ICDecompressBegin() failed, error %Id.\n", res); diff --git a/dlls/quartz/tests/avidec.c b/dlls/quartz/tests/avidec.c index f28dfee7402..3692b78b5bc 100644 --- a/dlls/quartz/tests/avidec.c +++ b/dlls/quartz/tests/avidec.c @@ -119,7 +119,7 @@ static LRESULT CALLBACK vfw_driver_proc(DWORD_PTR id, HDRVR driver, UINT msg, todo_wine_if (in->biSizeImage != sink_bitmap_info.biSizeImage) ok(!memcmp(in, &sink_bitmap_info, sizeof(BITMAPINFOHEADER)), "Input types didn't match.\n"); - todo_wine ok(!memcmp(out, &source_bitmap_info, sizeof(BITMAPINFOHEADER)), + ok(!memcmp(out, &source_bitmap_info, sizeof(BITMAPINFOHEADER)), "Output types didn't match.\n"); ok(!in_begin, "Got multiple ICM_DECOMPRESS_BEGIN messages.\n"); in_begin = 1;
From: Anton Baskanov baskanov@gmail.com
--- dlls/quartz/avidec.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/dlls/quartz/avidec.c b/dlls/quartz/avidec.c index f020d618fdb..d7f97e0380c 100644 --- a/dlls/quartz/avidec.c +++ b/dlls/quartz/avidec.c @@ -361,8 +361,8 @@ static HRESULT avi_decompressor_source_get_media_type(struct strmbase_pin *iface format->bmiHeader.biPlanes = sink_format->bmiHeader.biPlanes; format->bmiHeader.biBitCount = formats[index].bpp; format->bmiHeader.biCompression = formats[index].compression; - format->bmiHeader.biSizeImage = format->bmiHeader.biWidth - * format->bmiHeader.biHeight * formats[index].bpp / 8; + format->bmiHeader.biSizeImage = format->bmiHeader.biHeight * (((format->bmiHeader.biWidth + * formats[index].bpp + 31) / 8) & ~3);
if (IsEqualGUID(formats[index].subtype, &MEDIASUBTYPE_RGB565)) {
From: Anton Baskanov baskanov@gmail.com
Otherwise, the streaming thread might try to access the decompressor while it's being destroyed. --- dlls/quartz/avidec.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/dlls/quartz/avidec.c b/dlls/quartz/avidec.c index d7f97e0380c..4f1eca4f90a 100644 --- a/dlls/quartz/avidec.c +++ b/dlls/quartz/avidec.c @@ -573,10 +573,16 @@ static HRESULT avi_decompressor_cleanup_stream(struct strmbase_filter *iface) if (!filter->source.pin.peer) return S_OK;
- if (filter->hvid && (res = ICDecompressEnd(filter->hvid))) + if (filter->hvid) + { + EnterCriticalSection(&filter->filter.stream_cs); + res = ICDecompressEnd(filter->hvid); + LeaveCriticalSection(&filter->filter.stream_cs); + if (res) { ERR("ICDecompressEnd() failed, error %Id.\n", res); return E_FAIL; + } }
IMemAllocator_Decommit(filter->source.pAllocator);
v2: - Remove a fixed todo_wine.
The alignment fix should probably be easy enough to verify, by changing the width used in test_connect_pin() to something unaligned.