[PATCH v2 08/11] winegstreamer: Implement generic media source.
Derek Lesho
dlesho at codeweavers.com
Thu Feb 20 18:28:35 CST 2020
On 2/20/20 2:12 AM, Nikolay Sivov wrote:
> Another important thing that I forgot to mention. IMFMediaStream and
> IMFMediaSource relationship creates refcount circular dependency -
> source will have to hold stream reference, and stream has to hold
> source reference. At the same time they have to separate enough, and
> not to share critical sections for example when they don't have to,
> because there is not reason to block streams with one another, or with
> the source. It's not a structural flaw in your patch, it's how it
> should work, however I suspect current implementation will not allow
> to ever release those objects.
>
> The way to solve this is explicit Shutdown() call for source, which
> dissociates those objects. Calling it will essentially detach streams
> from source, making GetMediaSource() fail for example (I don't know if
> we have tests for that yet), it will also shutdown event queues for
> streams and the source, which is important for waking event handlers
> that might wait in GetEvent() for example. Source reader should be
> calling this method correctly already I think, respecting additional
> configurable option not to shut it down, in case application will want
> to read from the same source again.
>
I'm aware of this, I already implement Shutdown() by calling
media_source_teardown, which performs the actions you describe:
https://github.com/Guy1524/wine/blob/mfplat/dlls/winegstreamer/media_source.c#L714
Although looking at it again I should probably reorder the code to
release the streams first.
More information about the wine-devel
mailing list