[vlc-devel] [PATCH 0/1] dshow: Fix assertion when stopping
remi at remlab.net
Thu Jun 1 18:10:32 CEST 2017
Le torstaina 1. kesäkuuta 2017, 13.55.24 EEST Hugo Beauzée-Luyssen a écrit :
> > > > Isn´t FindDevices() potentially called from the GUI thread?
> > > > Isn´t the GUI thread entered in an STA?
> > >
> > > Only the Qt GUI calls CoInitializeEx (as far as interfaces are
> > > concerned, obviously)
> > Yes but isn´t the Qt Win32 port also entering an apartment internally,
> > and isn´t that unfortunately an STA?
> It does enter an STA, but it immediately releases it once it's done with
> handling file associations.
Are you sure that this is warranted by Qt API? That looks like a version-
dependent implementation detail. I was not even aware that we managed
associations through Qt.
> > The enumeration callbacks indeed seem fine. But what about the access
> > callbacks? What happens if Open() and Read(), or Open() and Close() are
> > serialized yet called in different threads?
> > (...)
> > > Given that you say it would be safe if (...), and that this condition is
> > > met, I'm not sure why this patch is wrong. What would be the correct
> > > solution in your opinion?
> > AFAICT, either the DirectShow code has a thread keeping the MTA alive for
> > the
> > lifetime of the access/access_demux instance, or we ensure that another
> > thread
> > takes care of the same (e.g. in Win32 specific core code).
> The MTA gets released by the dshow module from its Close() function, but
> if I understand you correctly, you're worry is that Open and Close won't
> be called from the same thread, right?
> To be honest I'd have assumed it was always the case
There is no such warranty. I don´t recall any specific where Open and Close
would be on different threads. But I wouldn´t be surprised if it was possible
in other call access instantiation sites than the input master or input
It is definitely possible for Read/Control to run in different thread than
Open/Close, e.g. with prefetch. Which means you can´t assume that the MTA is
entered during Read or Control, unless you do so explicitly.
And then, there´s the problem that another module in the same thread might
attempt to enter an STA. A module should never leak its apartmenet to its
More information about the vlc-devel