Skip to content
Open
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/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ on:
workflow_dispatch:

env:
WEBRTC_CACHE_BRANCH: 7339
WEBRTC_CACHE_BRANCH: 7977
WEBRTC_CHECKOUT_FOLDER: webrtc
WEBRTC_INSTALL_FOLDER: webrtc/build

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:
default: "X.Y.Z-SNAPSHOT"

env:
WEBRTC_CACHE_BRANCH: 7339
WEBRTC_CACHE_BRANCH: 7977
WEBRTC_CHECKOUT_FOLDER: webrtc
WEBRTC_INSTALL_FOLDER: webrtc/build

Expand Down
2 changes: 1 addition & 1 deletion docs/guide/build.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ On the first run, the WebRTC source tree will be loaded into the `/<user home>/w

| Parameter | Description | Default Value |
| ------------------ | ------------------------------------------------------ |-----------------------------|
| webrtc.branch | The WebRTC branch to checkout. | branch-heads/7339 |
| webrtc.branch | The WebRTC branch to checkout. | branch-heads/7977 |
| 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/7339</webrtc.branch>
<webrtc.branch>branch-heads/7977</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
6 changes: 1 addition & 5 deletions webrtc-jni/src/main/cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -104,11 +104,7 @@ if(APPLE)
target_link_options(${PROJECT_NAME} PRIVATE "-ObjC")
target_link_libraries(${PROJECT_NAME} "-framework Foundation" "-framework AVFoundation" "-framework CoreMedia" "-framework CoreAudio" "-framework IOKit" "-framework CoreVideo" "-framework VideoToolbox" "-framework QuartzCore")
elseif(LINUX)
if(NOT TARGET_CPU MATCHES "^arm")
set(CXX_LIBS "-static-libgcc -stdlib=libc++ -lc++ -lc++abi")
else()
set(CXX_LIBS "-static-libgcc")
endif()
set(CXX_LIBS "-static-libgcc -stdlib=libc++ -lc++ -lc++abi")

target_link_libraries(${PROJECT_NAME} ${CXX_LIBS} pulse udev)
elseif(WIN32)
Expand Down
98 changes: 92 additions & 6 deletions webrtc-jni/src/main/cpp/dependencies/webrtc/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,11 @@ add_library(${PROJECT_NAME} STATIC pseudo.cxx pseudo.hxx)

set(CUSTOM_LIBCXX false)

if(LINUX AND NOT TARGET_CPU MATCHES "^arm")
if(LINUX)
# All Linux targets build against webrtc's bundled libc++. The arm
# sysroots' libstdc++ (Debian bullseye, GCC 10) predates the C++20
# library features newer webrtc branches use; the sysroot stays for the
# glibc floor only.
set(CUSTOM_LIBCXX true)
endif()

Expand Down Expand Up @@ -127,26 +131,65 @@ message(STATUS "WebRTC use custom libcxx: ${CUSTOM_LIBCXX}")
message(STATUS "WebRTC install path: ${WEBRTC_INSTALL_DIR}")


# The api/video utility classes (AdaptedVideoTrackSource, VideoAdapter,
# VideoBroadcaster) fell out of the default build graph when they moved out
# of media/base, so their objects no longer reach the monolithic archive.
# On Linux and Windows the shared library link leaves their symbols
# undefined and loading fails at runtime; they are built and linked
# explicitly. The Apple archive is assembled from an object glob and only
# needs them built.
if(WIN32)
set(VIDEO_UTIL_LIB_NAMES adapted_video_track_source.lib video_adapter.lib video_broadcaster.lib)
else()
set(VIDEO_UTIL_LIB_NAMES libadapted_video_track_source.a libvideo_adapter.a libvideo_broadcaster.a)
endif()

if(EXISTS "${WEBRTC_LIB_PATH_INSTALLED}")
set(TARGET_INC_DIR ${WEBRTC_INSTALL_DIR}/include)
set(TARGET_LINK_LIB ${WEBRTC_LIB_PATH_INSTALLED})
set(TARGET_LIB_DIR ${WEBRTC_INSTALL_DIR}/lib)
set(TARGET_LIBCPP_BUILDTOOLS_INC_DIR ${TARGET_INC_DIR}/third_party/libc++/)
set(TARGET_LIBCPP_INC_DIR ${TARGET_INC_DIR}/third_party/libc++/include)
set(TARGET_LIBCPP_ABI_INC_DIR ${TARGET_INC_DIR}/third_party/libc++abi/include)
set(VIDEO_UTIL_LIB_DIR ${WEBRTC_INSTALL_DIR}/lib)
else()
set(TARGET_INC_DIR ${WEBRTC_SRC})
set(TARGET_LINK_LIB ${WEBRTC_LIB_PATH})
set(TARGET_LIB_DIR ${WEBRTC_SRC}/${WEBRTC_BUILD}/obj)
set(TARGET_LIBCPP_BUILDTOOLS_INC_DIR ${WEBRTC_SRC}/buildtools/third_party/libc++/)
set(TARGET_LIBCPP_INC_DIR ${WEBRTC_SRC}/third_party/libc++/src/include)
set(TARGET_LIBCPP_ABI_INC_DIR ${WEBRTC_SRC}/third_party/libc++abi/src/include)
if(WIN32)
set(VIDEO_UTIL_LIB_DIR ${WEBRTC_SRC}/${WEBRTC_BUILD}/obj/api/video)
else()
# The flat re-archives; gn's originals are thin archives that break
# when copied away from their object files.
set(VIDEO_UTIL_LIB_DIR ${WEBRTC_SRC}/${WEBRTC_BUILD}/obj)
endif()
endif()

if(LINUX AND NOT TARGET_CPU MATCHES "^arm")
set(VIDEO_UTIL_LINK_LIBS "")
if(NOT APPLE)
foreach(VIDEO_UTIL_LIB ${VIDEO_UTIL_LIB_NAMES})
list(APPEND VIDEO_UTIL_LINK_LIBS "${VIDEO_UTIL_LIB_DIR}/${VIDEO_UTIL_LIB}")
endforeach()
endif()

if(LINUX)
target_include_directories(${PROJECT_NAME} PUBLIC ${TARGET_LIBCPP_BUILDTOOLS_INC_DIR})
target_include_directories(${PROJECT_NAME} SYSTEM PUBLIC ${TARGET_LIBCPP_INC_DIR} ${TARGET_LIBCPP_ABI_INC_DIR})

# The bundled libc++ requires the hardening mode chosen at configuration
# time since branch-heads/7977. It must travel with these include dirs,
# so every target compiling against them (the shim, jni-voithos) gets it.
target_compile_definitions(${PROJECT_NAME} PUBLIC _LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_EXTENSIVE)

# Clang discovers the GCC installation inside the cross sysroots and adds
# its libstdc++ headers to the implicit search path, which collide with
# the bundled libc++ (std::abort missing, ldiv_t unknown). Exclude the
# implicit C++ stdlib dirs so only the bundled headers serve C++.
target_compile_options(${PROJECT_NAME} PUBLIC -nostdinc++)

target_link_directories(${PROJECT_NAME} PUBLIC "${TARGET_LIB_DIR}")
endif()

Expand All @@ -156,7 +199,7 @@ target_include_directories(${PROJECT_NAME}
${TARGET_INC_DIR}/third_party/abseil-cpp
${TARGET_INC_DIR}/third_party/libyuv/include
)
target_link_libraries(${PROJECT_NAME} ${TARGET_LINK_LIB})
target_link_libraries(${PROJECT_NAME} ${TARGET_LINK_LIB} ${VIDEO_UTIL_LINK_LIBS})

if(APPLE)
target_include_directories(${PROJECT_NAME}
Expand Down Expand Up @@ -287,7 +330,7 @@ execute_command(
message(STATUS "WebRTC: compile")
if(APPLE)
execute_command(
COMMAND ninja -C "${WEBRTC_BUILD}" :default api/audio_codecs:builtin_audio_decoder_factory api/task_queue:default_task_queue_factory sdk:native_api sdk:default_codec_factory_objc pc:peer_connection sdk:videocapture_objc
COMMAND ninja -C "${WEBRTC_BUILD}" :default api/audio_codecs:builtin_audio_decoder_factory api/task_queue:default_task_queue_factory sdk:native_api sdk:default_codec_factory_objc pc:peer_connection sdk:videocapture_objc api/video:adapted_video_track_source api/video:video_adapter api/video:video_broadcaster
WORKING_DIRECTORY "${WEBRTC_SRC}"
)

Expand All @@ -301,10 +344,38 @@ else()
COMMAND ninja -C "${WEBRTC_BUILD}"
WORKING_DIRECTORY "${WEBRTC_SRC}"
)

# The api/video utility targets are not reachable from the default
# graph since their move out of media/base; build them explicitly so
# their symbols exist for the shared library link.
execute_command(
COMMAND ninja -C "${WEBRTC_BUILD}" api/video:adapted_video_track_source api/video:video_adapter api/video:video_broadcaster
WORKING_DIRECTORY "${WEBRTC_SRC}"
)
endif()

if(LINUX)
if(LINUX AND NOT TARGET_CPU MATCHES "^arm")
# Ninja only schedules libc++/libc++abi for the target toolchain when
# a linked output needs them; a static archive only cross build never
# does, so the object globs below would come up empty and produce
# hollow archives. Request the archives explicitly.
execute_command(
COMMAND ninja -C "${WEBRTC_BUILD}" obj/buildtools/third_party/libc++/libc++.a obj/buildtools/third_party/libc++abi/libc++abi.a
WORKING_DIRECTORY "${WEBRTC_SRC}"
)

# gn emits thin archives whose members reference objects by relative
# path, so they break once copied to the install tree. Re-archive the
# api/video utility objects into regular archives, like libc++ below.
foreach(VIDEO_UTIL_TARGET adapted_video_track_source video_adapter video_broadcaster)
file(GLOB_RECURSE VIDEO_UTIL_OBJS
${WEBRTC_SRC}/${WEBRTC_BUILD}/obj/api/video/${VIDEO_UTIL_TARGET}/*.o
)
execute_command(
COMMAND ${CMAKE_AR} rcs ${WEBRTC_SRC}/${WEBRTC_BUILD}/obj/lib${VIDEO_UTIL_TARGET}.a ${VIDEO_UTIL_OBJS}
)
endforeach()

# Collect lib++ objects
file(GLOB_RECURSE LibCPP_OBJS
${WEBRTC_SRC}/${WEBRTC_BUILD}/obj/buildtools/third_party/libc++/libc++/*.o
Expand Down Expand Up @@ -340,7 +411,22 @@ if(LINUX)
DIRECTORY "${WEBRTC_SRC}/third_party/libc++abi/src/include"
DESTINATION "${WEBRTC_INSTALL_DIR}/include/third_party/libc++abi"
)
endif()
endif()

if(LINUX)
foreach(VIDEO_UTIL_LIB ${VIDEO_UTIL_LIB_NAMES})
install(
FILES "${WEBRTC_SRC}/${WEBRTC_BUILD}/obj/${VIDEO_UTIL_LIB}"
DESTINATION "${WEBRTC_INSTALL_DIR}/lib"
)
endforeach()
elseif(WIN32)
foreach(VIDEO_UTIL_LIB ${VIDEO_UTIL_LIB_NAMES})
install(
FILES "${WEBRTC_SRC}/${WEBRTC_BUILD}/obj/api/video/${VIDEO_UTIL_LIB}"
DESTINATION "${WEBRTC_INSTALL_DIR}/lib"
)
endforeach()
endif()

install(FILES "${WEBRTC_LIB_PATH}" DESTINATION "${WEBRTC_INSTALL_DIR}/lib")
Expand Down

This file was deleted.

7 changes: 0 additions & 7 deletions webrtc-jni/src/main/cpp/include/JNI_RTCPeerConnection.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions webrtc-jni/src/main/cpp/include/api/PeerConnectionObserver.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ namespace jni
void OnIceGatheringChange(webrtc::PeerConnectionInterface::IceGatheringState state) override;
void OnIceCandidate(const webrtc::IceCandidateInterface * candidate) override;
void OnIceCandidateError(const std::string & address, int port, const std::string & url, int error_code, const std::string & error_text) override;
void OnIceCandidatesRemoved(const std::vector<webrtc::Candidate> & candidates) override;
void OnIceConnectionReceivingChange(bool receiving) override;

private:
Expand All @@ -65,7 +64,6 @@ namespace jni
jmethodID onIceGatheringChange;
jmethodID onIceCandidate;
jmethodID onIceCandidateError;
jmethodID onIceCandidatesRemoved;
jmethodID onIceConnectionReceivingChange;
};

Expand Down
2 changes: 0 additions & 2 deletions webrtc-jni/src/main/cpp/include/api/RTCIceCandidate.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,7 @@ namespace jni
};

JavaLocalRef<jobject> toJava(JNIEnv * env, const webrtc::IceCandidateInterface * candidate);
JavaLocalRef<jobject> toJavaCricket(JNIEnv * env, const webrtc::Candidate & candidate);
std::unique_ptr<webrtc::IceCandidateInterface> toNative(JNIEnv * env, const JavaRef<jobject> & javaType);
webrtc::Candidate toNativeCricket(JNIEnv * env, const JavaRef<jobject> & javaType);
};
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

#include "api/video/video_frame.h"
#include "api/video/video_source_interface.h"
#include "media/base/adapted_video_track_source.h"
#include "api/video/adapted_video_track_source.h"
#include "rtc_base/ref_counted_object.h"

#include "media/SyncClock.h"
Expand Down
Loading