Skip to content

Commit

Permalink
Set the main thread of the audio process as type UI on Mac
Browse files Browse the repository at this point in the history
This ensures that the main thread as a CFRunLoop, which is required
by audio APIs on Mac.

Bug: 841845
Change-Id: I10be74d77c1585014a63896099eb2b4acb5b345b
Reviewed-on: https://chromium-review.googlesource.com/1054227
Commit-Queue: Guido Urdaneta <guidou@chromium.org>
Commit-Queue: Olga Sharonova <olka@chromium.org>
Reviewed-by: Olga Sharonova <olka@chromium.org>
Cr-Commit-Position: refs/heads/master@{#557597}
  • Loading branch information
Guido Urdaneta authored and Commit Bot committed May 10, 2018
1 parent d8f72fd commit 1a29174
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions chrome/browser/chrome_content_browser_client.cc
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,7 @@
#include "sandbox/win/src/sandbox_policy.h"
#elif defined(OS_MACOSX)
#include "chrome/browser/chrome_browser_main_mac.h"
#include "services/audio/public/mojom/constants.mojom.h"
#include "services/video_capture/public/mojom/constants.mojom.h"
#elif defined(OS_CHROMEOS)
#include "ash/public/interfaces/constants.mojom.h"
Expand Down Expand Up @@ -2099,9 +2100,11 @@ void ChromeContentBrowserClient::AdjustUtilityServiceProcessCommandLine(
#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)
// On Mac, the video-capture and audio services require a CFRunLoop, provided
// by a UI message loop, to run AVFoundation and CoreAudio code.
// See https://crbug.com/834581
if (identity.name() == video_capture::mojom::kServiceName ||
identity.name() == audio::mojom::kServiceName)
command_line->AppendSwitch(switches::kMessageLoopTypeUi);
#endif
}
Expand Down

0 comments on commit 1a29174

Please sign in to comment.