winegstreamer: Return E_UNEXPECTED when calling IWMReader::Stop() if no stream is open.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=52038
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Zebediah Figura 2021-12-15 11:50:19 -06:00 committed by Alexandre Julliard
parent 4a206a7ecb
commit 78f916f598
2 changed files with 14 additions and 0 deletions

View File

@ -356,6 +356,14 @@ static HRESULT WINAPI WMReader_Stop(IWMReader *iface)
TRACE("reader %p.\n", reader);
EnterCriticalSection(&reader->reader.cs);
if (!reader->reader.wg_parser)
{
LeaveCriticalSection(&reader->reader.cs);
WARN("No stream is open; returning E_UNEXPECTED.\n");
return E_UNEXPECTED;
}
stop_streaming(reader);
IWMReaderCallback_OnStatus(reader->callback, WMT_STOPPED, S_OK,
WMT_TYPE_DWORD, (BYTE *)&zero, reader->context);

View File

@ -2169,6 +2169,9 @@ static void test_async_reader_streaming(void)
IWMReader_QueryInterface(reader, &IID_IWMProfile, (void **)&profile);
IWMReader_QueryInterface(reader, &IID_IWMReaderAdvanced2, (void **)&advanced);
hr = IWMReader_Stop(reader);
ok(hr == E_UNEXPECTED, "Got hr %#x.\n", hr);
hr = IWMReaderAdvanced2_OpenStream(advanced, &stream.IStream_iface, &callback.IWMReaderCallback_iface, (void **)0xdeadbeef);
ok(hr == S_OK, "Got hr %#x.\n", hr);
ok(stream.refcount > 1, "Got refcount %d.\n", stream.refcount);
@ -2257,6 +2260,9 @@ static void test_async_reader_streaming(void)
ok(callback.refcount == 1, "Got outstanding refcount %d.\n", callback.refcount);
callback_cleanup(&callback);
hr = IWMReader_Stop(reader);
ok(hr == E_UNEXPECTED, "Got hr %#x.\n", hr);
ok(stream.refcount == 1, "Got outstanding refcount %d.\n", stream.refcount);
CloseHandle(stream.file);
ret = DeleteFileW(filename);