Bug 1611486 - P2 - Cherry-pick webrct desktop sharing X hang fixes;r=dminor

c380e97ee6

Differential Revision: https://phabricator.services.mozilla.com/D61001

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Nico Grunbaum 2020-01-30 05:26:08 +00:00
Родитель 6a8f257529
Коммит f81beba455
2 изменённых файлов: 20 добавлений и 5 удалений

Просмотреть файл

@ -152,6 +152,13 @@ DesktopAndCursorComposer::DesktopAndCursorComposer(
DesktopAndCursorComposer::~DesktopAndCursorComposer() = default;
std::unique_ptr<DesktopAndCursorComposer>
DesktopAndCursorComposer::CreateWithoutMouseCursorMonitor(
std::unique_ptr<DesktopCapturer> desktop_capturer) {
return std::unique_ptr<DesktopAndCursorComposer>(
new DesktopAndCursorComposer(desktop_capturer.release(), nullptr));
}
void DesktopAndCursorComposer::Start(DesktopCapturer::Callback* callback) {
callback_ = callback;
if (mouse_monitor_)

Просмотреть файл

@ -29,7 +29,7 @@ class DesktopAndCursorComposer : public DesktopCapturer,
public DesktopCapturer::Callback,
public MouseCursorMonitor::Callback {
public:
// Creates a new blender that captures mouse cursor using |mouse_monitor| and
// Creates a new comp that captures mouse cursor using |mouse_monitor| and
// renders it into the frames generated by |desktop_capturer|. If
// |mouse_monitor| is NULL the frames are passed unmodified. Takes ownership
// of both arguments.
@ -45,6 +45,12 @@ class DesktopAndCursorComposer : public DesktopCapturer,
~DesktopAndCursorComposer() override;
// Creates a new composer that relies on an external source for cursor shape
// and position information via the MouseCursorMonitor::Callback interface.
static std::unique_ptr<DesktopAndCursorComposer>
CreateWithoutMouseCursorMonitor(
std::unique_ptr<DesktopCapturer> desktop_capturer);
// DesktopCapturer interface.
void Start(DesktopCapturer::Callback* callback) override;
void SetSharedMemoryFactory(
@ -53,6 +59,12 @@ class DesktopAndCursorComposer : public DesktopCapturer,
void SetExcludedWindow(WindowId window) override;
bool FocusOnSelectedSource() override;
// MouseCursorMonitor::Callback interface.
void OnMouseCursor(MouseCursor* cursor) override;
void OnMouseCursorPosition(webrtc::MouseCursorMonitor::CursorState,
const webrtc::DesktopVector&) override {};
void OnMouseCursorPosition(const DesktopVector& position) override;
private:
// Allows test cases to use a fake MouseCursorMonitor implementation.
friend class DesktopAndCursorComposerTest<true>;
@ -68,10 +80,6 @@ class DesktopAndCursorComposer : public DesktopCapturer,
void OnCaptureResult(DesktopCapturer::Result result,
std::unique_ptr<DesktopFrame> frame) override;
// MouseCursorMonitor::Callback interface.
void OnMouseCursor(MouseCursor* cursor) override;
void OnMouseCursorPosition(const DesktopVector& position) override;
const std::unique_ptr<DesktopCapturer> desktop_capturer_;
const std::unique_ptr<MouseCursorMonitor> mouse_monitor_;
// This is a temporary flag to decide how to use the |mouse_monitor_|.