Skip to content

Commit

Permalink
Fixed macOS Intel build and other release prep
Browse files Browse the repository at this point in the history
- Removed Android because the audio latency was too high, sorry :(
- Adapted Android dist script for macOS
- Quick pass over README, configs still need updating
- Added release workflow to build and upload all the things
- Sender and receiver can now be run together without port conflicts
- Fixed vulns in the JS code
  • Loading branch information
sfjohnson committed Aug 26, 2024
1 parent 1666fa6 commit 478f8d0
Show file tree
Hide file tree
Showing 17 changed files with 757 additions and 505 deletions.
47 changes: 0 additions & 47 deletions .github/workflows/build-check.yml

This file was deleted.

142 changes: 142 additions & 0 deletions .github/workflows/build-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@
name: Build Release

on:
push:
tags:
- 'v*'

jobs:
build-macos:
runs-on: macos-12
steps:
- name: Checkout
uses: actions/checkout@v4
with:
persist-credentials: false

- name: Setup dependencies
run: |
brew install openssl@3
brew install llvm@15
- name: Make dist
run: ./make-macos-dist.sh

- name: Upload build output
uses: actions/upload-artifact@v4
with:
name: build-output-macos12
path: |
waterslide-macos-x64-dist.tar.bz2
LICENSE
build-macos-arm64:
runs-on: macos-14
steps:
- name: Checkout
uses: actions/checkout@v4
with:
persist-credentials: false

- name: Setup dependencies
run: |
brew install openssl@3
brew install llvm@15
- name: Make dist
run: ./make-macos-dist.sh

- name: Upload build output
uses: actions/upload-artifact@v4
with:
name: build-output-macos-arm64
path: waterslide-macos-arm64-dist.tar.bz2

build-rpi:
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v4
with:
persist-credentials: false

- name: Get RPi toolchain
run: |
wget https://github.com/sfjohnson/rpi-toolchain/releases/download/v0.1.8/aarch64-rpi4-linux-gnu.tar.xz
tar xf aarch64-rpi4-linux-gnu.tar.xz -C ~
- name: Setup dependencies
run: ./pull-deps.sh

- name: Make RPi
run: make -f rpi-arm64.mk
env:
TOOLCHAIN: /home/runner/aarch64-rpi4-linux-gnu

- name: Upload build output
uses: actions/upload-artifact@v4
with:
name: build-output-rpi
path: bin/waterslide-rpi-arm64

build-discovery-server:
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v4
with:
persist-credentials: false

- name: Build
run: ./build-linux.sh
working-directory: ./discovery-server

- name: Create release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ github.event.inputs.version }}
files: ./discovery-server/waterslide-ds-linux
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Upload build output
uses: actions/upload-artifact@v4
with:
name: build-output-ds
path: ./discovery-server/waterslide-ds-linux

create-release:
runs-on: ubuntu-22.04
needs: [build-macos, build-macos-arm64, build-rpi, build-discovery-server]
steps:
- name: Get build output macos12
uses: actions/download-artifact@v4
with:
name: build-output-macos12

- name: Get build output macos-arm64
uses: actions/download-artifact@v4
with:
name: build-output-macos-arm64

- name: Get build output RPi
uses: actions/download-artifact@v4
with:
name: build-output-rpi

- name: Get build output Discovery Server
uses: actions/download-artifact@v4
with:
name: build-output-ds

- name: Create release
uses: softprops/action-gh-release@v2
with:
files: |
waterslide-macos-x64-dist.tar.bz2
waterslide-macos-arm64-dist.tar.bz2
waterslide-rpi-arm64
waterslide-ds-linux
LICENSE
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
32 changes: 0 additions & 32 deletions .github/workflows/release-discovery.yml

This file was deleted.

