Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: cherry-pick 2 changes from webrtc #39274

Merged
merged 1 commit into from Aug 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions patches/webrtc/.patches
@@ -1,3 +1,5 @@
fix_fallback_to_x11_capturer_on_wayland.patch
m114_move_transceiver_iteration_loop_over_to_the_signaling_thread.patch
m114_sdp_reject_duplicate_ssrcs_in_ssrc-groups.patch
pipewire_capturer_fix_fcntl_call_when_duplicating_a_file_descriptor.patch
pipewire_capturer_increase_buffer_size_to_avoid_buffer_overflow.patch
@@ -0,0 +1,29 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Jan Grulich <grulja@gmail.com>
Date: Fri, 12 May 2023 20:59:06 +0200
Subject: PipeWire capturer: fix fcntl call when duplicating a file descriptor

The fcntl() call has variable arguments, therefore we need to pass 0 to
specify there are no other arguments for this call, otherwise we might
end up with an argument that is random garbage.

Bug: webrtc:15174
Change-Id: I34f16a942d80913b667d8ade7eed557b0233be01
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/305120
Reviewed-by: Alexander Cooper <alcooper@chromium.org>
Commit-Queue: Jan Grulich <grulja@gmail.com>
Cr-Commit-Position: refs/heads/main@{#40060}

diff --git a/modules/desktop_capture/linux/wayland/shared_screencast_stream.cc b/modules/desktop_capture/linux/wayland/shared_screencast_stream.cc
index 71bde9b21234e789a84cd3617df054d9a4604992..4e79ecd36982c15219bf4d3d2e337e2157359e88 100644
--- a/modules/desktop_capture/linux/wayland/shared_screencast_stream.cc
+++ b/modules/desktop_capture/linux/wayland/shared_screencast_stream.cc
@@ -432,7 +432,7 @@ bool SharedScreenCastStreamPrivate::StartScreenCastStream(

if (fd >= 0) {
pw_core_ = pw_context_connect_fd(
- pw_context_, fcntl(fd, F_DUPFD_CLOEXEC), nullptr, 0);
+ pw_context_, fcntl(fd, F_DUPFD_CLOEXEC, 0), nullptr, 0);
} else {
pw_core_ = pw_context_connect(pw_context_, nullptr, 0);
}
@@ -0,0 +1,47 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Jan Grulich <grulja@gmail.com>
Date: Mon, 10 Jul 2023 10:07:38 +0200
Subject: PipeWire capturer: increase buffer size to avoid buffer overflow

Recently added framerate option can cause a buffer overflow and make
PipeWire to fail on negotiation, which effectively makes screen sharing
not to work.

Bug: webrtc:15346
Change-Id: I4a68e26c8f85ca287b06a25da500b6a7009e075f
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/311541
Reviewed-by: Alexander Cooper <alcooper@chromium.org>
Commit-Queue: Jan Grulich <grulja@gmail.com>
Cr-Commit-Position: refs/heads/main@{#40413}

diff --git a/modules/desktop_capture/linux/wayland/shared_screencast_stream.cc b/modules/desktop_capture/linux/wayland/shared_screencast_stream.cc
index 4e79ecd36982c15219bf4d3d2e337e2157359e88..a95007b34a8cd19cfac83bd26530b0c1b7eb368a 100644
--- a/modules/desktop_capture/linux/wayland/shared_screencast_stream.cc
+++ b/modules/desktop_capture/linux/wayland/shared_screencast_stream.cc
@@ -263,7 +263,7 @@ void SharedScreenCastStreamPrivate::OnStreamParamChanged(

that->stream_size_ = DesktopSize(width, height);

- uint8_t buffer[1024] = {};
+ uint8_t buffer[2048] = {};
auto builder = spa_pod_builder{buffer, sizeof(buffer)};

// Setup buffers and meta header for new format.
@@ -348,7 +348,7 @@ void SharedScreenCastStreamPrivate::OnRenegotiateFormat(void* data, uint64_t) {
{
PipeWireThreadLoopLock thread_loop_lock(that->pw_main_loop_);

- uint8_t buffer[2048] = {};
+ uint8_t buffer[4096] = {};

spa_pod_builder builder = spa_pod_builder{buffer, sizeof(buffer)};

@@ -464,7 +464,7 @@ bool SharedScreenCastStreamPrivate::StartScreenCastStream(

pw_stream_add_listener(pw_stream_, &spa_stream_listener_,
&pw_stream_events_, this);
- uint8_t buffer[2048] = {};
+ uint8_t buffer[4096] = {};

spa_pod_builder builder = spa_pod_builder{buffer, sizeof(buffer)};