Skip to content

Commit

Permalink
Backport upstream changes up to 9c1d9a8 (#25)
Browse files Browse the repository at this point in the history
  • Loading branch information
rogurotus authored Jan 11, 2023
1 parent 55fcb21 commit 1882ac4
Show file tree
Hide file tree
Showing 19 changed files with 145 additions and 56 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -122,3 +122,4 @@ webrtc_build/

# Backup files produced by CLI tools
*.bk
depot_tools/
1 change: 1 addition & 0 deletions build.windows.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ if (!(Test-Path $BUILD_DIR)) {

Exec { gclient sync --with_branch_heads -r $WEBRTC_COMMIT }
Exec { git apply --ignore-space-change -v $PATCH_DIR\add_licenses.patch }
Exec { git apply --ignore-space-change -v $PATCH_DIR\4k.patch }
Exec { git apply --ignore-space-change -v $PATCH_DIR\webrtc_voice_engine.patch }
Exec { git apply --ignore-space-change -v $PATCH_DIR\win_dynamic_crt.patch }
Exec { git apply --ignore-space-change -v $PATCH_DIR\windows_fix_towupper.patch }
Expand Down
12 changes: 7 additions & 5 deletions build/android/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,16 @@ copy:

.PHONY: patch
patch: common-patch
cd $(SRC_DIR) \
&& patch -p2 < $(PATCH_DIR)/android_version.patch \
&& $(SCRIPTS_DIR)/generate_android_version.sh $(SRC_DIR) $(WEBRTC_COMMIT) $(WEBRTC_VERSION)
cd $(SRC_DIR) && \
patch -p2 < $(PATCH_DIR)/disable_use_hermetic_xcode_on_linux.patch && \
patch -p2 < $(PATCH_DIR)/android_version.patch && \
patch -p2 < $(PATCH_DIR)/android_use_libunwind.patch && \
$(SCRIPTS_DIR)/generate_android_version.sh $(SRC_DIR) $(WEBRTC_COMMIT) $(WEBRTC_VERSION)


define build-android
cd $(SRC_DIR) && \
gn gen $(BUILD_DIR)/static/$1 --args='$(EXTRA_GN_ARGS) $(CC_WRAPPER) target_os="android" target_cpu="$2" $3' && \
gn gen $(BUILD_DIR)/static/$1 --args='$(EXTRA_GN_ARGS) use_custom_libcxx=false $(CC_WRAPPER) target_os="android" target_cpu="$2" $3' && \
ninja -C $(BUILD_DIR)/static/$1 && \
ninja -C $(BUILD_DIR)/static/$1 native_api

Expand All @@ -74,7 +76,7 @@ endef
.PHONY: build
build: patch
cd $(SRC_DIR) && \
python3 $(SRC_DIR)/tools_webrtc/android/build_aar.py \
vpython3 $(SRC_DIR)/tools_webrtc/android/build_aar.py \
--build-dir $(BUILD_DIR)/aar \
--output $(BUILD_DIR)/libwebrtc.aar \
--arch armeabi-v7a arm64-v8a x86_64 \
Expand Down
8 changes: 2 additions & 6 deletions build/common.mk
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,8 @@ common-patch:
echo "apply patches ..." \
&& cd $(SRC_DIR) \
&& patch -p1 < $(PATCH_DIR)/nacl_armv6_2.patch \
&& patch -p2 < $(PATCH_DIR)/macos_h264_encoder.patch \
&& patch -p2 < $(PATCH_DIR)/disable_use_hermetic_xcode_on_linux.patch \
&& patch -p2 < $(PATCH_DIR)/linux_is_pod_deprecate.patch \
&& patch -p2 < $(PATCH_DIR)/add_licenses.patch
&& patch -p2 < $(PATCH_DIR)/add_licenses.patch \
&& patch -p2 < $(PATCH_DIR)/4k.patch

.PHONY: common-package
common-package: copy
Expand All @@ -55,9 +53,7 @@ common-copy: generate-licenses
mkdir -p $(PACKAGE_DIR)/release
mkdir -p $(PACKAGE_DIR)/include
cp $(BUILD_DIR_DEBUG)/obj/libwebrtc.a $(PACKAGE_DIR)/debug/libwebrtc.a
cp $(BUILD_DIR_DEBUG)/obj/third_party/boringssl/libboringssl.a $(PACKAGE_DIR)/debug/libboringssl.a
cp $(BUILD_DIR_RELEASE)/obj/libwebrtc.a $(PACKAGE_DIR)/release/libwebrtc.a
cp $(BUILD_DIR_RELEASE)/obj/third_party/boringssl/libboringssl.a $(PACKAGE_DIR)/release/libboringssl.a

rsync -amv '--include=*/' '--include=*.h' '--include=*.hpp' '--exclude=*' $(SRC_DIR)/. $(PACKAGE_DIR)/include/.

Expand Down
5 changes: 4 additions & 1 deletion build/ios/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,13 @@ all: clean build package
package:
mkdir -p $(PACKAGE_DIR) && \
cd $(BUILD_DIR) && \
zip -r $(PACKAGE_DIR)/$(subst $(space),,$(PACKAGE_NAME)).zip WebRTC.xcframework/*
zip -9 -r $(PACKAGE_DIR)/$(subst $(space),,$(PACKAGE_NAME)).zip WebRTC.xcframework/*

.PHONY: patch
patch: common-patch
echo "apply iOS patches ..." && \
cd $(SRC_DIR) && \
patch -p2 < $(PATCH_DIR)/macos_h264_encoder.patch

.PHONY: build
build: patch
Expand Down
10 changes: 10 additions & 0 deletions build/linux-arm64/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ copy: common-copy

.PHONY: patch
patch: common-patch
cd $(SRC_DIR) && \
patch -p2 < $(PATCH_DIR)/4k_linux.patch && \
patch -p2 < $(PATCH_DIR)/disable_use_hermetic_xcode_on_linux.patch && \
patch -p2 < $(PATCH_DIR)/linux_is_pod_deprecate.patch

.PHONY: build
build: download patch
Expand All @@ -42,3 +46,9 @@ build: download patch
gn gen $(BUILD_DIR_RELEASE) --args='$(EXTRA_GN_ARGS) is_debug=false $(CC_WRAPPER)' && \
ninja -C $(BUILD_DIR_DEBUG) && \
ninja -C $(BUILD_DIR_RELEASE)

cd $(BUILD_DIR_DEBUG)/obj && \
/usr/bin/ar -rc $(BUILD_DIR_DEBUG)/obj/libwebrtc.a `find . -name '*.o'`

cd $(BUILD_DIR_RELEASE)/obj && \
/usr/bin/ar -rc $(BUILD_DIR_RELEASE)/obj/libwebrtc.a `find . -name '*.o'`
10 changes: 10 additions & 0 deletions build/linux-x64/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ copy: common-copy

.PHONY: patch
patch: common-patch
cd $(SRC_DIR) && \
patch -p2 < $(PATCH_DIR)/4k_linux.patch && \
patch -p2 < $(PATCH_DIR)/disable_use_hermetic_xcode_on_linux.patch && \
patch -p2 < $(PATCH_DIR)/linux_is_pod_deprecate.patch

.PHONY: build
build: download patch
Expand All @@ -42,3 +46,9 @@ build: download patch
gn gen $(BUILD_DIR_RELEASE) --args='$(EXTRA_GN_ARGS) is_debug=false $(CC_WRAPPER)' && \
ninja -C $(BUILD_DIR_DEBUG) && \
ninja -C $(BUILD_DIR_RELEASE)

cd $(BUILD_DIR_DEBUG)/obj && \
/usr/bin/ar -rc $(BUILD_DIR_DEBUG)/obj/libwebrtc.a `find . -name '*.o'`

cd $(BUILD_DIR_RELEASE)/obj && \
/usr/bin/ar -rc $(BUILD_DIR_RELEASE)/obj/libwebrtc.a `find . -name '*.o'`
11 changes: 10 additions & 1 deletion build/macos-arm64/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,22 @@ all: clean build package
.PHONY: package
package: copy
cd $(PACKAGE_DIR) && \
tar -czvf $(subst $(space),,$(PACKAGE_NAME)).tar.gz include debug release NOTICE VERSION
tar -czvf $(subst $(space),,$(PACKAGE_NAME)).tar.gz include debug release NOTICE VERSION Frameworks

.PHONY: copy
copy: common-copy
rm -f $(PACKAGE_DIR)/lib/libboringssl.a
rm -rf $(PACKAGE_DIR)/Frameworks/WebRTC.xcframework
xcodebuild \
-create-xcframework \
-framework $(BUILD_DIR_RELEASE)/WebRTC.framework \
-debug-symbols $(BUILD_DIR_RELEASE)/WebRTC.dSYM \
-output $(PACKAGE_DIR)/Frameworks/WebRTC.xcframework

.PHONY: patch
patch: common-patch
cd $(SRC_DIR) && \
patch -p2 < $(PATCH_DIR)/macos_h264_encoder.patch

.PHONY: build
build: patch
Expand Down
11 changes: 10 additions & 1 deletion build/macos-x64/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,22 @@ all: clean build package
.PHONY: package
package: copy
cd $(PACKAGE_DIR) && \
tar -czvf $(subst $(space),,$(PACKAGE_NAME)).tar.gz include debug release NOTICE VERSION
tar -czvf $(subst $(space),,$(PACKAGE_NAME)).tar.gz include debug release NOTICE VERSION Frameworks

.PHONY: copy
copy: common-copy
rm -f $(PACKAGE_DIR)/lib/libboringssl.a
rm -rf $(PACKAGE_DIR)/Frameworks/WebRTC.xcframework
xcodebuild \
-create-xcframework \
-framework $(BUILD_DIR_RELEASE)/WebRTC.framework \
-debug-symbols $(BUILD_DIR_RELEASE)/WebRTC.dSYM \
-output $(PACKAGE_DIR)/Frameworks/WebRTC.xcframework

.PHONY: patch
patch: common-patch
cd $(SRC_DIR) && \
patch -p2 < $(PATCH_DIR)/macos_h264_encoder.patch

.PHONY: build
build: patch
Expand Down
23 changes: 6 additions & 17 deletions disk_cleanup.ps1
Original file line number Diff line number Diff line change
@@ -1,24 +1,13 @@
$ErrorActionPreference = "Stop"

Get-PSDrive

# Cache 済み Docker Image の削除
docker rmi $(docker images -q -a)

# Android SDK の削除
if (($Env:ANDROID_HOME -ne $null) -and (Test-Path $Env:ANDROID_HOME)) {
(Get-Item $Env:ANDROID_HOME).Delete()
}
if (($Env:ANDROID_NDK_HOME -ne $null) -and (Test-Path $Env:ANDROID_NDK_HOME)) {
(Get-Item $Env:ANDROID_NDK_HOME).Delete()
}
Remove-Item -Recurse -Force $Env:ANDROID_NDK_HOME

# JVM の削除
if (($Env:JAVA_HOME_11_X64 -ne $null) -and (Test-Path $Env:JAVA_HOME_11_X64)) {
Remove-Item -Recurse -Force $Env:JAVA_HOME_11_X64
}
if (($Env:JAVA_HOME_8_X64 -ne $null) -and (Test-Path $Env:JAVA_HOME_8_X64)) {
Remove-Item -Recurse -Force $Env:JAVA_HOME_8_X64
}
if (($Env:JAVA_HOME_7_X64 -ne $null) -and (Test-Path $Env:JAVA_HOME_7_X64)) {
Remove-Item -Recurse -Force $Env:JAVA_HOME_7_X64
}
Remove-Item -Recurse -Force $Env:JAVA_HOME_11_X64
Remove-Item -Recurse -Force $Env:JAVA_HOME_8_X64

Get-PSDrive
3 changes: 3 additions & 0 deletions disk_cleanup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

df -h

# Cache 済み Docker Image の削除
docker rmi $(docker images -q -a)

# Boost の削除
sudo rm -rf /usr/local/share/boost

Expand Down
1 change: 1 addition & 0 deletions docker/android/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ RUN rm -f /etc/apt/apt.conf.d/docker-clean \
RUN apt update \
&& apt upgrade -y \
&& apt install -y build-essential \
cmake \
curl \
git \
libncurses5 \
Expand Down
1 change: 1 addition & 0 deletions docker/linux-arm64/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ RUN rm -f /etc/apt/apt.conf.d/docker-clean \
RUN apt update \
&& apt upgrade -y \
&& apt install -y build-essential \
cmake \
curl \
git \
libncurses5 \
Expand Down
1 change: 1 addition & 0 deletions docker/linux-x64/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ RUN rm -f /etc/apt/apt.conf.d/docker-clean \
RUN apt update \
&& apt upgrade -y \
&& apt install -y build-essential \
cmake \
curl \
git \
libncurses5 \
Expand Down
19 changes: 19 additions & 0 deletions patch/4k.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Copyright 2018-2019, Shiguredo Inc, tnoho and melpon and kdxu
# from https://github.com/shiguredo/momo/blob/develop/patch/4k.patch

diff --git a/src/video/config/encoder_stream_factory.cc b/src/video/config/encoder_stream_factory.cc
index fceadf09b4..a73b7e9f6f 100644
--- a/src/video/config/encoder_stream_factory.cc
+++ b/src/video/config/encoder_stream_factory.cc
@@ -86,8 +86,10 @@ static int GetMaxDefaultVideoBitrateKbps(int width,
max_bitrate = 1700;
} else if (width * height <= 960 * 540) {
max_bitrate = 2000;
- } else {
+ } else if (width * height <= 1920 * 1080) {
max_bitrate = 2500;
+ } else {
+ max_bitrate = 15000;
}
if (is_screenshare)
max_bitrate = std::max(max_bitrate, 1200);
21 changes: 21 additions & 0 deletions patch/4k_linux.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Copyright 2018-2019, Shiguredo Inc, tnoho and melpon and kdxu
# from https://github.com/shiguredo/momo/blob/develop/patch/4k.patch

diff --git a/src/modules/video_capture/linux/device_info_v4l2.cc b/src/modules/video_capture/linux/device_info_v4l2.cc
index 39f72b0..3cb1226 100644
--- a/src/modules/video_capture/linux/device_info_v4l2.cc
+++ b/src/modules/video_capture/linux/device_info_v4l2.cc
@@ -232,11 +232,11 @@ int32_t DeviceInfoV4l2::FillCapabilities(int fd) {
unsigned int videoFormats[] = {V4L2_PIX_FMT_MJPEG, V4L2_PIX_FMT_YUV420,
V4L2_PIX_FMT_YUYV, V4L2_PIX_FMT_UYVY};

- int sizes = 13;
+ int sizes = 14;
unsigned int size[][2] = {{128, 96}, {160, 120}, {176, 144}, {320, 240},
{352, 288}, {640, 480}, {704, 576}, {800, 600},
{960, 720}, {1280, 720}, {1024, 768}, {1440, 1080},
- {1920, 1080}};
+ {1920, 1080}, {3840, 2160}};

for (int fmts = 0; fmts < totalFmts; fmts++) {
for (int i = 0; i < sizes; i++) {
26 changes: 26 additions & 0 deletions patch/android_use_libunwind.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
diff --git a/src/build/config/BUILD.gn b/src/build/config/BUILD.gn
index 265d4bc07..71ec29437 100644
--- a/src/build/config/BUILD.gn
+++ b/src/build/config/BUILD.gn
@@ -241,6 +241,8 @@ group("common_deps") {

if (use_custom_libcxx) {
public_deps += [ "//buildtools/third_party/libc++" ]
+ } else {
+ public_deps += [ "//buildtools/third_party/libunwind" ]
}

if (use_afl) {
diff --git a/src/buildtools/third_party/libunwind/BUILD.gn b/src/buildtools/third_party/libunwind/BUILD.gn
index a8287bf..a948450 100644
--- a/src/buildtools/third_party/libunwind/BUILD.gn
+++ b/src/buildtools/third_party/libunwind/BUILD.gn
@@ -20,7 +20,7 @@ config("libunwind_config") {
}

source_set("libunwind") {
- visibility = []
+ visibility = ["//build/config:common_deps"]
if (is_fuchsia) {
visibility += [ "//buildtools/third_party/libc++abi" ]
} else if (is_android) {
13 changes: 0 additions & 13 deletions patch/ios_disable_mllvm.patch

This file was deleted.

24 changes: 12 additions & 12 deletions patch/windows_fix_towupper.patch
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
diff --git a/src/modules/desktop_capture/win/full_screen_win_application_handler.cc b/src/modules/desktop_capture/win/full_screen_win_application_handler.cc
index f7047dba06..4222dfc01e 100644
--- a/src/modules/desktop_capture/win/full_screen_win_application_handler.cc
+++ b/src/modules/desktop_capture/win/full_screen_win_application_handler.cc
@@ -11,6 +11,7 @@
#include "modules/desktop_capture/win/full_screen_win_application_handler.h"

#include <algorithm>
+#include <cwctype>
#include <memory>
#include <string>
#include <vector>
diff --git a/src/modules/desktop_capture/win/full_screen_win_application_handler.cc b/src/modules/desktop_capture/win/full_screen_win_application_handler.cc
index f7047dba06..4222dfc01e 100644
--- a/src/modules/desktop_capture/win/full_screen_win_application_handler.cc
+++ b/src/modules/desktop_capture/win/full_screen_win_application_handler.cc
@@ -11,6 +11,7 @@
#include "modules/desktop_capture/win/full_screen_win_application_handler.h"

#include <algorithm>
+#include <cwctype>
#include <memory>
#include <string>
#include <vector>

0 comments on commit 1882ac4

Please sign in to comment.