Zebediah Figura (@zfigura) commented about dlls/winegstreamer/wm_reader.c:
static HRESULT WINAPI profile_GetStreamByNumber(IWMProfile3 *iface, WORD stream_number, IWMStreamConfig **config) {
- FIXME("iface %p, stream_number %u, config %p, stub!\n", iface, stream_number, config);
- return E_NOTIMPL;
- struct wm_reader *reader = impl_from_IWMProfile3(iface);
- TRACE("iface %p, stream_number %u, config %p.\n", iface, stream_number, config);
- EnterCriticalSection(&reader->cs);
- if (!stream_number || stream_number > reader->stream_count)
- {
LeaveCriticalSection(&reader->cs);
return NS_E_NO_STREAM;
- }
- return profile_GetStream(iface, stream_number - 1, config);
This leaves the CS acquired on success. I also think it'd be simpler to save the CS and just do something like
if (!stream_number) return NS_E_NO_STREAM;
hr = profile_GetStream(stream_number - 1); if (hr == E_INVALIDARG) hr = NS_E_NO_STREAM; return hr;