Revert "Add support for screen sharing with PipeWire on Wayland"

This reverts commit dd20c9c1e3f681f6c33d1879c76f588bd4b095bd.

Reason for revert: Speculative revert; looks like it causes crashes on official builders. See crbug.com/901319.

Original change's description:
> Add support for screen sharing with PipeWire on Wayland
>
> Currently, when users want to use the screen sharing and are using the
> Wayland display server (the default on Fedora distribution), then it
> doesn't work, because the WebRTC only includes the X11 implementation.
> This change adds the support by using the PipeWire multimedia server.
>
> The PipeWire implementation in WebRTC stays in
> screen-capturer-pipewire.c and is guarded by the rtc_use_pipewire build
> flag that is automatically enabled on Linux.
>
> More information are included in the relevant commit messages.
>
> Tested on the current Chromium master and Firefox.
>
> The sysroot changes are requested in:
> https://chromium-review.googlesource.com/c/chromium/src/+/1258174
>
> Co-authored-by: Jan Grulich <grulja@gmail.com>
> Co-authored-by: Eike Rathke <erathke@redhat.com>
> Change-Id: I212074a4bc437b99a77bf383266026c5bfae7c4a
>
> BUG=chromium:682122
>
> Change-Id: I212074a4bc437b99a77bf383266026c5bfae7c4a
> Reviewed-on: https://webrtc-review.googlesource.com/c/103504
> Commit-Queue: Patrik Höglund <phoglund@webrtc.org>
> Reviewed-by: Patrik Höglund <phoglund@webrtc.org>
> Reviewed-by: Brave Yao <braveyao@webrtc.org>
> Cr-Commit-Position: refs/heads/master@{#25461}

TBR=phoglund@webrtc.org,jamiewalch@chromium.org,niklas.enbom@webrtc.org,braveyao@webrtc.org,tomas.popela@gmail.com

# Not skipping CQ checks because original CL landed > 1 day ago.

NOPRESUBMIT=true

Bug: chromium:682122, chromium:901319
Change-Id: I4ca5da77daea73cae1232953a0d633900a85a93d
Reviewed-on: https://webrtc-review.googlesource.com/c/109584
Commit-Queue: Patrik Höglund <phoglund@webrtc.org>
Reviewed-by: Patrik Höglund <phoglund@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#25522}
This commit is contained in:
Patrik Höglund
2018-11-06 13:22:54 +00:00
committed by Commit Bot
parent 82c07ea1da
commit 3ddaf3c408
35 changed files with 276 additions and 1719 deletions

View File

@ -1,84 +0,0 @@
/*
* Copyright (c) 2013 The WebRTC project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
// Don't include this file in any .h files because it pulls in some X headers.
#ifndef MODULES_DESKTOP_CAPTURE_LINUX_X_SERVER_PIXEL_BUFFER_H_
#define MODULES_DESKTOP_CAPTURE_LINUX_X_SERVER_PIXEL_BUFFER_H_
#include <X11/Xutil.h>
#include <X11/extensions/XShm.h>
#include "modules/desktop_capture/desktop_geometry.h"
#include "rtc_base/constructormagic.h"
namespace webrtc {
class DesktopFrame;
// A class to allow the X server's pixel buffer to be accessed as efficiently
// as possible.
class XServerPixelBuffer {
public:
XServerPixelBuffer();
~XServerPixelBuffer();
void Release();
// Allocate (or reallocate) the pixel buffer for |window|. Returns false in
// case of an error (e.g. window doesn't exist).
bool Init(Display* display, Window window);
bool is_initialized() { return window_ != 0; }
// Returns the size of the window the buffer was initialized for.
DesktopSize window_size() { return window_rect_.size(); }
// Returns the rectangle of the window the buffer was initialized for.
const DesktopRect& window_rect() { return window_rect_; }
// Returns true if the window can be found.
bool IsWindowValid() const;
// If shared memory is being used without pixmaps, synchronize this pixel
// buffer with the root window contents (otherwise, this is a no-op).
// This is to avoid doing a full-screen capture for each individual
// rectangle in the capture list, when it only needs to be done once at the
// beginning.
void Synchronize();
// Capture the specified rectangle and stores it in the |frame|. In the case
// where the full-screen data is captured by Synchronize(), this simply
// returns the pointer without doing any more work. The caller must ensure
// that |rect| is not larger than window_size().
bool CaptureRect(const DesktopRect& rect, DesktopFrame* frame);
private:
void ReleaseSharedMemorySegment();
void InitShm(const XWindowAttributes& attributes);
bool InitPixmaps(int depth);
Display* display_ = nullptr;
Window window_ = 0;
DesktopRect window_rect_;
XImage* x_image_ = nullptr;
XShmSegmentInfo* shm_segment_info_ = nullptr;
XImage* x_shm_image_ = nullptr;
Pixmap shm_pixmap_ = 0;
GC shm_gc_ = nullptr;
bool xshm_get_image_succeeded_ = false;
RTC_DISALLOW_COPY_AND_ASSIGN(XServerPixelBuffer);
};
} // namespace webrtc
#endif // MODULES_DESKTOP_CAPTURE_LINUX_X_SERVER_PIXEL_BUFFER_H_