From ff461d9d263813774eba658db702ee4b907560c0 Mon Sep 17 00:00:00 2001 From: Heilig Benedek Date: Wed, 6 Feb 2019 06:25:42 +0100 Subject: [PATCH] fix: make getUserMedia APIs work again on C72+ (#16763) * fix: resolve macos check for video and audio capture devices * fix: resolve a minor compilation error --- atom/browser/atom_browser_client.cc | 12 ++++++++++++ atom/browser/atom_browser_client.h | 3 +++ 2 files changed, 15 insertions(+) diff --git a/atom/browser/atom_browser_client.cc b/atom/browser/atom_browser_client.cc index 720dd03aac..e23c2dc0dd 100644 --- a/atom/browser/atom_browser_client.cc +++ b/atom/browser/atom_browser_client.cc @@ -82,6 +82,8 @@ #include "net/ssl/client_cert_store_win.h" #elif defined(OS_MACOSX) #include "net/ssl/client_cert_store_mac.h" +#include "services/audio/public/mojom/constants.mojom.h" +#include "services/video_capture/public/mojom/constants.mojom.h" #elif defined(USE_OPENSSL) #include "net/ssl/client_cert_store.h" #endif @@ -512,6 +514,16 @@ void AtomBrowserClient::AppendExtraCommandLineSwitches( } } +void AtomBrowserClient::AdjustUtilityServiceProcessCommandLine( + const service_manager::Identity& identity, + base::CommandLine* command_line) { +#if defined(OS_MACOSX) + if (identity.name() == video_capture::mojom::kServiceName || + identity.name() == audio::mojom::kServiceName) + command_line->AppendSwitch(::switches::kMessageLoopTypeUi); +#endif +} + void AtomBrowserClient::DidCreatePpapiPlugin(content::BrowserPpapiHost* host) { #if BUILDFLAG(ENABLE_PEPPER_FLASH) host->GetPpapiHost()->AddHostFactoryFilter( diff --git a/atom/browser/atom_browser_client.h b/atom/browser/atom_browser_client.h index bf169d8c40..71faf97128 100644 --- a/atom/browser/atom_browser_client.h +++ b/atom/browser/atom_browser_client.h @@ -85,6 +85,9 @@ class AtomBrowserClient : public content::ContentBrowserClient, content::SiteInstance* pending_site_instance) override; void AppendExtraCommandLineSwitches(base::CommandLine* command_line, int child_process_id) override; + void AdjustUtilityServiceProcessCommandLine( + const service_manager::Identity& identity, + base::CommandLine* command_line) override; void DidCreatePpapiPlugin(content::BrowserPpapiHost* browser_host) override; std::string GetGeolocationApiKey() override; content::QuotaPermissionContext* CreateQuotaPermissionContext() override;