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: 0 additions & 2 deletions .gitattributes

This file was deleted.

99 changes: 92 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ Ubuntu 18.04 is the only officially supported distro at this moment. For other d

## Compilation

### Option 1: Docker (recommended)

To compile AlphaRTC, please refer to the following steps

1. Prerequisites
Expand Down Expand Up @@ -74,6 +76,45 @@ To compile AlphaRTC, please refer to the following steps

You should then be able to see two Docker images, `alphartc` and `alphartc-compile` using `sudo docker images`

### Option 2: Compile from Scratch
If you don't want to use Docker, or have other reasons to compile from scratch (e.g., you want a native Windows build), you may use this method.

Note: all commands below work for both Linux (sh) and Windows (pwsh), unless otherwise specified

1. Grab essential tools

You may follow the guide [here](https://commondatastorage.googleapis.com/chrome-infra-docs/flat/depot_tools/docs/html/depot_tools_tutorial.html#_setting_up) to obtain a copy of `depot_tools`

2. Clone the repo

```shell
git clone https://github.com/OpenNetLab/AlphaRTC.git
```

3. Sync the dependencies
```shell
cd AlphaRTC
gclient sync
mv src/* .
```

4. Generate build rules

_Windows users_: Please use __x64 Native Tools Command Prompt for VS2017__. The clang version comes with the project is 9.0.0, hence incompatible with VS2019. In addition, environmental variable `DEPOT_TOOLS_WIN_TOOLSCHAIN` has to be set to `0` and `GYP_MSVS_VERSION` has to be set to `2017`.

```shell
gn gen out/Default
```

5. Comile
```shell
ninja -C out/Default peerconnection_serverless
```
For Windows users, we also provide a GUI version. You may compile it via
```shell
ninja -C out/Default peerconnection_serverless_win_gui
```

## Demo

AlphaRTC consists of many different components. `peerconnection_serverless` is an application for demo purposes that comes with AlphaRTC. It establishes RTC communication with another peer without the need of a server.
Expand Down Expand Up @@ -144,13 +185,57 @@ This section describes required fields for the json configuration file.
- **file_path**: The file path of the output video file in YUV format

#### Run peerconnection_serverless

To better demonstrate the usage of peerconnection_serverless, we provide an all-inclusive corpus in `examples/peerconnection/serverless/corpus`. You can use the following commands to execute a tiny example. After these commands terminates, you will get `outvideo.yuv` and `outaudio.wav`.

``` shell
sudo docker run -d --rm -v `pwd`/examples/peerconnection/serverless/corpus:/app -w /app --name alphartc alphartc peerconnection_serverless receiver.json
sudo docker exec alphartc peerconnection_serverless sender.json
```
- Dockerized environment

To better demonstrate the usage of peerconnection_serverless, we provide an all-inclusive corpus in `examples/peerconnection/serverless/corpus`. You can use the following commands to execute a tiny example. After these commands terminates, you will get `outvideo.yuv` and `outaudio.wav`.

``` shell
sudo docker run -d --rm -v `pwd`/examples/peerconnection/serverless/corpus:/app -w /app --name alphartc alphartc peerconnection_serverless receiver.json
sudo docker exec alphartc peerconnection_serverless sender.json
```

- Bare metal

If you compiled your own binary, you can also run it on your bare-metal machine.

- Linux users:
1. Copy the provided corpus to a new directory

```shell
cp -r examples/peerconnection/serverless/corpus/* /path/to/your/runtime
```
2. Copy the essential dynanmic libraries and add them to searching directory

```shell
cp modules/third_party/onnxinfer/lib/*.so /path/to/your/dll
export LD_LIBRARY_PATH=/path/to/your/dll:$LD_LIBRARY_PATH
```
3. Start the receiver and the sender

```shell
cd /path/to/your/runtime
/path/to/alphartc/out/Default/peerconnection ./receiver.json
/path/to/alphartc/out/Default/peerconnection ./sender.json
```
- Windows users:
1. Copy the provided corpus to a new directory

```shell
cp -Recursive examples/peerconnection/serverless/corpus/* /path/to/your/runtime
```
2. Copy the essential dynanmic libraries and add them to searching directory

```shell
cp modules/third_party/onnxinfer/bin/*.dll /path/to/your/dll
set PATH=/path/to/your/dll;%PATH%
```
3. Start the receiver and the sender

```shell
cd /path/to/your/runtime
/path/to/alphartc/out/Default/peerconnection ./receiver.json
/path/to/alphartc/out/Default/peerconnection ./sender.json
```

## Who Are We

Expand Down
1 change: 0 additions & 1 deletion azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ pool:

steps:
- checkout: self
lfs: true

- script: make init
displayName: 'build compile environment'
Expand Down
72 changes: 59 additions & 13 deletions examples/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -714,6 +714,7 @@ if (is_linux || is_win) {
rtc_executable("peerconnection_serverless") {
testonly = true
sources = [
"peerconnection/serverless/main.cc",
"peerconnection/serverless/conductor.cc",
"peerconnection/serverless/conductor.h",
"peerconnection/serverless/defaults.cc",
Expand Down Expand Up @@ -764,22 +765,67 @@ if (is_linux || is_win) {
"../test:video_test_support",
"//third_party/libyuv",
]
}

if (is_win) {
sources += [
"peerconnection/serverless/main.cc",
"peerconnection/serverless/main_wnd.cc",
"peerconnection/serverless/main_wnd.h",
]
configs += [ "//build/config/win:windowed" ]
}
if (is_win) {
rtc_executable("peerconnection_serverless_win_gui") {
testonly = true
sources = [
"peerconnection/serverless/win/main.cc",
"peerconnection/serverless/win/main_wnd.cc",
"peerconnection/serverless/conductor.cc",
"peerconnection/serverless/conductor.h",
"peerconnection/serverless/defaults.cc",
"peerconnection/serverless/defaults.h",
"peerconnection/serverless/peer_connection_client.cc",
"peerconnection/serverless/peer_connection_client.h",
]

if (is_linux) {
sources += [
"peerconnection/serverless/linux/main.cc"
]
}
deps = [
"../api:audio_options_api",
"../api:create_peerconnection_factory",
"../api:libjingle_peerconnection_api",
"../api:scoped_refptr",
"../api/audio:audio_mixer_api",
"../api/audio_codecs:audio_codecs_api",
"../api/video:video_frame_i420",
"../api/video:video_rtp_headers",
"../api/video_codecs:video_codecs_api",
"../media:rtc_media_base",
"../p2p:rtc_p2p",
"../rtc_base:checks",
"../rtc_base/third_party/sigslot",
"../system_wrappers:field_trial",
"../test:field_trial",
"../test:platform_video_capturer",
"../test:test_support",
"//third_party/abseil-cpp/absl/memory",
"//third_party/abseil-cpp/absl/types:optional",
"../api:libjingle_peerconnection_api",
"../api/audio_codecs:builtin_audio_decoder_factory",
"../api/audio_codecs:builtin_audio_encoder_factory",
"../api/video:video_frame",
"../api/video:video_rtp_headers",
"../api/video_codecs:builtin_video_decoder_factory",
"../api/video_codecs:builtin_video_encoder_factory",
"../media:rtc_audio_video",
"../modules/audio_device",
"../modules/audio_processing",
"../modules/audio_processing:api",
"../modules/video_capture:video_capture_module",
"../pc:libjingle_peerconnection",
"../pc:peerconnection",
"../rtc_base",
"../rtc_base:rtc_base_approved",
"../rtc_base:rtc_json",
"../test:video_test_common",
"../test:test_support",
"../test:video_test_support",
"//third_party/libyuv",
]

configs += [ "//build/config/win:windowed" ]
}
}

rtc_executable("peerconnection_server") {
Expand Down
3 changes: 0 additions & 3 deletions examples/peerconnection/serverless/corpus/.gitattributes

This file was deleted.

2 changes: 0 additions & 2 deletions examples/peerconnection/serverless/corpus/.gitignore

This file was deleted.

Binary file modified examples/peerconnection/serverless/corpus/onnx-model.onnx
Binary file not shown.
Binary file modified examples/peerconnection/serverless/corpus/testmedia/test.wav
Binary file not shown.
4 changes: 1 addition & 3 deletions examples/peerconnection/serverless/corpus/testmedia/test.yuv

Large diffs are not rendered by default.

157 changes: 0 additions & 157 deletions examples/peerconnection/serverless/linux/main.cc

This file was deleted.

Loading