add NACK, RTX, DTLS active support #224
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: "Test" | |
on: | |
push: | |
pull_request: | |
permissions: read-all | |
# Results for commonly used commands: | |
# $HOME is /home/runner | |
# $(pwd) is /home/runner/work/ffmpeg-webrtc/ffmpeg-webrtc | |
# $(nproc) is 4 | |
# $(whoami) is runner | |
# $(id -gn) is docker | |
# $(which docker) is /usr/bin/docker | |
# $(ifconfig eth0 | grep 'inet ' | awk '{print $2}') is private IP4 address like 10.1.0.76 | |
jobs: | |
build: | |
name: "Build FFmpeg" | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Build FFmpeg | |
run: | | |
set -euxo pipefail | |
# Install dependencies | |
sudo apt-get update | |
sudo apt-get install -y nasm pkg-config libssl-dev | |
# Build FFmpeg with WebRTC support | |
./configure --enable-muxer=whip --enable-openssl --enable-version3 | |
make -j$(nproc) | |
./ffmpeg -version && ./ffmpeg -muxers 2>/dev/null |grep whip | |
runs-on: ubuntu-22.04 | |
fate: | |
name: "FFmpeg Fate Test" | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
# The cache for FFmpeg FATE samples can help decrease the resync time when executing | |
# "make fate-resync." The cache is stored in the Docker image "ossrs/srs:ffmpeg-fate," | |
# which can be refreshed by manually executing the below workflow. | |
# https://github.com/ossrs/ffmpeg-webrtc/actions/workflows/fate-cache.yml | |
- name: Download Fate Cache Samples | |
run: | | |
set -euxo pipefail | |
docker run --rm -v $(pwd):/target ossrs/srs:ffmpeg-fate \ | |
bash -c "cp /opt/ffmpeg/fate-suite.tar /target/" | |
tar xf fate-suite.tar | |
ls -ldh fate-suite | |
du -sh fate-suite | |
- name: Configure FFmpeg | |
run: | | |
set -euxo pipefail | |
# Install dependencies | |
sudo apt-get update | |
sudo apt-get install -y nasm pkg-config libssl-dev | |
# Build FFmpeg with WebRTC support | |
./configure --enable-muxer=whip --enable-openssl --enable-version3 \ | |
--extra-cflags='-fsanitize=address -g -O0' --extra-cxxflags='-fsanitize=address -g -O0' --extra-ldflags='-fsanitize=address -g -O0' | |
make -j$(nproc) | |
./ffmpeg -version && ./ffmpeg -muxers 2>/dev/null |grep whip | |
- name: FFmpeg Fate rsync | |
run: | | |
set -euxo pipefail | |
make fate-rsync SAMPLES=$(pwd)/fate-suite | |
- name: Stat Fate Suite | |
run: | | |
set -euxo pipefail | |
du -sh fate-suite | |
du -sh * | |
- name: Run FFmpeg Fate | |
run: | | |
set -euxo pipefail | |
make fate -j$(nproc) SAMPLES=$(pwd)/fate-suite | |
runs-on: ubuntu-22.04 | |
srs: | |
name: "FFmpeg with SRS" | |
needs: build | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Build FFmpeg | |
run: | | |
set -euxo pipefail | |
# Install dependencies | |
sudo apt-get update | |
sudo apt-get install -y nasm pkg-config jq libssl-dev libopus-dev libx264-dev | |
# Build FFmpeg with WebRTC support | |
./configure --enable-muxer=whip --enable-openssl --enable-version3 \ | |
--enable-libx264 --enable-gpl --enable-libopus | |
make -j$(nproc) | |
./ffmpeg -version && ./ffmpeg -muxers 2>/dev/null |grep whip | |
- name: Start SRS Docker container | |
run: | | |
set -euxo pipefail | |
ip=$(ifconfig eth0 | grep 'inet ' | awk '{print $2}') | |
docker run --rm -d -p 1935:1935 -p 1985:1985 -p 8080:8080 \ | |
--env CANDIDATE=$ip -p 8000:8000/udp \ | |
ossrs/srs:5 ./objs/srs -c conf/rtc2rtmp.conf | |
- name: Streaming with FFmpeg | |
run: | | |
set -euxo pipefail | |
nohup ./ffmpeg -t 30 -re -f lavfi -i testsrc=size=1280x720 -f lavfi -i sine=frequency=440 -pix_fmt yuv420p \ | |
-vcodec libx264 -profile:v baseline -r 25 -g 50 -acodec libopus -ar 48000 -ac 2 \ | |
-f whip "http://localhost:1985/rtc/v1/whip/?app=live&stream=livestream" \ | |
1>ffstdout.log 2>ffstderr.log & | |
- name: Check SRS Streaming | |
id: streaming | |
run: | | |
set -euxo pipefail | |
# Check streams in SRS. | |
for ((i=0; i<10; i++)); do | |
STREAM=$(curl -s http://localhost:1985/api/v1/streams/ | jq -r '.streams[].name') | |
if [[ "$STREAM" == "livestream" ]]; then | |
echo 'Test OK'; | |
echo "has_stream=true" >> $GITHUB_OUTPUT | |
break; | |
fi | |
sleep 3 | |
done | |
if [[ "$STREAM" != "livestream" ]]; then | |
echo "Stream not found: $STREAM" | |
echo "has_stream=false" >> $GITHUB_OUTPUT | |
fi | |
- name: Stop FFmpeg normally | |
run: | | |
pkill -SIGINT ffmpeg && sleep 3 || | |
echo "FFmpeg process not found or already stopped." | |
- name: Show FFmpeg Stdout Log | |
run: cat ffstdout.log | |
- name: Show FFmpeg Stderr Log | |
run: cat ffstderr.log | |
- name: Check FFmpeg Exit Log | |
run: | | |
set -euxo pipefail | |
cat ffstderr.log |grep 'Exiting normally' && exit 0 | |
echo "Exiting normally not found in ffstderr.log" && exit 1 | |
- name: Check Stream Existence | |
if: ${{ steps.streaming.outputs.has_stream == 'false' }} | |
run: exit 1 | |
runs-on: ubuntu-22.04 | |
pion: | |
name: "FFmpeg with Pion" | |
needs: build | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Build FFmpeg | |
run: | | |
set -euxo pipefail | |
# Install dependencies | |
sudo apt-get update | |
sudo apt-get install -y nasm pkg-config jq libssl-dev libopus-dev libx264-dev | |
# Build FFmpeg with WebRTC support | |
./configure --enable-muxer=whip --enable-openssl --enable-version3 \ | |
--enable-libx264 --enable-gpl --enable-libopus | |
make -j$(nproc) | |
./ffmpeg -version && ./ffmpeg -muxers 2>/dev/null |grep whip | |
- name: Set up Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: '1.22' | |
- name: Verify Go version | |
run: go version | |
- name: Start Pion | |
run: | | |
set -euxo pipefail | |
git clone https://github.com/pion/webrtc.git | |
cd webrtc/examples/whip-whep | |
go run *.go & | |
- name: Streaming with FFmpeg | |
run: | | |
set -euxo pipefail | |
nohup ./ffmpeg -t 30 -re -f lavfi -i testsrc=size=1280x720 -f lavfi -i sine=frequency=440 -pix_fmt yuv420p \ | |
-vcodec libx264 -profile:v baseline -r 25 -g 50 -acodec libopus -ar 48000 -ac 2 \ | |
-f whip -authorization "seanTest" "http://localhost:8080/whip" \ | |
1>ffstdout.log 2>ffstderr.log & | |
- name: Stop FFmpeg normally | |
run: | | |
pkill -SIGINT ffmpeg && sleep 3 || | |
echo "FFmpeg process not found or already stopped." | |
- name: Show FFmpeg Stdout Log | |
run: cat ffstdout.log | |
- name: Show FFmpeg Stderr Log | |
run: cat ffstderr.log | |
- name: Check FFmpeg Exit Log | |
run: | | |
set -euxo pipefail | |
cat ffstderr.log |grep 'Exiting normally' && exit 0 | |
echo "Exiting normally not found in ffstderr.log" && exit 1 | |
- name: Check Stream Existence | |
if: ${{ steps.streaming.outputs.has_stream == 'false' }} | |
run: exit 1 | |
runs-on: ubuntu-22.04 | |
janus: | |
name: "FFmpeg with Janus" | |
needs: build | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Build FFmpeg | |
run: | | |
set -euxo pipefail | |
# Install dependencies | |
sudo apt-get update | |
sudo apt-get install -y nasm pkg-config jq libssl-dev libopus-dev libx264-dev | |
# Build FFmpeg with WebRTC support | |
./configure --enable-muxer=whip --enable-openssl --enable-version3 \ | |
--enable-libx264 --enable-gpl --enable-libopus | |
make -j$(nproc) | |
./ffmpeg -version && ./ffmpeg -muxers 2>/dev/null |grep whip | |
- name: Start Janus | |
run: | | |
set -euxo pipefail | |
git clone https://github.com/winlinvip/janus-docker.git | |
(cd janus-docker && | |
ip=$(ifconfig eth0 | grep 'inet ' | awk '{print $2}') && | |
sed -i "s|\(^[[:blank:]]*nat_1_1_mapping *=\).*|\1\"$ip\"|g" janus.jcfg && | |
docker run --rm -d -p 8081:8080 -p 8188:8188 -p 8443:8443 -p 20000-20010:20000-20010/udp \ | |
-v $(pwd)/janus.jcfg:/usr/local/etc/janus/janus.jcfg \ | |
-v $(pwd)/janus.plugin.videoroom.jcfg:/usr/local/etc/janus/janus.plugin.videoroom.jcfg \ | |
-v $(pwd)/janus.transport.http.jcfg:/usr/local/etc/janus/janus.transport.http.jcfg \ | |
-v $(pwd)/janus.transport.websockets.jcfg:/usr/local/etc/janus/janus.transport.websockets.jcfg \ | |
-v $(pwd)/videoroomtest.js:/usr/local/share/janus/demos/videoroomtest.js \ | |
ossrs/janus:v1.0.12) | |
git clone https://github.com/meetecho/simple-whip-server.git | |
cd simple-whip-server | |
git checkout bd2d98898b9842bfc329443b46bcc906aab857aa | |
npm install | |
npm run build | |
npm run start & | |
- name: Streaming with FFmpeg | |
run: | | |
set -euxo pipefail | |
curl -H 'Content-Type: application/json' -d '{"id": "abc123", "room": 2345}' \ | |
http://localhost:7080/whip/create | |
nohup ./ffmpeg -t 30 -re -f lavfi -i testsrc=size=1280x720 -f lavfi -i sine=frequency=440 -pix_fmt yuv420p \ | |
-vcodec libx264 -profile:v baseline -r 25 -g 50 -acodec libopus -ar 48000 -ac 2 \ | |
-f whip 'http://localhost:7080/whip/endpoint/abc123' \ | |
1>ffstdout.log 2>ffstderr.log & | |
- name: Stop FFmpeg normally | |
run: | | |
pkill -SIGINT ffmpeg && sleep 3 || | |
echo "FFmpeg process not found or already stopped." | |
- name: Show FFmpeg Stdout Log | |
run: cat ffstdout.log | |
- name: Show FFmpeg Stderr Log | |
run: cat ffstderr.log | |
- name: Check FFmpeg Exit Log | |
run: | | |
set -euxo pipefail | |
cat ffstderr.log |grep 'Exiting normally' && exit 0 | |
echo "Exiting normally not found in ffstderr.log" && exit 1 | |
- name: Check Stream Existence | |
if: ${{ steps.streaming.outputs.has_stream == 'false' }} | |
run: exit 1 | |
- name: Setup tmate session | |
if: ${{ failure() }} | |
uses: mxschmitt/action-tmate@v3 | |
runs-on: ubuntu-22.04 | |
asan: | |
name: "FFmpeg with Asan" | |
needs: build | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Build FFmpeg | |
run: | | |
set -euxo pipefail | |
# Install dependencies | |
sudo apt-get update | |
sudo apt-get install -y nasm pkg-config jq libssl-dev libopus-dev libx264-dev | |
# Build FFmpeg with WebRTC support | |
./configure --enable-muxer=whip --enable-openssl --enable-version3 \ | |
--enable-libx264 --enable-gpl --enable-libopus \ | |
--extra-cflags='-fsanitize=address -g -O0' --extra-cxxflags='-fsanitize=address -g -O0' --extra-ldflags='-fsanitize=address -g -O0' | |
make -j$(nproc) | |
./ffmpeg -version && ./ffmpeg -muxers 2>/dev/null |grep whip | |
- name: Start SRS Docker container | |
run: | | |
set -euxo pipefail | |
ip=$(ifconfig eth0 | grep 'inet ' | awk '{print $2}') | |
docker run --rm -d -p 1935:1935 -p 1985:1985 -p 8080:8080 \ | |
--env CANDIDATE=$ip -p 8000:8000/udp \ | |
ossrs/srs:5 ./objs/srs -c conf/rtc2rtmp.conf | |
- name: Streaming with FFmpeg | |
run: | | |
set -euxo pipefail | |
nohup ./ffmpeg -t 30 -re -f lavfi -i testsrc=size=1280x720 -f lavfi -i sine=frequency=440 -pix_fmt yuv420p \ | |
-vcodec libx264 -profile:v baseline -r 25 -g 50 -acodec libopus -ar 48000 -ac 2 \ | |
-f whip "http://localhost:1985/rtc/v1/whip/?app=live&stream=livestream" \ | |
1>ffstdout.log 2>ffstderr.log & | |
- name: Check SRS Streaming | |
id: streaming | |
run: | | |
set -euxo pipefail | |
# Check streams in SRS. | |
for ((i=0; i<10; i++)); do | |
STREAM=$(curl -s http://localhost:1985/api/v1/streams/ | jq -r '.streams[].name') | |
if [[ "$STREAM" == "livestream" ]]; then | |
echo 'Test OK'; | |
echo "has_stream=true" >> $GITHUB_OUTPUT | |
break; | |
fi | |
sleep 3 | |
done | |
if [[ "$STREAM" != "livestream" ]]; then | |
echo "Stream not found: $STREAM" | |
echo "has_stream=false" >> $GITHUB_OUTPUT | |
fi | |
- name: Stop FFmpeg normally | |
run: | | |
# TEST: Generate a coredump. | |
#pkill -SIGSEGV ffmpeg && sleep 3 && exit 0 | |
pkill -SIGINT ffmpeg && sleep 3 || | |
echo "FFmpeg process not found or already stopped." | |
- name: Show FFmpeg Stdout Log | |
run: cat ffstdout.log | |
- name: Show FFmpeg Stderr Log | |
run: cat ffstderr.log | |
- name: Check Asan Log | |
run: | | |
set -euxo pipefail | |
cat ffstderr.log |grep 'ERROR: AddressSanitizer' && | |
echo "AddressSanitizer error found in ffstderr.log" && exit 1 | |
echo "AddressSanitizer is ok" | |
- name: Check FFmpeg Exit Log | |
run: | | |
set -euxo pipefail | |
cat ffstderr.log |grep 'Exiting normally' && exit 0 | |
echo "Exiting normally not found in ffstderr.log" && exit 1 | |
- name: Check Stream Existence | |
if: ${{ steps.streaming.outputs.has_stream == 'false' }} | |
run: exit 1 | |
runs-on: ubuntu-22.04 | |
openssl-1-1-0h: | |
name: "With OpenSSL 1.1.0h" | |
needs: build | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Build OpenSSL 1.1.0h | |
run: | | |
set -euxo pipefail | |
curl -s -L https://www.openssl.org/source/openssl-1.1.0h.tar.gz | tar xz | |
cd openssl-1.1.0h | |
./config --prefix=$HOME/.release/openssl | |
make -j$(nproc) && sudo make install_sw | |
- name: Download Test File | |
run: | | |
set -euxo pipefail | |
curl -s -L -O https://github.com/ossrs/ffmpeg-webrtc/releases/download/pre-release/bbb-4mbps-baseline-opus.mp4 | |
- name: Build FFmpeg | |
run: | | |
set -euxo pipefail | |
# Install dependencies | |
sudo apt-get update | |
sudo apt-get install -y nasm pkg-config jq libopus-dev libx264-dev | |
# Build FFmpeg with WebRTC support | |
PKG_CONFIG_PATH="$HOME/.release/openssl/lib/pkgconfig" \ | |
./configure --enable-muxer=whip --enable-openssl \ | |
--extra-cflags="-I$HOME/.release/openssl/include" \ | |
--extra-ldflags="-L$HOME/.release/openssl/lib" \ | |
--pkg-config-flags="--static" | |
make -j$(nproc) | |
./ffmpeg -version && ./ffmpeg -muxers 2>/dev/null |grep whip | |
- name: Start SRS Docker container | |
run: | | |
set -euxo pipefail | |
ip=$(ifconfig eth0 | grep 'inet ' | awk '{print $2}') | |
docker run --rm -d -p 1935:1935 -p 1985:1985 -p 8080:8080 \ | |
--env CANDIDATE=$ip -p 8000:8000/udp \ | |
ossrs/srs:5 ./objs/srs -c conf/rtc2rtmp.conf | |
- name: Streaming with FFmpeg | |
run: | | |
set -euxo pipefail | |
nohup ./ffmpeg -t 30 -re -i bbb-4mbps-baseline-opus.mp4 -c copy \ | |
-f whip "http://localhost:1985/rtc/v1/whip/?app=live&stream=livestream" \ | |
1>ffstdout.log 2>ffstderr.log & | |
- name: Check SRS Streaming | |
id: streaming | |
run: | | |
set -euxo pipefail | |
# Check streams in SRS. | |
for ((i=0; i<10; i++)); do | |
STREAM=$(curl -s http://localhost:1985/api/v1/streams/ | jq -r '.streams[].name') | |
if [[ "$STREAM" == "livestream" ]]; then | |
echo 'Test OK'; | |
echo "has_stream=true" >> $GITHUB_OUTPUT | |
break; | |
fi | |
sleep 3 | |
done | |
if [[ "$STREAM" != "livestream" ]]; then | |
echo "Stream not found: $STREAM" | |
echo "has_stream=false" >> $GITHUB_OUTPUT | |
fi | |
- name: Stop FFmpeg normally | |
run: | | |
pkill -SIGINT ffmpeg && sleep 3 || | |
echo "FFmpeg process not found or already stopped." | |
- name: Show FFmpeg Stdout Log | |
run: cat ffstdout.log | |
- name: Show FFmpeg Stderr Log | |
run: cat ffstderr.log | |
- name: Check FFmpeg Exit Log | |
run: | | |
set -euxo pipefail | |
cat ffstderr.log |grep 'Exiting normally' && exit 0 | |
echo "Exiting normally not found in ffstderr.log" && exit 1 | |
- name: Check Stream Existence | |
if: ${{ steps.streaming.outputs.has_stream == 'false' }} | |
run: exit 1 | |
runs-on: ubuntu-22.04 | |
openssl-3-0: | |
name: "With OpenSSL 3.0" | |
needs: build | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Build OpenSSL 3.0 | |
run: | | |
set -euxo pipefail | |
curl -s -L https://www.openssl.org/source/openssl-3.0.0.tar.gz | tar xz | |
cd openssl-3.0.0 | |
./config --prefix=$HOME/.release/openssl | |
make -j$(nproc) && sudo make install_sw | |
- name: Build FFmpeg | |
run: | | |
set -euxo pipefail | |
# Install dependencies | |
sudo apt-get update | |
sudo apt-get install -y nasm pkg-config jq libopus-dev libx264-dev | |
# Build FFmpeg with WebRTC support | |
PKG_CONFIG_PATH="$HOME/.release/openssl/lib/pkgconfig" \ | |
./configure --enable-muxer=whip --enable-openssl --enable-version3 \ | |
--extra-cflags="-I$HOME/.release/openssl/include" \ | |
--extra-ldflags="-L$HOME/.release/openssl/lib" \ | |
--pkg-config-flags="--static" \ | |
--enable-libx264 --enable-gpl --enable-libopus | |
make -j$(nproc) | |
./ffmpeg -version && ./ffmpeg -muxers 2>/dev/null |grep whip | |
- name: Start SRS Docker container | |
run: | | |
set -euxo pipefail | |
ip=$(ifconfig eth0 | grep 'inet ' | awk '{print $2}') | |
docker run --rm -d -p 1935:1935 -p 1985:1985 -p 8080:8080 \ | |
--env CANDIDATE=$ip -p 8000:8000/udp \ | |
ossrs/srs:5 ./objs/srs -c conf/rtc2rtmp.conf | |
- name: Streaming with FFmpeg | |
run: | | |
set -euxo pipefail | |
nohup ./ffmpeg -t 30 -re -f lavfi -i testsrc=size=1280x720 -f lavfi -i sine=frequency=440 -pix_fmt yuv420p \ | |
-vcodec libx264 -profile:v baseline -r 25 -g 50 -acodec libopus -ar 48000 -ac 2 \ | |
-f whip "http://localhost:1985/rtc/v1/whip/?app=live&stream=livestream" \ | |
1>ffstdout.log 2>ffstderr.log & | |
- name: Check SRS Streaming | |
id: streaming | |
run: | | |
set -euxo pipefail | |
# Check streams in SRS. | |
for ((i=0; i<10; i++)); do | |
STREAM=$(curl -s http://localhost:1985/api/v1/streams/ | jq -r '.streams[].name') | |
if [[ "$STREAM" == "livestream" ]]; then | |
echo 'Test OK'; | |
echo "has_stream=true" >> $GITHUB_OUTPUT | |
break; | |
fi | |
sleep 3 | |
done | |
if [[ "$STREAM" != "livestream" ]]; then | |
echo "Stream not found: $STREAM" | |
echo "has_stream=false" >> $GITHUB_OUTPUT | |
fi | |
- name: Stop FFmpeg normally | |
run: | | |
pkill -SIGINT ffmpeg && sleep 3 || | |
echo "FFmpeg process not found or already stopped." | |
- name: Show FFmpeg Stdout Log | |
run: cat ffstdout.log | |
- name: Show FFmpeg Stderr Log | |
run: cat ffstderr.log | |
- name: Check FFmpeg Exit Log | |
run: | | |
set -euxo pipefail | |
cat ffstderr.log |grep 'Exiting normally' && exit 0 | |
echo "Exiting normally not found in ffstderr.log" && exit 1 | |
- name: Check Stream Existence | |
if: ${{ steps.streaming.outputs.has_stream == 'false' }} | |
run: exit 1 | |
runs-on: ubuntu-22.04 | |
openssl-latest: | |
name: "With OpenSSL latest" | |
needs: build | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Build OpenSSL latest | |
run: | | |
set -euxo pipefail | |
curl -s -L https://www.openssl.org/source/openssl-3.5.0.tar.gz | tar xz | |
cd openssl-3.5.0 | |
./config --prefix=$HOME/.release/openssl | |
make -j$(nproc) && sudo make install_sw | |
- name: Build FFmpeg | |
run: | | |
set -euxo pipefail | |
# Install dependencies | |
sudo apt-get update | |
sudo apt-get install -y nasm pkg-config jq libopus-dev libx264-dev | |
# Build FFmpeg with WebRTC support | |
PKG_CONFIG_PATH="$HOME/.release/openssl/lib/pkgconfig" \ | |
./configure --enable-muxer=whip --enable-openssl --enable-version3 \ | |
--extra-cflags="-I$HOME/.release/openssl/include" \ | |
--extra-ldflags="-L$HOME/.release/openssl/lib" \ | |
--pkg-config-flags="--static" \ | |
--enable-libx264 --enable-gpl --enable-libopus | |
make -j$(nproc) | |
./ffmpeg -version && ./ffmpeg -muxers 2>/dev/null |grep whip | |
- name: Start SRS Docker container | |
run: | | |
set -euxo pipefail | |
ip=$(ifconfig eth0 | grep 'inet ' | awk '{print $2}') | |
docker run --rm -d -p 1935:1935 -p 1985:1985 -p 8080:8080 \ | |
--env CANDIDATE=$ip -p 8000:8000/udp \ | |
ossrs/srs:5 ./objs/srs -c conf/rtc2rtmp.conf | |
- name: Streaming with FFmpeg | |
run: | | |
set -euxo pipefail | |
nohup ./ffmpeg -t 30 -re -f lavfi -i testsrc=size=1280x720 -f lavfi -i sine=frequency=440 -pix_fmt yuv420p \ | |
-vcodec libx264 -profile:v baseline -r 25 -g 50 -acodec libopus -ar 48000 -ac 2 \ | |
-f whip "http://localhost:1985/rtc/v1/whip/?app=live&stream=livestream" \ | |
1>ffstdout.log 2>ffstderr.log & | |
- name: Check SRS Streaming | |
id: streaming | |
run: | | |
set -euxo pipefail | |
# Check streams in SRS. | |
for ((i=0; i<10; i++)); do | |
STREAM=$(curl -s http://localhost:1985/api/v1/streams/ | jq -r '.streams[].name') | |
if [[ "$STREAM" == "livestream" ]]; then | |
echo 'Test OK'; | |
echo "has_stream=true" >> $GITHUB_OUTPUT | |
break; | |
fi | |
sleep 3 | |
done | |
if [[ "$STREAM" != "livestream" ]]; then | |
echo "Stream not found: $STREAM" | |
echo "has_stream=false" >> $GITHUB_OUTPUT | |
fi | |
- name: Stop FFmpeg normally | |
run: | | |
pkill -SIGINT ffmpeg && sleep 3 || | |
echo "FFmpeg process not found or already stopped." | |
- name: Show FFmpeg Stdout Log | |
run: cat ffstdout.log | |
- name: Show FFmpeg Stderr Log | |
run: cat ffstderr.log | |
- name: Check FFmpeg Exit Log | |
run: | | |
set -euxo pipefail | |
cat ffstderr.log |grep 'Exiting normally' && exit 0 | |
echo "Exiting normally not found in ffstderr.log" && exit 1 | |
- name: Check Stream Existence | |
if: ${{ steps.streaming.outputs.has_stream == 'false' }} | |
run: exit 1 | |
runs-on: ubuntu-22.04 | |
generate-patch: | |
name: "Generate Patch" | |
if: ${{ github.event_name == 'pull_request' }} | |
steps: | |
# Checkout to workflows branch, make sure the base branch is available. | |
- name: Checkout repository with workflows branch | |
uses: actions/checkout@v4 | |
with: | |
ref: workflows | |
fetch-depth: 0 | |
- name: Try to checkout to workflows branch | |
run: | | |
set -euxo pipefail | |
git checkout workflows | |
git branch -vv | |
# Checkout to PR commit, use the lastest script. | |
- name: Checkout repository to PR commit | |
uses: actions/checkout@v4 | |
- name: Show Git Info | |
run: | | |
set -euxo pipefail | |
git branch -vv | |
echo "Repository: ${{ github.repository }}" | |
echo "Ref: ${{ github.ref }}" | |
echo "Event Name: ${{ github.event_name }}" | |
echo "Pull Request Number: ${{ github.event.pull_request.number }}" | |
- name: Install Dependencies | |
run: | | |
set -euxo pipefail | |
sudo apt-get update | |
sudo apt-get install -y jq | |
- name: Run Script | |
id: format_patch | |
run: | | |
set -euxo pipefail | |
PR_NUMBER=${{ github.event.pull_request.number }} | |
PATCH_FILENAME="whip-patch-$PR_NUMBER-$(date +%s)" | |
TMP_BRANCH="tmp-branch-for-patch-$PR_NUMBER" | |
echo "PR ID is ${{ github.event.pull_request.number }}" | |
echo "Patch file is $PATCH_FILENAME.patch" | |
echo "Temporary branch is $TMP_BRANCH" | |
bash .github/scripts/format-patch.sh $PR_NUMBER "$PATCH_FILENAME.patch" | |
echo "patch_file=$PATCH_FILENAME" >> $GITHUB_OUTPUT | |
echo "temporary_branch=$TMP_BRANCH" >> $GITHUB_OUTPUT | |
if [[ -f "$PATCH_FILENAME.patch" ]]; then | |
echo "has_patch=true" >> $GITHUB_OUTPUT | |
else | |
echo "has_patch=false" >> $GITHUB_OUTPUT | |
fi | |
- name: Show Branch Info | |
if: ${{ steps.format_patch.outputs.has_patch == 'true' }} | |
run: git show ${{ steps.format_patch.outputs.temporary_branch }} | |
- name: Show Patch File | |
if: ${{ steps.format_patch.outputs.has_patch == 'true' }} | |
run: cat ${{ steps.format_patch.outputs.patch_file }}.patch | |
- name: Upload all patch files | |
if: ${{ steps.format_patch.outputs.has_patch == 'true' }} | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ steps.format_patch.outputs.patch_file }} | |
path: | | |
whip-*.patch | |
retention-days: 90 | |
runs-on: ubuntu-22.04 | |
test-done: | |
needs: | |
- fate | |
- srs | |
- pion | |
- janus | |
- asan | |
- openssl-1-1-0h | |
- openssl-3-0 | |
- openssl-latest | |
- generate-patch | |
steps: | |
- run: echo 'All done' | |
runs-on: ubuntu-22.04 | |