@@ -681,6 +681,243 @@ jobs:
681681 run : exit 1
682682 runs-on : ubuntu-22.04
683683
684+ build-windows :
685+ name : " Build FFmpeg on Windows (${{ matrix.tls }})"
686+ strategy :
687+ fail-fast : false
688+ matrix :
689+ tls : [openssl, gnutls]
690+ steps :
691+ - name : Checkout repository
692+ uses : actions/checkout@v4
693+ - name : Set up MSYS2
694+ uses : msys2/setup-msys2@v2
695+ with :
696+ msystem : MINGW64
697+ update : true
698+ install : >-
699+ base-devel
700+ mingw-w64-x86_64-toolchain
701+ mingw-w64-x86_64-nasm
702+ mingw-w64-x86_64-pkg-config
703+ mingw-w64-x86_64-cmake
704+ - name : Install TLS dependencies
705+ shell : msys2 {0}
706+ run : |
707+ set -euxo pipefail
708+ if [[ "${{ matrix.tls }}" == "openssl" ]]; then
709+ pacman -S --noconfirm mingw-w64-x86_64-openssl
710+ elif [[ "${{ matrix.tls }}" == "gnutls" ]]; then
711+ pacman -S --noconfirm mingw-w64-x86_64-gnutls
712+ fi
713+ - name : Build FFmpeg
714+ shell : msys2 {0}
715+ run : |
716+ set -euxo pipefail
717+ if [[ "${{ matrix.tls }}" == "openssl" ]]; then
718+ ./configure --enable-muxer=whip --enable-openssl --enable-version3
719+ elif [[ "${{ matrix.tls }}" == "gnutls" ]]; then
720+ ./configure --enable-muxer=whip --enable-gnutls
721+ fi
722+ make -j$(nproc)
723+ ./ffmpeg.exe -version && ./ffmpeg.exe -muxers 2>/dev/null |grep whip
724+ - name : Upload FFmpeg binary
725+ uses : actions/upload-artifact@v4
726+ with :
727+ name : ffmpeg-windows-${{ matrix.tls }}
728+ path : ./ffmpeg.exe
729+ retention-days : 1
730+ runs-on : windows-latest
731+
732+ test-windows :
733+ name : " Test FFmpeg on Windows (${{ matrix.tls }})"
734+ needs : build-windows
735+ strategy :
736+ fail-fast : false
737+ matrix :
738+ tls : [openssl, gnutls]
739+ steps :
740+ - name : Checkout repository
741+ uses : actions/checkout@v4
742+ - name : Download FFmpeg binary
743+ uses : actions/download-artifact@v4
744+ with :
745+ name : ffmpeg-windows-${{ matrix.tls }}
746+ - name : Download Test File
747+ shell : pwsh
748+ run : |
749+ Invoke-WebRequest -Uri "https://github.com/ossrs/ffmpeg-webrtc/releases/download/pre-release/bbb-4mbps-baseline-opus.mp4" -OutFile "bbb-4mbps-baseline-opus.mp4"
750+ - name : Verify FFmpeg
751+ shell : pwsh
752+ run : |
753+ .\ffmpeg.exe -version
754+ .\ffmpeg.exe -muxers 2>$null | Select-String "whip"
755+ - name : Set up Go
756+ uses : actions/setup-go@v4
757+ with :
758+ go-version : ' 1.22'
759+ - name : Start Pion and Stream with FFmpeg
760+ shell : pwsh
761+ run : |
762+ git clone https://github.com/pion/webrtc.git
763+ cd webrtc/examples/whip-whep
764+ Start-Process -NoNewWindow -FilePath "go" -ArgumentList "run","." -RedirectStandardOutput pion-stdout.log -RedirectStandardError pion-stderr.log
765+
766+ # Wait for Pion to be ready
767+ for ($i=0; $i -lt 30; $i++) {
768+ try {
769+ $response = Invoke-WebRequest -Uri "http://localhost:8080/whip" -Method Head -ErrorAction SilentlyContinue
770+ if ($response.StatusCode -ne 0) {
771+ Write-Host "Pion is ready"
772+ break
773+ }
774+ } catch {
775+ Write-Host "Waiting for Pion... ($i)"
776+ Start-Sleep -Seconds 1
777+ }
778+ }
779+
780+ cd $env:GITHUB_WORKSPACE
781+ Start-Process -NoNewWindow -FilePath ".\ffmpeg.exe" -ArgumentList "-t","30","-re","-i","bbb-4mbps-baseline-opus.mp4","-c","copy","-f","whip","-authorization","seanTest","http://localhost:8080/whip" -RedirectStandardOutput ffstdout.log -RedirectStandardError ffstderr.log
782+ Start-Sleep -Seconds 10
783+ Get-Process ffmpeg -ErrorAction SilentlyContinue | Stop-Process
784+ Start-Sleep -Seconds 3
785+ - name : Show FFmpeg Logs
786+ if : always()
787+ shell : pwsh
788+ run : |
789+ if (Test-Path ffstdout.log) { Get-Content ffstdout.log }
790+ if (Test-Path ffstderr.log) { Get-Content ffstderr.log }
791+ - name : Check FFmpeg Streamed Successfully
792+ shell : pwsh
793+ run : |
794+ $stderr = Get-Content ffstderr.log -Raw
795+ if ($stderr -match "frame=\s+\d+" -and $stderr -notmatch "frame=\s+0\s") {
796+ Write-Host "FFmpeg streamed successfully"
797+ exit 0
798+ }
799+ Write-Host "FFmpeg did not stream any frames"
800+ exit 1
801+ runs-on : windows-latest
802+
803+ build-macos :
804+ name : " Build FFmpeg on macOS (${{ matrix.tls }})"
805+ strategy :
806+ fail-fast : false
807+ matrix :
808+ tls : [openssl, gnutls, mbedtls]
809+ steps :
810+ - name : Checkout repository
811+ uses : actions/checkout@v4
812+ - name : Install dependencies
813+ run : |
814+ set -euxo pipefail
815+ brew install nasm pkg-config
816+ if [[ "${{ matrix.tls }}" == "openssl" ]]; then
817+ brew install openssl@3
818+ elif [[ "${{ matrix.tls }}" == "gnutls" ]]; then
819+ brew install gnutls
820+ elif [[ "${{ matrix.tls }}" == "mbedtls" ]]; then
821+ brew install cmake
822+ fi
823+ - name : Build mbedTLS
824+ if : matrix.tls == 'mbedtls'
825+ run : |
826+ set -euxo pipefail
827+ curl -s -L https://github.com/Mbed-TLS/mbedtls/releases/download/mbedtls-3.6.2/mbedtls-3.6.2.tar.bz2 | tar xj
828+ cd mbedtls-3.6.2
829+ scripts/config.py set MBEDTLS_SSL_DTLS_SRTP
830+ mkdir build && cd build
831+ cmake -DCMAKE_INSTALL_PREFIX=$HOME/.release/mbedtls \
832+ -DUSE_SHARED_MBEDTLS_LIBRARY=Off -DENABLE_SHARED=Off -DENABLE_STATIC=On \
833+ -DENABLE_TESTING=Off -DENABLE_PROGRAMS=Off ..
834+ make -j$(sysctl -n hw.ncpu) && make install
835+ - name : Build FFmpeg
836+ run : |
837+ set -euxo pipefail
838+ if [[ "${{ matrix.tls }}" == "openssl" ]]; then
839+ PKG_CONFIG_PATH="$(brew --prefix openssl@3)/lib/pkgconfig" \
840+ ./configure --enable-muxer=whip --enable-openssl --enable-version3
841+ elif [[ "${{ matrix.tls }}" == "gnutls" ]]; then
842+ ./configure --enable-muxer=whip --enable-gnutls
843+ elif [[ "${{ matrix.tls }}" == "mbedtls" ]]; then
844+ PKG_CONFIG_PATH="$HOME/.release/mbedtls/lib/pkgconfig" \
845+ ./configure --enable-muxer=whip --enable-mbedtls --enable-version3 \
846+ --extra-cflags="-I$HOME/.release/mbedtls/include" \
847+ --extra-ldflags="-L$HOME/.release/mbedtls/lib" \
848+ --pkg-config-flags="--static"
849+ fi
850+ make -j$(sysctl -n hw.ncpu)
851+ ./ffmpeg -version && ./ffmpeg -muxers 2>/dev/null |grep whip
852+ - name : Upload FFmpeg binary
853+ uses : actions/upload-artifact@v4
854+ with :
855+ name : ffmpeg-macos-${{ matrix.tls }}
856+ path : ./ffmpeg
857+ retention-days : 1
858+ runs-on : macos-latest
859+
860+ test-macos :
861+ name : " Test FFmpeg on macOS (${{ matrix.tls }})"
862+ needs : build-macos
863+ strategy :
864+ fail-fast : false
865+ matrix :
866+ tls : [openssl, gnutls, mbedtls]
867+ steps :
868+ - name : Checkout repository
869+ uses : actions/checkout@v4
870+ - name : Download FFmpeg binary
871+ uses : actions/download-artifact@v4
872+ with :
873+ name : ffmpeg-macos-${{ matrix.tls }}
874+ - name : Download Test File
875+ run : |
876+ set -euxo pipefail
877+ curl -s -L -O https://github.com/ossrs/ffmpeg-webrtc/releases/download/pre-release/bbb-4mbps-baseline-opus.mp4
878+ - name : Verify FFmpeg
879+ run : |
880+ chmod +x ./ffmpeg
881+ ./ffmpeg -version && ./ffmpeg -muxers 2>/dev/null |grep whip
882+ - name : Set up Go
883+ uses : actions/setup-go@v4
884+ with :
885+ go-version : ' 1.22'
886+ - name : Start Pion and Stream with FFmpeg
887+ run : |
888+ set -euxo pipefail
889+ git clone https://github.com/pion/webrtc.git
890+ cd webrtc/examples/whip-whep
891+ go run *.go &
892+
893+ # Wait for Pion to be ready
894+ for ((i=0; i<30; i++)); do
895+ if curl -s -o /dev/null -w "%{http_code}" http://localhost:8080/whip | grep -qv "000"; then
896+ echo "Pion is ready"
897+ break
898+ fi
899+ echo "Waiting for Pion... ($i)"
900+ sleep 1
901+ done
902+
903+ cd $GITHUB_WORKSPACE
904+ nohup ./ffmpeg -t 30 -re -i bbb-4mbps-baseline-opus.mp4 -c copy \
905+ -f whip -authorization "seanTest" "http://localhost:8080/whip" \
906+ 1>ffstdout.log 2>ffstderr.log &
907+ sleep 10
908+ pkill -SIGINT ffmpeg && sleep 3 || echo "FFmpeg process not found"
909+ - name : Show FFmpeg Logs
910+ if : always()
911+ run : |
912+ cat ffstdout.log || true
913+ cat ffstderr.log || true
914+ - name : Check FFmpeg Streamed Successfully
915+ run : |
916+ set -euxo pipefail
917+ cat ffstderr.log |grep -v 'Connection refused' |grep 'frame=' |grep -v 'frame= 0' && exit 0
918+ echo "FFmpeg did not stream any frames" && exit 1
919+ runs-on : macos-latest
920+
684921 test-done :
685922 needs :
686923 - fate
@@ -692,6 +929,10 @@ jobs:
692929 - openssl-1-1-1
693930 - openssl-3-0
694931 - openssl-latest
932+ - build-windows
933+ - test-windows
934+ - build-macos
935+ - test-macos
695936 steps :
696937 - run : echo 'All done'
697938 runs-on : ubuntu-22.04
0 commit comments