Rémi Bernon (@rbernon) commented about dlls/winegstreamer/media_source.c:
static HRESULT WINAPI media_stream_GetMediaSource(IMFMediaStream *iface, IMFMediaSource **out) { struct media_stream *stream = impl_from_IMFMediaStream(iface);
- struct media_source *source = impl_from_IMFMediaSource(stream->media_source);
IMFMediaSource *source_iface = stream->media_source;
struct media_source *source; HRESULT hr = S_OK;
TRACE("%p, %p.\n", iface, out);
if (!source_iface)
return MF_E_SHUTDOWN;
source = impl_from_IMFMediaSource(source_iface);
EnterCriticalSection(&source->cs);
This doesn't seem right, you'll be accessing source->cs without holding a reference on the source. There's a race condition if the stream is being disconnected in another thread.
You will probably need to introduce a per-stream critical section, to guard the stream source reference. Other stream member accesses would probably need to be guarded as well if we want to be correct.