[PATCH v2 08/11] winegstreamer: Implement generic media source.

Nikolay Sivov nsivov at codeweavers.com
Thu Feb 20 02:12:32 CST 2020


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.



More information about the wine-devel mailing list