Commit 191635e5 authored by Guido Urdaneta's avatar Guido Urdaneta Committed by Commit Bot

Use a message loop of type UI on the main thread of video-capture service

AVFoundation calls made by the video-capture service on its main thread
require a CFRunLoop which is provided by a UI message loop.
This fixes a number of regressions related to detection of plugged/unplugged
devices that appeared when the default message loops on Mac were changed from
CFRunLoop to Default.

Bug: 834581
Change-Id: If565f400e52407c2f71e32f93e9472556051bad1
Reviewed-on: https://chromium-review.googlesource.com/1049931Reviewed-by: default avatarRobert Sesek <rsesek@chromium.org>
Reviewed-by: default avatarJohn Abd-El-Malek <jam@chromium.org>
Commit-Queue: Guido Urdaneta <guidou@chromium.org>
Cr-Commit-Position: refs/heads/master@{#557202}
parent 30e79d01
...@@ -3047,6 +3047,7 @@ jumbo_split_static_library("browser") { ...@@ -3047,6 +3047,7 @@ jumbo_split_static_library("browser") {
"//chrome/app_shim", "//chrome/app_shim",
"//chrome/browser/apps/app_shim", "//chrome/browser/apps/app_shim",
"//chrome/browser/ui/cocoa/notifications:common", "//chrome/browser/ui/cocoa/notifications:common",
"//services/video_capture/public/mojom:constants",
"//third_party/crashpad/crashpad/client:client", "//third_party/crashpad/crashpad/client:client",
"//third_party/google_toolbox_for_mac", "//third_party/google_toolbox_for_mac",
"//third_party/mozilla", "//third_party/mozilla",
......
...@@ -78,6 +78,7 @@ include_rules = [ ...@@ -78,6 +78,7 @@ include_rules = [
"+services/ui/common", "+services/ui/common",
"+services/ui/public", "+services/ui/public",
"+services/ui/service.h", "+services/ui/service.h",
"+services/video_capture/public",
"+services/viz/privileged", "+services/viz/privileged",
"+skia/ext", "+skia/ext",
"+third_party/boringssl/src/include", "+third_party/boringssl/src/include",
......
...@@ -276,6 +276,7 @@ ...@@ -276,6 +276,7 @@
#include "sandbox/win/src/sandbox_policy.h" #include "sandbox/win/src/sandbox_policy.h"
#elif defined(OS_MACOSX) #elif defined(OS_MACOSX)
#include "chrome/browser/chrome_browser_main_mac.h" #include "chrome/browser/chrome_browser_main_mac.h"
#include "services/video_capture/public/mojom/constants.mojom.h"
#elif defined(OS_CHROMEOS) #elif defined(OS_CHROMEOS)
#include "ash/public/interfaces/constants.mojom.h" #include "ash/public/interfaces/constants.mojom.h"
#include "chrome/browser/ash_service_registry.h" #include "chrome/browser/ash_service_registry.h"
...@@ -2096,6 +2097,13 @@ void ChromeContentBrowserClient::AdjustUtilityServiceProcessCommandLine( ...@@ -2096,6 +2097,13 @@ void ChromeContentBrowserClient::AdjustUtilityServiceProcessCommandLine(
command_line->AppendSwitchNative(sw.first, sw.second); command_line->AppendSwitchNative(sw.first, sw.second);
} }
#endif // BUILDFLAG(ENABLE_MUS) #endif // BUILDFLAG(ENABLE_MUS)
#if defined(OS_MACOSX)
// On Mac, the video-capture service requires a CFRunLoop, provided by a UI
// message loop, to run AVFoundation code. See https://crbug.com/834581
if (identity.name() == video_capture::mojom::kServiceName)
command_line->AppendSwitch(switches::kMessageLoopTypeUi);
#endif
} }
std::string ChromeContentBrowserClient::GetApplicationLocale() { std::string ChromeContentBrowserClient::GetApplicationLocale() {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment