Skip to content
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/actions/prepare-linux/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ runs:
# tools/clang/scripts/update.py of the webrtc.branch set in
# webrtc-jni/pom.xml. Update it whenever that branch changes.
- name: Select the Chromium Clang package
run: echo "CLANG_PACKAGE=clang-llvmorg-24-init-7747-g62397f8b-27.tar.xz" >> "$GITHUB_ENV"
run: echo "CLANG_PACKAGE=clang-llvmorg-24-init-14453-ge063be79-1.tar.xz" >> "$GITHUB_ENV"
shell: bash

- name: Cache the Chromium Clang package
Expand Down
4 changes: 2 additions & 2 deletions docs/guide/build.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ sudo apt-get install binutils cmake git libva-dev make meson nasm ninja-build pk
The JNI library compiles against the libc++ headers of the WebRTC build. Those headers only support the Clang that the WebRTC branch pins, so the toolchain files expect that exact Clang in `/opt/clang`. Install it this way (the package name is in `.github/actions/prepare-linux/action.yml` and changes with the WebRTC branch):

```shell
CLANG_PACKAGE=clang-llvmorg-24-init-7747-g62397f8b-27.tar.xz
CLANG_PACKAGE=clang-llvmorg-24-init-14453-ge063be79-1.tar.xz
wget https://commondatastorage.googleapis.com/chromium-browser-clang/Linux_x64/$CLANG_PACKAGE
sudo mkdir -p /opt/clang
sudo tar -xf $CLANG_PACKAGE -C /opt/clang
Expand Down Expand Up @@ -99,7 +99,7 @@ On the first run, the WebRTC source tree is loaded into the `/<user home>/webrtc

| Parameter | Description | Default Value |
| ------------------ | ------------------------------------------------------ |-----------------------------|
| webrtc.branch | The WebRTC branch to checkout. | branch-heads/8059 |
| webrtc.branch | The WebRTC branch to checkout. | branch-heads/8127 |
| webrtc.src.dir | The absolute checkout path for the WebRTC source tree. | /\<user_home\>/webrtc |
| webrtc.install.dir | The install path for the compiled WebRTC library. Is also used to link against a pre-compiled WebRTC library to reduce build time. | /\<user_home\>/webrtc/build |

Expand Down
2 changes: 1 addition & 1 deletion webrtc-jni/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<packaging>pom</packaging>

<properties>
<webrtc.branch>branch-heads/8059</webrtc.branch>
<webrtc.branch>branch-heads/8127</webrtc.branch>
<webrtc.src.dir>${user.home}/webrtc</webrtc.src.dir>
<webrtc.install.dir>${user.home}/webrtc/build</webrtc.install.dir>
<cmake.build.type>Release</cmake.build.type>
Expand Down
5 changes: 5 additions & 0 deletions webrtc-jni/src/main/cpp/dependencies/webrtc/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,10 @@ message(STATUS "WebRTC install path: ${WEBRTC_INSTALL_DIR}")

# The GN args WebRTC is built with. They come before the check for a compiled
# WebRTC below, because a build is only used if it was made with these.
# rtc_rust=false: from M158 rtp_rtcp_format links a Rust cxx bridge, whose std
# and allocator objects are not in the static library, so the JNI link would
# leave __rust_* symbols undefined. WebRTC keeps a C++ fallback for it
# (WEBRTC_WITHOUT_RUST) while the switch exists.
set(COMPILE_ARGS "target_cpu=\"${TARGET_CPU}\" \
use_custom_libcxx=${CUSTOM_LIBCXX} \
is_clang=true \
Expand All @@ -145,6 +149,7 @@ is_component_build=false \
treat_warnings_as_errors=false \
rtc_build_tools=false \
rtc_use_perfetto=false \
rtc_rust=false \
rtc_use_pipewire=false \
rtc_enable_protobuf=false \
rtc_build_examples=false \
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Applied to an LF file from the Clang package, not to a git checkout.
clang_fpm_scale_linkage.patch text eol=lf
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
The Clang that branch-heads/8127 pins declares the FP8 scale helpers as
builtins with C linkage, which fails when arm_neon.h is included inside an
extern "C++" block, as the UCRT's wchar.h does on Windows arm64. This is
llvm/llvm-project@1ac17ec2; drop it once the pinned Clang contains that commit.

--- a/third_party/llvm-build/Release+Asserts/lib/clang/24/include/arm_vector_types.h
+++ b/third_party/llvm-build/Release+Asserts/lib/clang/24/include/arm_vector_types.h
@@ -58,9 +58,15 @@
return (__fpm & ~0x8000ull) | ((fpm_t)__behaviour << 15u);
}

