Skip to content

Commit ffd1d5a

Browse files
committed
fix build issue on linux.
1 parent 7bc323e commit ffd1d5a

6 files changed

Lines changed: 129 additions & 10 deletions

webrtc-sys/libwebrtc/build_linux.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,12 @@ git apply "$COMMAND_DIR/patches/add_licenses.patch" -v --ignore-space-change --i
7575
git apply "$COMMAND_DIR/patches/fix_license_json_parsing.patch" -v --ignore-space-change --ignore-whitespace --whitespace=nowarn
7676
git apply "$COMMAND_DIR/patches/ssl_verify_callback_with_native_handle.patch" -v --ignore-space-change --ignore-whitespace --whitespace=nowarn
7777
git apply "$COMMAND_DIR/patches/add_deps.patch" -v --ignore-space-change --ignore-whitespace --whitespace=nowarn
78-
#git apply "$COMMAND_DIR/patches/fix_desktop_capture_compile.patch" -v --ignore-space-change --ignore-whitespace --whitespace=nowarn
78+
git apply "$COMMAND_DIR/patches/fix_desktop_capture_compile.patch" -v --ignore-space-change --ignore-whitespace --whitespace=nowarn
7979
git apply "$COMMAND_DIR/patches/external_audio_source.patch" -v --ignore-space-change --ignore-whitespace --whitespace=nowarn
80+
git apply "$COMMAND_DIR/patches/fix_payload_type_picker_compile.patch" -v --ignore-space-change --ignore-whitespace --whitespace=nowarn
81+
git apply "$COMMAND_DIR/patches/fix_pipewire_utils_compile.patch" -v --ignore-space-change --ignore-whitespace --whitespace=nowarn
82+
git apply "$COMMAND_DIR/patches/fix_ssl_stream_adapter_compile.patch" -v --ignore-space-change --ignore-whitespace --whitespace=nowarn
83+
git apply "$COMMAND_DIR/patches/fix_copy_on_write_buffer_compile.patch" -v --ignore-space-change --ignore-whitespace --whitespace=nowarn
8084

