[media] Boost priority while calling CoCreateInstance
Calling CoCreateInstance() in EnumerateDirectShowDevices() can cause DLLs to be loaded. Since this method is called on a background thread this can cause a priority inversion of the main thread is also trying to acquire the dynamic loader lock. This annotation temporarily boosts the priority of the thread to allow it to complete loading the library and drop the lock. Noticed in crash/8c42f60e46efa272. Bug: 973868 Change-Id: I4eef876860d712e639bcf404553b8d8d06b5864c Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2208649 Auto-Submit: Reilly Grant <reillyg@chromium.org> Commit-Queue: Guido Urdaneta <guidou@chromium.org> Reviewed-by: Guido Urdaneta <guidou@chromium.org> Cr-Commit-Position: refs/heads/master@{#770471}
This commit is contained in:
@ -240,6 +240,10 @@ std::string GetDeviceModelId(const std::string& device_id) {
|
||||
}
|
||||
|
||||
HRESULT EnumerateDirectShowDevices(IEnumMoniker** enum_moniker) {
|
||||
// Mitigate the issues caused by loading DLLs on a background thread
|
||||
// (http://crbug/973868).
|
||||
SCOPED_MAY_LOAD_LIBRARY_AT_BACKGROUND_PRIORITY();
|
||||
|
||||
ComPtr<ICreateDevEnum> dev_enum;
|
||||
HRESULT hr = ::CoCreateInstance(CLSID_SystemDeviceEnum, NULL, CLSCTX_INPROC,
|
||||
IID_PPV_ARGS(&dev_enum));
|
||||
|
Reference in New Issue
Block a user