Skip to content

Commit 00ee822

Browse files
authored
Libwebrtc upgrade to m132 (#53)
* Build working. * Echo peer connection test working on Windows. * Added x unicode char to collate results script.
1 parent 997a64f commit 00ee822

22 files changed

+706
-292
lines changed

.github/workflows/peerconnection-test.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ jobs:
151151
152152
- name: Replace Peer Connection Test Results in README
153153
run: |
154-
# Read the new content from DPeerConnection_test_results.md
154+
# Read the new content from PeerConnection_test_results.md
155155
new_content="$(<PeerConnection_test_results.md)"
156156
157157
# Use awk to replace content between the markers

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ Additional libraries/applications that currently have a Server implementation ar
2424
- [gstreamer](https://gstreamer.freedesktop.org/) `master` branch, commit ID `637b0d8dc25b660d3b05370e60a95249a5228a39` 20 Aug 2021 (gst-build commit ID `ebcca1e5ead27cab1eafc028332b1984c84b10b2` 26 Mar 2021).
2525
- [janus](https://janus.conf.meetecho.com/) version `0.10.7`, commit ID `04229be3eeceb28dbc57a70a57928aab223895a5`.
2626
- [kurento](https://www.kurento.org/) version `6.16.1~1.g907a859`.
27-
- [libwebrtc](https://webrtc.googlesource.com/src/) `m90` branch, commit ID `a4da76a880d31f012038ac721ac4abc7ea3ffa2d`, commit date `Fri Apr 9 21:03:39 2021 -0700`.
27+
- [libwebrtc](https://webrtc.googlesource.com/src/) `m132` branch, commit ID `f632fe9be9ce5cef5fcbfd42995271cb3fbb077d`, commit date `Tue Dec 10 09:27:33 2024 +0100`.
2828

2929
## Interoperability Tests
3030

libwebrtc/CMakeLists.txt

100644100755
+12-5
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,23 @@
11
cmake_minimum_required(VERSION 3.5)
2+
3+
set(CMAKE_C_COMPILER clang)
4+
set(CMAKE_CXX_COMPILER clang++)
5+
set(CMAKE_LINKER ld.lld)
6+
set(CMAKE_CXX_STANDARD 20)
7+
set(CMAKE_CXX_STANDARD_REQUIRED ON)
8+
29
project(libwebrtc-webrtc-echo VERSION 1.0)
310

411
add_executable(libwebrtc-webrtc-echo libwebrtc-webrtc-echo.cpp)
5-
target_sources(libwebrtc-webrtc-echo PRIVATE
6-
HttpSimpleServer.cpp
12+
target_sources(libwebrtc-webrtc-echo PRIVATE
713
fake_audio_capture_module.cc
14+
HttpSimpleServer.cpp
815
PcFactory.cpp
916
PcObserver.cpp)
1017

11-
add_definitions(-D_LIBCPP_ABI_UNSTABLE -D_LIBCPP_HAS_NO_VENDOR_AVAILABILITY_ANNOTATIONS -D_LIBCPP_DEBUG=0 -DWEBRTC_LINUX -DWEBRTC_POSIX)
18+
add_definitions(-D_LIBCPP_ABI_UNSTABLE -D_LIBCPP_HAS_NO_VENDOR_AVAILABILITY_ANNOTATIONS -D_LIBCPP_DEBUG=0 -DWEBRTC_LINUX -DWEBRTC_POSIX -DUSE_AURA=1 -D_HAS_EXCEPTIONS=0 -D_SILENCE_ALL_CXX20_DEPRECATION_WARNINGS)
1219

13-
SET(CMAKE_CXX_FLAGS "-fstack-protector -funwind-tables -fPIC -O0 -g2 -std=c++14")
20+
SET(CMAKE_CXX_FLAGS "-fstack-protector -funwind-tables -fPIC -O0 -g2 -std=c++20")
1421

1522
target_include_directories(libwebrtc-webrtc-echo PRIVATE
1623
/src/webrtc-checkout/src
@@ -24,7 +31,7 @@ link_directories(
2431
target_link_libraries(libwebrtc-webrtc-echo
2532
-L/src/webrtc-checkout/src/out/Default
2633
event # Important that "event" precedes "webrtc-full" as the webrtc library contains duplicate, but older, symbols.
27-
webrtc-full
34+
webrtc-full # This will link to libwebrtc-full.a
2835
dl
2936
pthread
3037
X11

libwebrtc/Dockerfile

+8-4
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,20 @@
1-
FROM libwebrtc-builder:m130 as builder
1+
FROM libwebrtc-builder:m132 as builder
22
FROM ubuntu:latest as appbuilder
33

44
# Install packages with the required runtime libraries.
55
RUN apt update && DEBIAN_FRONTEND="noninteractive" apt install -y \
6-
build-essential cmake libglib2.0-dev libx11-dev libevent-dev
6+
build-essential cmake libglib2.0-dev libx11-dev libevent-dev clang-18 lld-18
7+
8+
RUN update-alternatives --install /usr/bin/clang clang /usr/bin/clang-18 100
9+
RUN update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-18 100
10+
RUN update-alternatives --install /usr/bin/ld ld /usr/bin/ld.lld-18 100
711

812
COPY --from=builder /src/webrtc-checkout/src /src/webrtc-checkout/src
913

1014
WORKDIR /src/libwebrtc-webrtc-echo
11-
COPY ["CMakeLists.txt", "fake_audio_capture_module.cc", "HttpSimpleServer.*", "json.hpp", "libwebrtc-webrtc-echo.cpp", "PcFactory.*", "PcObserver.*", "./"]
15+
COPY ["CMakeLists.txt", "fake_audio_capture_module.*", "HttpSimpleServer.*", "json.hpp", "libwebrtc-webrtc-echo.cpp", "PcFactory.*", "PcObserver.*", "./"]
1216
WORKDIR /src/libwebrtc-webrtc-echo/build
13-
RUN cmake .. && make && cp libwebrtc-webrtc-echo /
17+
RUN cmake .. && make VERBOSE=1 && cp libwebrtc-webrtc-echo /
1418

1519
FROM ubuntu:latest as final
1620

libwebrtc/Dockerfile-Builder

+15-8
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,30 @@
1-
FROM ubuntu:16.04
1+
FROM ubuntu:20.04
22

33
# Install packages for libwebrtc build and app dependencies.
4-
RUN apt update && DEBIAN_FRONTEND="noninteractive" apt install -y curl git \
5-
lsb-release python sudo wget
6-
4+
ENV DEBIAN_FRONTEND=noninteractive
5+
RUN echo "tzdata tzdata/Areas select Europe" | debconf-set-selections && \
6+
echo "tzdata tzdata/Zones/Europe select Dublin" | debconf-set-selections
7+
RUN apt update && apt install -y tzdata
8+
RUN echo "keyboard-configuration keyboard-configuration/layoutcode string us" | debconf-set-selections && \
9+
echo "keyboard-configuration keyboard-configuration/modelcode string pc105" | debconf-set-selections
10+
RUN apt update && apt install -y keyboard-configuration
11+
RUN apt update && apt install -y curl git lsb-release python3 python-is-python3 sudo wget xz-utils file
12+
713
# Install depot_tools
814
WORKDIR /src
915

1016
# https://webrtc.googlesource.com/src/+/refs/heads/master/docs/native-code/development/prerequisite-sw/index.md
1117
RUN git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git --depth 1 depot_tools
1218
ENV PATH="/src/depot_tools:${PATH}"
1319

14-
# https://webrtc.googlesource.com/src/+/refs/heads/master/docs/native-code/development/index.md#building
20+
# See the README.md file in the same directory as this docker build file for more explanations and links.
1521
WORKDIR /src/webrtc-checkout
1622
RUN fetch --nohooks webrtc
1723
WORKDIR /src/webrtc-checkout/src
24+
RUN git fetch --all
25+
RUN git checkout remotes/branch-heads/6834 -b m132 # 6834 == m132, see https://chromiumdash.appspot.com/branches.
1826
RUN gclient sync
19-
RUN git pull origin master
2027
RUN build/install-build-deps.sh
21-
RUN gn gen out/Default --args="is_component_build=false use_custom_libcxx=false use_custom_libcxx_for_host=false rtc_enable_protobuf=false"
22-
RUN ninja all -C out/Default
28+
RUN gn gen out/Default --args='is_debug=false rtc_include_tests=false treat_warnings_as_errors=false use_custom_libcxx=false'
29+
RUN autoninja -C out/Default
2330
RUN ar crs out/Default/libwebrtc-full.a $(find out/Default/obj -name *\.o)

libwebrtc/HttpSimpleServer.cpp

100644100755
+5-6
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
*
99
* History:
1010
* 08 Mar 2021 Aaron Clauson Created, Dublin, Ireland.
11+
* 21 Dec 2024 Aaron Clauson Updated for libwebrtc version m132.
1112
*
1213
* License: Public Domain (no warranty, use at own risk)
1314
/******************************************************************************/
@@ -23,8 +24,6 @@ HttpSimpleServer::HttpSimpleServer() :
2324
{
2425
#ifdef _WIN32
2526
evthread_use_windows_threads();
26-
#else
27-
//evthread_use_pthreads();
2827
#endif
2928

3029
/* Initialise libevent HTTP server. */
@@ -107,7 +106,6 @@ void HttpSimpleServer::OnHttpRequest(struct evhttp_request* req, void* arg)
107106
size_t http_req_body_len{ 0 };
108107
char* http_req_buffer = nullptr;
109108
struct evbuffer* resp_buffer;
110-
int resp_lock = 0;
111109

112110
printf("Received HTTP request for %s.\n", uri);
113111

@@ -137,12 +135,13 @@ void HttpSimpleServer::OnHttpRequest(struct evhttp_request* req, void* arg)
137135
printf("HTTP request body length %zu.\n", http_req_body_len);
138136

139137
std::string offerJson(http_req_buffer, http_req_body_len);
140-
std::cout << offerJson << std::endl;
138+
//std::cout << offerJson << std::endl;
141139

142140
if (_pcFactory != nullptr) {
143-
std::string answer = _pcFactory->CreatePeerConnection(http_req_buffer, http_req_body_len);
141+
std::string answer = _pcFactory->CreatePeerConnection(http_req_buffer, http_req_body_len);
142+
std::cout << "Answer: " << answer << std::endl;
144143
evhttp_add_header(req->output_headers, "Content-type", "application/json");
145-
evbuffer_add_printf(resp_buffer, answer.c_str());
144+
evbuffer_add_printf(resp_buffer, "%s", answer.c_str());
146145
evhttp_send_reply(req, 200, "OK", resp_buffer);
147146
}
148147
else {

libwebrtc/HttpSimpleServer.h

100644100755
+1-1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
*
1111
* History:
1212
* 08 Mar 2021 Aaron Clauson Created, Dublin, Ireland.
13+
* 21 Dec 2024 Aaron Clauson Updated for libwebrtc version m132.
1314
*
1415
* License: Public Domain (no warranty, use at own risk)
1516
/******************************************************************************/
@@ -47,7 +48,6 @@ class HttpSimpleServer
4748
event_base* _evtBase;
4849
evhttp* _httpSvr;
4950
event* _signalEvent;
50-
std::thread _httpSvrThread;
5151
bool _isDisposed;
5252

5353
static PcFactory* _pcFactory;

0 commit comments

Comments
 (0)