Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Libwebrtc upgrade to m132 #53

Merged
merged 3 commits into from
Dec 21, 2024
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/workflows/peerconnection-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ jobs:

- name: Replace Peer Connection Test Results in README
run: |
# Read the new content from DPeerConnection_test_results.md
# Read the new content from PeerConnection_test_results.md
new_content="$(<PeerConnection_test_results.md)"

# Use awk to replace content between the markers
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Additional libraries/applications that currently have a Server implementation ar
- [gstreamer](https://gstreamer.freedesktop.org/) `master` branch, commit ID `637b0d8dc25b660d3b05370e60a95249a5228a39` 20 Aug 2021 (gst-build commit ID `ebcca1e5ead27cab1eafc028332b1984c84b10b2` 26 Mar 2021).
- [janus](https://janus.conf.meetecho.com/) version `0.10.7`, commit ID `04229be3eeceb28dbc57a70a57928aab223895a5`.
- [kurento](https://www.kurento.org/) version `6.16.1~1.g907a859`.
- [libwebrtc](https://webrtc.googlesource.com/src/) `m90` branch, commit ID `a4da76a880d31f012038ac721ac4abc7ea3ffa2d`, commit date `Fri Apr 9 21:03:39 2021 -0700`.
- [libwebrtc](https://webrtc.googlesource.com/src/) `m132` branch, commit ID `f632fe9be9ce5cef5fcbfd42995271cb3fbb077d`, commit date `Tue Dec 10 09:27:33 2024 +0100`.

## Interoperability Tests

Expand Down
17 changes: 12 additions & 5 deletions libwebrtc/CMakeLists.txt
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,16 +1,23 @@
cmake_minimum_required(VERSION 3.5)

set(CMAKE_C_COMPILER clang)
set(CMAKE_CXX_COMPILER clang++)
set(CMAKE_LINKER ld.lld)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

project(libwebrtc-webrtc-echo VERSION 1.0)

add_executable(libwebrtc-webrtc-echo libwebrtc-webrtc-echo.cpp)
target_sources(libwebrtc-webrtc-echo PRIVATE
HttpSimpleServer.cpp
target_sources(libwebrtc-webrtc-echo PRIVATE
fake_audio_capture_module.cc
HttpSimpleServer.cpp
PcFactory.cpp
PcObserver.cpp)

add_definitions(-D_LIBCPP_ABI_UNSTABLE -D_LIBCPP_HAS_NO_VENDOR_AVAILABILITY_ANNOTATIONS -D_LIBCPP_DEBUG=0 -DWEBRTC_LINUX -DWEBRTC_POSIX)
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)

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

target_include_directories(libwebrtc-webrtc-echo PRIVATE
/src/webrtc-checkout/src
Expand All @@ -24,7 +31,7 @@ link_directories(
target_link_libraries(libwebrtc-webrtc-echo
-L/src/webrtc-checkout/src/out/Default
event # Important that "event" precedes "webrtc-full" as the webrtc library contains duplicate, but older, symbols.
webrtc-full
webrtc-full # This will link to libwebrtc-full.a
dl
pthread
X11
Expand Down
12 changes: 8 additions & 4 deletions libwebrtc/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,16 +1,20 @@
FROM libwebrtc-builder:m130 as builder
FROM libwebrtc-builder:m132 as builder
FROM ubuntu:latest as appbuilder

# Install packages with the required runtime libraries.
RUN apt update && DEBIAN_FRONTEND="noninteractive" apt install -y \
build-essential cmake libglib2.0-dev libx11-dev libevent-dev
build-essential cmake libglib2.0-dev libx11-dev libevent-dev clang-18 lld-18

RUN update-alternatives --install /usr/bin/clang clang /usr/bin/clang-18 100
RUN update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-18 100
RUN update-alternatives --install /usr/bin/ld ld /usr/bin/ld.lld-18 100

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

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

FROM ubuntu:latest as final

Expand Down
23 changes: 15 additions & 8 deletions libwebrtc/Dockerfile-Builder
Original file line number Diff line number Diff line change
@@ -1,23 +1,30 @@
FROM ubuntu:16.04
FROM ubuntu:20.04

# Install packages for libwebrtc build and app dependencies.
RUN apt update && DEBIAN_FRONTEND="noninteractive" apt install -y curl git \
lsb-release python sudo wget

ENV DEBIAN_FRONTEND=noninteractive
RUN echo "tzdata tzdata/Areas select Europe" | debconf-set-selections && \
echo "tzdata tzdata/Zones/Europe select Dublin" | debconf-set-selections
RUN apt update && apt install -y tzdata
RUN echo "keyboard-configuration keyboard-configuration/layoutcode string us" | debconf-set-selections && \
echo "keyboard-configuration keyboard-configuration/modelcode string pc105" | debconf-set-selections
RUN apt update && apt install -y keyboard-configuration
RUN apt update && apt install -y curl git lsb-release python3 python-is-python3 sudo wget xz-utils file

# Install depot_tools
WORKDIR /src

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

# https://webrtc.googlesource.com/src/+/refs/heads/master/docs/native-code/development/index.md#building
# See the README.md file in the same directory as this docker build file for more explanations and links.
WORKDIR /src/webrtc-checkout
RUN fetch --nohooks webrtc
WORKDIR /src/webrtc-checkout/src
RUN git fetch --all
RUN git checkout remotes/branch-heads/6834 -b m132 # 6834 == m132, see https://chromiumdash.appspot.com/branches.
RUN gclient sync
RUN git pull origin master
RUN build/install-build-deps.sh
RUN gn gen out/Default --args="is_component_build=false use_custom_libcxx=false use_custom_libcxx_for_host=false rtc_enable_protobuf=false"
RUN ninja all -C out/Default
RUN gn gen out/Default --args='is_debug=false rtc_include_tests=false treat_warnings_as_errors=false use_custom_libcxx=false'
RUN autoninja -C out/Default
RUN ar crs out/Default/libwebrtc-full.a $(find out/Default/obj -name *\.o)
11 changes: 5 additions & 6 deletions libwebrtc/HttpSimpleServer.cpp
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
*
* History:
* 08 Mar 2021 Aaron Clauson Created, Dublin, Ireland.
* 21 Dec 2024 Aaron Clauson Updated for libwebrtc version m132.
*
* License: Public Domain (no warranty, use at own risk)
/******************************************************************************/
Expand All @@ -23,8 +24,6 @@ HttpSimpleServer::HttpSimpleServer() :
{
#ifdef _WIN32
evthread_use_windows_threads();
#else
//evthread_use_pthreads();
#endif

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

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

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

std::string offerJson(http_req_buffer, http_req_body_len);
std::cout << offerJson << std::endl;
//std::cout << offerJson << std::endl;

if (_pcFactory != nullptr) {
std::string answer = _pcFactory->CreatePeerConnection(http_req_buffer, http_req_body_len);
std::string answer = _pcFactory->CreatePeerConnection(http_req_buffer, http_req_body_len);
std::cout << "Answer: " << answer << std::endl;
evhttp_add_header(req->output_headers, "Content-type", "application/json");
evbuffer_add_printf(resp_buffer, answer.c_str());
evbuffer_add_printf(resp_buffer, "%s", answer.c_str());
evhttp_send_reply(req, 200, "OK", resp_buffer);
}
else {
Expand Down
2 changes: 1 addition & 1 deletion libwebrtc/HttpSimpleServer.h
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
*
* History:
* 08 Mar 2021 Aaron Clauson Created, Dublin, Ireland.
* 21 Dec 2024 Aaron Clauson Updated for libwebrtc version m132.
*
* License: Public Domain (no warranty, use at own risk)
/******************************************************************************/
Expand Down Expand Up @@ -47,7 +48,6 @@ class HttpSimpleServer
event_base* _evtBase;
evhttp* _httpSvr;
event* _signalEvent;
std::thread _httpSvrThread;
bool _isDisposed;

static PcFactory* _pcFactory;
Expand Down
Loading
Loading