Commit fc4076d8 authored by Andreas Pehrson's avatar Andreas Pehrson
Browse files

Bug 1826530 - Switch the ScreenCapture thread on mac to a...

Bug 1826530 - Switch the ScreenCapture thread on mac to a MessagePumpForNonMainUIThreads. r=webrtc-reviewers,ng

Differential Revision: https://phabricator.services.mozilla.com/D175102
parent 314619d1
Loading
Loading
Loading
Loading
+3 −7
Original line number Diff line number Diff line
@@ -418,8 +418,9 @@ static std::unique_ptr<DesktopCapturer> CreateDesktopCapturerAndThread(
    }

    nsIThreadManager::ThreadCreationOptions threadOptions;
#ifdef XP_WIN
    // Windows desktop capture needs a UI thread
#if defined(XP_WIN) || defined(XP_MACOSX)
    // Windows desktop capture needs a UI thread.
    // Mac screen capture needs a thread with a CFRunLoop.
    threadOptions.isUiThread = true;
#endif
    NS_NewNamedThread("DesktopCapture", aOutThread, nullptr, threadOptions);
@@ -751,11 +752,6 @@ void DesktopCaptureImpl::ShutdownOnThread() {
void DesktopCaptureImpl::CaptureFrameOnThread() {
  RTC_DCHECK_RUN_ON(&mCaptureThreadChecker);

#if defined(WEBRTC_MAC)
  // Give cycles to the RunLoop so frame callbacks can happen
  CFRunLoopRunInMode(kCFRunLoopDefaultMode, 0.01, true);
#endif

  auto start = mozilla::TimeStamp::Now();
  mCapturer->CaptureFrame();
  auto end = mozilla::TimeStamp::Now();