79 changes: 31 additions & 48 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Real-time network protocol with forward error correction and multihoming (blendi
- [x] Resampling to correct for clock drift between sender and receiver
- [x] Encryption
- [x] Network discovery
- [ ] Video or other data besides audio
- [ ] IPv6

## Anti-features

Expand All @@ -30,14 +30,13 @@ Real-time network protocol with forward error correction and multihoming (blendi
## Platforms

- macOS x64
- Android
- macOS ARM
- Raspberry Pi
- Linux x86_64

## Setup (common)

1. Install Node.js >= 18 and npm >= 9
1. Install Node.js 20.x.x and npm 10.x.x

2. Run
```sh
Expand All @@ -48,54 +47,52 @@ cd waterslide

## Setup (macOS specific)

Supported platforms: macOS >= 11, Intel or Apple silicon
Supported platforms: macOS >= 12

1. Install Homebrew
2. Run
```sh
brew install openssl@3
brew install llvm@16
brew install llvm@15
```

## Setup (Android specific)
## Build macOS (binary only)

Native compile for either Intel or Apple silicon

1. Install Android NDK
2. Set the `ANDROID_NDK_HOME` env var, e.g.
```sh
export ANDROID_NDK_HOME=/Users/<username>/Library/Android/sdk/ndk/21.4.7075529
make -f macos.mk
```

## Build macOS
## Build Raspberry Pi 64-bit (binary only)

Cross compile, runs only on Linux x86_64

```sh
make -f macos.mk
make -f rpi-arm64.mk
```

## Build Android (binary only)
## Build Linux x86_64 (binary only)

API 30 (Android 11)
Native compile

```sh
make -f android30.mk
make -f linux-x64.mk
```

## Build Android (distributable tar)
## Build macOS (distributable tar)

1.
```sh
./make-android-dist.sh
./make-macos-dist.sh
```
2. Copy `waterslide-android-dist.tar.bz2` to the Android device.
3. Extract it to a folder the user can execute from e.g.
2. Copy `waterslide-macos-arm64-dist.tar.bz2` or `waterslide-macos-x64-dist.tar.bz2` to the target and extract.
3. Run frontend script:
```sh
cd /data/local/tmp
tar xf waterslide-android-dist.tar.bz2
```
4. Run frontend script (must be root):
```sh
cd waterslide-android-dist
cd waterslide-macos-<ARCH>-dist
./waterslide OPTION CONFIG
```
4. Open `http://localhost:<UI_PORT>` in a browser. `UI_PORT` is in the log: `Serving monitor on port <UI_PORT>`.

## Frontend

Expand Down Expand Up @@ -135,21 +132,16 @@ Options:

## Discovery server

For use over the internet, make sure inbound UDP port 26172 is open. This port can be changed by changing `SERVER_BIND_PORT` in `discovery-server/main.c`.

### Build and run
```sh
cd discovery-server
./build.sh
./waterslide-discovery-server
```
For use over the internet, make sure inbound UDP port 26172 is open. This port can be changed by changing `SERVER_BIND_PORT` in `discovery-server/main.c`. The environment variable `PEER_EXPIRY_TIME` (in microseconds) can be set to change the interval between a peer contacting the server and that peer being removed from the server's discovery list.

## Example configs

Audio and video config for both sender and receiver are contained only in sender config. Once receiver gets its audio and video config from channel 0, it can then start decoding other channels to receive audio and video data. Initial receiver config is minimal: networking, and FEC layout for channel 0 (config channel).

See `protobufs/init-config.proto` and `include/globals.h` for more information.

TODO: update and document configs

### Sender (PCM, Mi A3 internal mic to macOS)

```json
Expand Down Expand Up @@ -261,13 +253,8 @@ See `protobufs/init-config.proto` and `include/globals.h` for more information.
}
],
"monitor": {
"uiPort": 8080,
"sender": {
"wsPort": 7681
},
"receiver": {
"wsPort": 7682
}
"uiPort": 8081,
"wsPort": 7681
}
}
```
Expand Down Expand Up @@ -382,13 +369,8 @@ Note: adjusting volume requires additional ALSA mixer control(s) which are diffe
}
],
"monitor": {
"uiPort": 8080,
"sender": {
"wsPort": 7681
},
"receiver": {
"wsPort": 7682
}
"uiPort": 8081,
"wsPort": 7681
}
}
```
Expand Down Expand Up @@ -421,7 +403,8 @@ Note: adjusting volume requires additional ALSA mixer control(s) which are diffe
}
],
"monitor": {
"uiPort": 8080
"uiPort": 8082,
"wsPort": 7682
}
}
```
Expand All @@ -430,7 +413,7 @@ Note: adjusting volume requires additional ALSA mixer control(s) which are diffe

The C/C++/Rust code runs a WebSocket server that provides live data. An interface called the monitor connects to this server and provides audio meters, timing graphs, and detailed information on the status and health of the stream.

Note: the monitor interface is due for a redesign once video is implemented.
Note: monitor redesign coming soon!

<img alt="monitor screenshot" src="monitor-screenshot.png" width="600" />

Expand Down
Loading

0 comments on commit 478f8d0

Please sign in to comment.