8185
# Disable CREL (compact relocations). Chromium's build enables experimental
8286
# CREL via -Wa,--crel which causes segfaults on aarch64-linux (and is known
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
diff --git a/rtc_base/copy_on_write_buffer.cc b/rtc_base/copy_on_write_buffer.cc
2+
index 68e98ce729..c314d8b123 100644
3+
--- a/rtc_base/copy_on_write_buffer.cc
4+
+++ b/rtc_base/copy_on_write_buffer.cc
5+
@@ -28,7 +28,10 @@
6+
namespace webrtc {
7+
8+
CopyOnWriteBuffer::RawBuffer::RawBuffer(size_t size)
9+
- : size_(size), data_(std::make_unique_for_overwrite<uint8_t[]>(size)) {}
10+
+ // std::make_unique_for_overwrite needs a C++20 standard library
11+
+ // (libstdc++ >= 11). `new T[n]` default-initializes, which is the same
12+
+ // "leave the bytes uninitialized" semantics.
13+
+ : size_(size), data_(new uint8_t[size]) {}
14+
15+
scoped_refptr<CopyOnWriteBuffer::RefCountedBuffer>
16+
CopyOnWriteBuffer::CreateBuffer(size_t capacity) {
Lines changed: 38 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,46 @@
11
diff --git a/modules/desktop_capture/linux/wayland/shared_screencast_stream.cc b/modules/desktop_capture/linux/wayland/shared_screencast_stream.cc
2-
index 070257f072..61fd0c8f3b 100644
2+
index 7366fd5b73..d23505877a 100644
33
--- a/modules/desktop_capture/linux/wayland/shared_screencast_stream.cc
44
+++ b/modules/desktop_capture/linux/wayland/shared_screencast_stream.cc
5-
@@ -71,10 +71,10 @@ constexpr int CursorMetaSize(int w, int h) {
6-
w * h * kCursorBpp);
5+
@@ -74,12 +74,15 @@ constexpr int CursorMetaSize(int w, int h) {
6+
w * h * kBytesPerPixel);
77
}
88

99
-constexpr PipeWireVersion kDmaBufModifierMinVersion = {.major = 0,
10-
+const PipeWireVersion kDmaBufModifierMinVersion = {.major = 0,
11-
.minor = 3,
12-
.micro = 33};
10+
- .minor = 3,
11+
- .micro = 33};
1312
-constexpr PipeWireVersion kDropSingleModifierMinVersion = {.major = 0,
14-
+const PipeWireVersion kDropSingleModifierMinVersion = {.major = 0,
15-
.minor = 3,
16-
.micro = 40};
13+
- .minor = 3,
14+
- .micro = 40};
15+
+// Not constexpr constants: PipeWireVersion holds a std::string, so it is only
16+
+// a literal type with a C++20 standard library (libstdc++ >= 12), and
17+
+// namespace-scope instances would need static initializers.
18+
+PipeWireVersion DmaBufModifierMinVersion() {
19+
+ return {.major = 0, .minor = 3, .micro = 33};
20+
+}
21+
+PipeWireVersion DropSingleModifierMinVersion() {
22+
+ return {.major = 0, .minor = 3, .micro = 40};
23+
+}
1724

25+
class SharedScreenCastStreamPrivate {
26+
public:
27+
@@ -558,8 +561,8 @@ bool SharedScreenCastStreamPrivate::StartScreenCastStream(
28+
29+
// Modifiers can be used with PipeWire >= 0.3.33
30+
const bool has_dmabuf_support =
31+
- egl_dmabuf_ && pw_client_version_ >= kDmaBufModifierMinVersion &&
32+
- pw_server_version_ >= kDmaBufModifierMinVersion;
33+
+ egl_dmabuf_ && pw_client_version_ >= DmaBufModifierMinVersion() &&
34+
+ pw_server_version_ >= DmaBufModifierMinVersion();
35+
36+
struct spa_fraction default_frame_rate = SPA_FRACTION(frame_rate_, 1);
37+
struct spa_rectangle resolution;
38+
@@ -1084,7 +1087,7 @@ bool SharedScreenCastStreamPrivate::ProcessDMABuffer(
39+
spa_video_format_.format)
40+
<< "), marking as failed and renegotiating stream parameters";
41+
42+
- if (pw_server_version_ >= kDropSingleModifierMinVersion) {
43+
+ if (pw_server_version_ >= DropSingleModifierMinVersion()) {
44+
render_device->MarkModifierFailed(spa_video_format_.format, modifier_);
45+
} else {
46+
// For older PipeWire versions, mark all modifiers as failed for this
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
diff --git a/call/payload_type_picker.cc b/call/payload_type_picker.cc
2+
index 45105a1054..d12c3b34e2 100644
3+
--- a/call/payload_type_picker.cc
4+
+++ b/call/payload_type_picker.cc
5+
@@ -370,7 +370,7 @@ void PayloadTypeRecorder::Rollback() {
6+
RTCError RtpHeaderExtensionRecorder::AddMapping(RtpHeaderExtensionId id,
7+
absl::string_view uri,
8+
bool encrypt) {
9+
- auto it = uri_to_id_.find(std::pair{uri, encrypt});
10+
+ auto it = uri_to_id_.find(std::pair{std::string(uri), encrypt});
11+
if (it != uri_to_id_.end()) {
12+
if (it->second != id) {
13+
RTC_HISTOGRAM_BOOLEAN(
14+
@@ -393,7 +393,7 @@ RTCError RtpHeaderExtensionRecorder::AddMapping(RtpHeaderExtensionId id,
15+
RTCErrorOr<RtpHeaderExtensionId> RtpHeaderExtensionRecorder::LookupId(
16+
absl::string_view uri,
17+
bool encrypt) const {
18+
- auto it = uri_to_id_.find(std::pair{uri, encrypt});
19+
+ auto it = uri_to_id_.find(std::pair{std::string(uri), encrypt});
20+
if (it == uri_to_id_.end()) {
21+
return RTCError(RTCErrorType::INVALID_PARAMETER,
22+
"No ID found for extension");
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
diff --git a/modules/portal/pipewire_utils.cc b/modules/portal/pipewire_utils.cc
2+
index 850726cc58..cfa30307be 100644
3+
--- a/modules/portal/pipewire_utils.cc
4+
+++ b/modules/portal/pipewire_utils.cc
5+
@@ -28,10 +28,6 @@
6+
7+
namespace webrtc {
8+
9+
-constexpr PipeWireVersion kReentrantDeinitMinVersion = {.major = 0,
10+
- .minor = 3,
11+
- .micro = 49};
12+
-
13+
PipeWireVersion PipeWireVersion::Parse(const std::string_view& version) {
14+
std::vector<std::string_view> parsed_version = split(version, '.');
15+
16+
@@ -104,6 +100,11 @@ PipeWireInitializer::PipeWireInitializer() {
17+
18+
RTC_NO_SANITIZE("cfi-icall")
19+
PipeWireInitializer::~PipeWireInitializer() {
20+
+ // Not constexpr/global: PipeWireVersion holds a std::string, so it is only a
21+
+ // literal type with a C++20 standard library (libstdc++ >= 12), and a
22+
+ // namespace-scope instance would need a static initializer.
23+
+ const PipeWireVersion kReentrantDeinitMinVersion = {
24+
+ .major = 0, .minor = 3, .micro = 49};
25+
PipeWireVersion pw_client_version =
26+
PipeWireVersion::Parse(pw_get_library_version());
27+
if (pw_client_version >= kReentrantDeinitMinVersion) {
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
diff --git a/rtc_base/ssl_stream_adapter.h b/rtc_base/ssl_stream_adapter.h
2+
index 0568bd0310..7052a0dbf4 100644
3+
--- a/rtc_base/ssl_stream_adapter.h
4+
+++ b/rtc_base/ssl_stream_adapter.h
5+
@@ -14,6 +14,7 @@
6+
#include <stddef.h>
7+
#include <stdint.h>
8+
9+
+#include <cstddef>
10+
#include <memory>
11+
#include <optional>
12+
#include <set>
13+
@@ -129,7 +130,7 @@ class SSLStreamAdapter : public StreamInterface {
14+
static std::unique_ptr<SSLStreamAdapter> Create(
15+
std::unique_ptr<StreamInterface> stream,
16+
absl::AnyInvocable<void(SSLHandshakeError)> handshake_error,
17+
- nullptr_t /*field_trials*/) {
18+
+ std::nullptr_t /*field_trials*/) {
19+
return Create(std::move(stream), std::move(handshake_error));
20+
}
21+

0 commit comments

Comments
 (0)