[vlc-commits] dshow: Use COINIT_APARTMENTTHREADED to list devices

Hugo Beauzée-Luyssen git at videolan.org
Tue Jul 4 10:56:12 CEST 2017


vlc | branch: master | Hugo Beauzée-Luyssen <hugo at beauzee.fr> | Tue Jul  4 10:51:28 2017 +0200| [0dece1534e95406bd88cc9ec7a30971bba9dab1e] | committer: Hugo Beauzée-Luyssen

dshow: Use COINIT_APARTMENTTHREADED to list devices

This is most likely coming from a Qt thread, which is already
initialized as STA. If it is not coming from a Qt thread, then we don't
really care since the API also work when called from a MTA, and we
release the threading apartment once we're done (which was the real
culprit for #16935)

Fix #18482

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=0dece1534e95406bd88cc9ec7a30971bba9dab1e
---

 modules/access/dshow/dshow.cpp | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/modules/access/dshow/dshow.cpp b/modules/access/dshow/dshow.cpp
index d16efba490..a8742eb1eb 100644
--- a/modules/access/dshow/dshow.cpp
+++ b/modules/access/dshow/dshow.cpp
@@ -2049,7 +2049,9 @@ static int FindDevices( vlc_object_t *p_this, const char *psz_name,
     {
         bool b_audio = !strcmp( psz_name, CFG_PREFIX "adev" );
 
-        ComContext ctx( COINIT_MULTITHREADED );
+        // Use STA as this most likely comes from a Qt thread, which is
+        // initialized as STA.
+        ComContext ctx( COINIT_APARTMENTTHREADED );
 
         FindCaptureDevice( p_this, NULL, &list_devices, b_audio );
 



More information about the vlc-commits mailing list