+#ifdef __cplusplus
+extern "C" {
+#endif
__inline__ fpm_t __attribute__((__always_inline__, __nodebug__)) __arm_set_fpm_lscale(fpm_t __fpm, uint64_t __scale);
__inline__ fpm_t __attribute__((__always_inline__, __nodebug__)) __arm_set_fpm_nscale(fpm_t __fpm, int64_t __scale);
__inline__ fpm_t __attribute__((__always_inline__, __nodebug__)) __arm_set_fpm_lscale2(fpm_t __fpm, uint64_t __scale);
+#ifdef __cplusplus
+}
+#endif

typedef __attribute__((neon_vector_type(8))) int8_t int8x8_t;
typedef __attribute__((neon_vector_type(16))) int8_t int8x16_t;
12 changes: 8 additions & 4 deletions webrtc-jni/src/main/cpp/src/JNI_RTCDataChannel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,10 @@
#include "api/data_channel_interface.h"
#include "rtc_base/logging.h"

#include <cstdint>
#include <initializer_list>
#include <memory>
#include <span>

namespace
{
Expand Down Expand Up @@ -279,7 +281,7 @@ JNIEXPORT void JNICALL Java_dev_onvoid_webrtc_RTCDataChannel_sendDirectBuffer
if (address != NULL) {
jlong bufferLength = env->GetDirectBufferCapacity(jBuffer);

webrtc::CopyOnWriteBuffer data(address, static_cast<size_t>(bufferLength));
webrtc::CopyOnWriteBuffer data(std::span<const uint8_t>(address, static_cast<size_t>(bufferLength)));

if (!channel->Send(webrtc::DataBuffer(data, static_cast<bool>(isBinary)))) {
env->Throw(jni::JavaRuntimeException(env, "Data channel rejected the send"));
Expand Down Expand Up @@ -309,7 +311,8 @@ JNIEXPORT void JNICALL Java_dev_onvoid_webrtc_RTCDataChannel_sendByteArrayBuffer
if (!bytes) {
return;
}
webrtc::CopyOnWriteBuffer data(bytes.get(), env->GetArrayLength(jBufferArray));
webrtc::CopyOnWriteBuffer data(std::span<const uint8_t>(
reinterpret_cast<const uint8_t *>(bytes.get()), static_cast<size_t>(env->GetArrayLength(jBufferArray))));
bytes.reset();

if (!channel->Send(webrtc::DataBuffer(data, static_cast<bool>(isBinary)))) {
Expand Down Expand Up @@ -373,7 +376,7 @@ static void sendDirectBufferAsync(JNIEnv * env, jobject caller, jobject jBuffer,
}

// The data is copied before returning, so the caller may reuse the buffer.
webrtc::CopyOnWriteBuffer data(address + position, static_cast<size_t>(length));
webrtc::CopyOnWriteBuffer data(std::span<const uint8_t>(address + position, static_cast<size_t>(length)));

sendAsync(env, channel, webrtc::DataBuffer(data, static_cast<bool>(isBinary)), jObserver);
}
Expand Down Expand Up @@ -401,7 +404,8 @@ static void sendByteArrayBufferAsync(JNIEnv * env, jobject caller, jbyteArray jB
if (!bytes) {
return;
}
webrtc::CopyOnWriteBuffer data(bytes.get(), env->GetArrayLength(jBufferArray));
webrtc::CopyOnWriteBuffer data(std::span<const uint8_t>(
reinterpret_cast<const uint8_t *>(bytes.get()), static_cast<size_t>(env->GetArrayLength(jBufferArray))));
bytes.reset();

sendAsync(env, channel, webrtc::DataBuffer(data, static_cast<bool>(isBinary)), jObserver);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
import java.util.stream.Collectors;

import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.parallel.Execution;
Expand Down Expand Up @@ -147,7 +148,16 @@ void pickerCanBeTurnedOff() {
capturer.setUseSystemPicker(true);
capturer.setUseSystemPicker(false);

assertEquals(screens, capturer.getDesktopSources());
List<DesktopSource> after = capturer.getDesktopSources();

if (isWayland()) {
// The PipeWire capturer lists one source, whose ID is new for
// each native capturer.
assertEquals(titles(screens), titles(after));
}
else {
assertEquals(screens, after);
}
}
finally {
capturer.dispose();
Expand Down Expand Up @@ -285,7 +295,15 @@ void screenCapturerFollowsScreen() throws Exception {
* Starting a capturer in a Wayland session asks the user what to share.
*/
private static void assumeNoPortalDialog() {
assumeFalse("wayland".equals(System.getenv("XDG_SESSION_TYPE")), "Wayland session");
assumeFalse(isWayland(), "Wayland session");
}

private static boolean isWayland() {
return "wayland".equals(System.getenv("XDG_SESSION_TYPE"));
}

private static List<String> titles(List<DesktopSource> sources) {
return sources.stream().map(source -> source.title).collect(Collectors.toList());
}

/** The mean luma of every fourth pixel in every fourth row. */
Expand Down
Loading