Rémi Bernon (@rbernon) commented about dlls/winegstreamer/media_sink.c:
static HRESULT WINAPI media_sink_AddStreamSink(IMFFinalizableMediaSink *iface, DWORD stream_sink_id, IMFMediaType *media_type, IMFStreamSink **stream_sink) {
- FIXME("iface %p, stream_sink_id %#lx, media_type %p, stream_sink %p stub!\n",
- struct media_sink *media_sink = impl_from_IMFFinalizableMediaSink(iface);
- struct stream_sink *object;
- HRESULT hr;
- TRACE("iface %p, stream_sink_id %#lx, media_type %p, stream_sink %p.\n", iface, stream_sink_id, media_type, stream_sink);
- return E_NOTIMPL;
- if (media_sink_get_stream_sink_by_id(media_sink, stream_sink_id))
return MF_E_STREAMSINK_EXISTS;
You'll need to guard `media_sink_get_stream_sink_by_id` calls with the CS as well. And for correctness it has to include the `list_add_tail(&media_sink->stream_sinks, &object->entry);` below (so that no other thread can insert the stream in the meantime).
This means you will have to create the stream sink inside the CS (the simplest, but you can also create it outside and eventually destroy it if it was already present).