Test #259
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: | |
| workflow_dispatch: | |
| 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: | |
| 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 | |
| build: | |
| name: "Build FFmpeg (${{ matrix.tls }})" | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| tls: [openssl, gnutls, mbedtls] | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Install dependencies | |
| run: | | |
| set -euxo pipefail | |
| sudo apt-get update | |
| sudo apt-get install -y nasm pkg-config jq libopus-dev libx264-dev | |
| if [[ "${{ matrix.tls }}" == "openssl" ]]; then | |
| sudo apt-get install -y libssl-dev | |
| elif [[ "${{ matrix.tls }}" == "gnutls" ]]; then | |
| sudo apt-get install -y gnutls-bin libgnutls28-dev | |
| elif [[ "${{ matrix.tls }}" == "mbedtls" ]]; then | |
| sudo apt-get install -y cmake | |
| fi | |
| - name: Build mbedTLS | |
| if: matrix.tls == 'mbedtls' | |
| run: | | |
| set -euxo pipefail | |
| curl -s -L https://github.com/Mbed-TLS/mbedtls/releases/download/mbedtls-3.6.2/mbedtls-3.6.2.tar.bz2 | tar xj | |
| cd mbedtls-3.6.2 | |
| scripts/config.py set MBEDTLS_SSL_DTLS_SRTP | |
| mkdir build && cd build | |
| cmake -DCMAKE_INSTALL_PREFIX=$HOME/.release/mbedtls \ | |
| -DUSE_SHARED_MBEDTLS_LIBRARY=Off -DENABLE_SHARED=Off -DENABLE_STATIC=On .. | |
| make -j$(nproc) && make install | |
| - name: Build FFmpeg | |
| run: | | |
| set -euxo pipefail | |
| if [[ "${{ matrix.tls }}" == "openssl" ]]; then | |
| ./configure --enable-muxer=whip --enable-openssl --enable-version3 \ | |
| --enable-libx264 --enable-gpl --enable-libopus | |
| elif [[ "${{ matrix.tls }}" == "gnutls" ]]; then | |
| ./configure --enable-muxer=whip --enable-gnutls \ | |
| --enable-libx264 --enable-gpl --enable-libopus | |
| elif [[ "${{ matrix.tls }}" == "mbedtls" ]]; then | |
| PKG_CONFIG_PATH="$HOME/.release/mbedtls/lib/pkgconfig" \ | |
| ./configure --enable-muxer=whip --enable-mbedtls --enable-version3 \ | |
| --extra-cflags="-I$HOME/.release/mbedtls/include" \ | |
| --extra-ldflags="-L$HOME/.release/mbedtls/lib" \ | |
| --pkg-config-flags="--static" \ | |
| --enable-libx264 --enable-gpl --enable-libopus | |
| fi | |
| make -j$(nproc) | |
| ./ffmpeg -version && ./ffmpeg -muxers 2>/dev/null |grep whip | |
| - name: Upload FFmpeg binary | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ffmpeg-${{ matrix.tls }} | |
| path: ./ffmpeg | |
| retention-days: 1 | |
| runs-on: ubuntu-22.04 | |
| srs: | |
| name: "SRS with FFmpeg (${{ matrix.tls }})" | |
| needs: build | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| tls: [openssl, gnutls, mbedtls] | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Install runtime dependencies | |
| run: | | |
| set -euxo pipefail | |
| sudo apt-get update | |
| sudo apt-get install -y jq libopus-dev libx264-dev | |
| if [[ "${{ matrix.tls }}" == "openssl" ]]; then | |
| sudo apt-get install -y libssl-dev | |
| elif [[ "${{ matrix.tls }}" == "gnutls" ]]; then | |
| sudo apt-get install -y libgnutls28-dev | |
| fi | |
| - name: Download FFmpeg binary | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: ffmpeg-${{ matrix.tls }} | |
| - name: Verify FFmpeg | |
| run: | | |
| chmod +x ./ffmpeg | |
| ./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: "Pion with FFmpeg (${{ matrix.tls }})" | |
| needs: build | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| tls: [openssl, gnutls, mbedtls] | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Install runtime dependencies | |
| run: | | |
| set -euxo pipefail | |
| sudo apt-get update | |
| sudo apt-get install -y jq libopus-dev libx264-dev | |
| if [[ "${{ matrix.tls }}" == "openssl" ]]; then | |
| sudo apt-get install -y libssl-dev | |
| elif [[ "${{ matrix.tls }}" == "gnutls" ]]; then | |
| sudo apt-get install -y libgnutls28-dev | |
| fi | |
| - name: Download FFmpeg binary | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: ffmpeg-${{ matrix.tls }} | |
| - name: Verify FFmpeg | |
| run: | | |
| chmod +x ./ffmpeg | |
| ./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 and Stream with FFmpeg | |
| run: | | |
| set -euxo pipefail | |
| git clone https://github.com/pion/webrtc.git | |
| cd webrtc/examples/whip-whep | |
| go run *.go & | |
| # Wait for Pion to be ready | |
| for ((i=0; i<30; i++)); do | |
| if curl -s -o /dev/null -w "%{http_code}" http://localhost:8080/whip | grep -qv "000"; then | |
| echo "Pion is ready" | |
| break | |
| fi | |
| echo "Waiting for Pion... ($i)" | |
| sleep 1 | |
| done | |
| cd $GITHUB_WORKSPACE | |
| 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 & | |
| sleep 10 | |
| 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 FFmpeg Streamed Successfully | |
| run: | | |
| set -euxo pipefail | |
| cat ffstderr.log |grep -v 'Connection refused' |grep 'frame=' |grep -v 'frame= 0' && exit 0 | |
| echo "FFmpeg did not stream any frames" && exit 1 | |
| runs-on: ubuntu-22.04 | |
| janus: | |
| name: "Janus with FFmpeg (${{ matrix.tls }})" | |
| needs: build | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| tls: [openssl, gnutls, mbedtls] | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Install runtime dependencies | |
| run: | | |
| set -euxo pipefail | |
| sudo apt-get update | |
| sudo apt-get install -y jq libopus-dev libx264-dev | |
| if [[ "${{ matrix.tls }}" == "openssl" ]]; then | |
| sudo apt-get install -y libssl-dev | |
| elif [[ "${{ matrix.tls }}" == "gnutls" ]]; then | |
| sudo apt-get install -y libgnutls28-dev | |
| fi | |
| - name: Download FFmpeg binary | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: ffmpeg-${{ matrix.tls }} | |
| - name: Verify FFmpeg | |
| run: | | |
| chmod +x ./ffmpeg | |
| ./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" | |
| 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-1: | |
| name: "With OpenSSL 1.1.1" | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Build OpenSSL 1.1.1 | |
| run: | | |
| set -euxo pipefail | |
| curl -s -L https://www.openssl.org/source/openssl-1.1.1w.tar.gz | tar xz | |
| cd openssl-1.1.1w | |
| ./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" | |
| 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" | |
| 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 | |
| test-done: | |
| needs: | |
| - fate | |
| - build | |
| - srs | |
| - pion | |
| - janus | |
| - asan | |
| - openssl-1-1-1 | |
| - openssl-3-0 | |
| - openssl-latest | |
| steps: | |
| - run: echo 'All done' | |
| runs-on: ubuntu-22.04 | |