Skip to content

Commit 0733211

Browse files
committed
Workflows: add pion and janus test (#53)
This PR refer to #39 and #38 --------- Signed-off-by: Jack Lau <[email protected]>
1 parent 04257ca commit 0733211

File tree

1 file changed

+129
-0
lines changed

1 file changed

+129
-0
lines changed

.github/workflows/test.yml

Lines changed: 129 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,133 @@ jobs:
152152
run: exit 1
153153
runs-on: ubuntu-22.04
154154

155+
pion:
156+
name: "FFmpeg with Pion"
157+
needs: build
158+
steps:
159+
- name: Checkout repository
160+
uses: actions/checkout@v4
161+
- name: Build FFmpeg
162+
run: |
163+
set -euxo pipefail
164+
165+
# Install dependencies
166+
sudo apt-get update
167+
sudo apt-get install -y nasm pkg-config jq libssl-dev libopus-dev libx264-dev
168+
169+
# Build FFmpeg with WebRTC support
170+
./configure --enable-muxer=whip --enable-openssl --enable-version3 \
171+
--enable-libx264 --enable-gpl --enable-libopus
172+
make -j$(nproc)
173+
./ffmpeg -version && ./ffmpeg -muxers 2>/dev/null |grep whip
174+
- name: Set up Go
175+
uses: actions/setup-go@v4
176+
with:
177+
go-version: '1.22'
178+
- name: Verify Go version
179+
run: go version
180+
- name: Start Pion
181+
run: |
182+
set -euxo pipefail
183+
git clone https://github.com/pion/webrtc.git
184+
cd webrtc/examples/whip-whep
185+
go run *.go &
186+
- name: Streaming with FFmpeg
187+
run: |
188+
set -euxo pipefail
189+
nohup ./ffmpeg -t 30 -re -f lavfi -i testsrc=size=1280x720 -f lavfi -i sine=frequency=440 -pix_fmt yuv420p \
190+
-vcodec libx264 -profile:v baseline -r 25 -g 50 -acodec libopus -ar 48000 -ac 2 \
191+
-f whip -authorization "seanTest" "http://localhost:8080/whip" \
192+
1>ffstdout.log 2>ffstderr.log &
193+
- name: Stop FFmpeg normally
194+
run: |
195+
pkill -SIGINT ffmpeg && sleep 3 ||
196+
echo "FFmpeg process not found or already stopped."
197+
- name: Show FFmpeg Stdout Log
198+
run: cat ffstdout.log
199+
- name: Show FFmpeg Stderr Log
200+
run: cat ffstderr.log
201+
- name: Check FFmpeg Exit Log
202+
run: |
203+
set -euxo pipefail
204+
cat ffstderr.log |grep 'Exiting normally' && exit 0
205+
echo "Exiting normally not found in ffstderr.log" && exit 1
206+
- name: Check Stream Existence
207+
if: ${{ steps.streaming.outputs.has_stream == 'false' }}
208+
run: exit 1
209+
runs-on: ubuntu-22.04
210+
211+
janus:
212+
name: "FFmpeg with Janus"
213+
needs: build
214+
steps:
215+
- name: Checkout repository
216+
uses: actions/checkout@v4
217+
- name: Build FFmpeg
218+
run: |
219+
set -euxo pipefail
220+
221+
# Install dependencies
222+
sudo apt-get update
223+
sudo apt-get install -y nasm pkg-config jq libssl-dev libopus-dev libx264-dev
224+
225+
# Build FFmpeg with WebRTC support
226+
./configure --enable-muxer=whip --enable-openssl --enable-version3 \
227+
--enable-libx264 --enable-gpl --enable-libopus
228+
make -j$(nproc)
229+
./ffmpeg -version && ./ffmpeg -muxers 2>/dev/null |grep whip
230+
- name: Start Janus
231+
run: |
232+
set -euxo pipefail
233+
git clone https://github.com/winlinvip/janus-docker.git
234+
(cd janus-docker &&
235+
ip=$(ifconfig eth0 | grep 'inet ' | awk '{print $2}') &&
236+
sed -i "s|\(^[[:blank:]]*nat_1_1_mapping *=\).*|\1\"$ip\"|g" janus.jcfg &&
237+
docker run --rm -d -p 8081:8080 -p 8188:8188 -p 8443:8443 -p 20000-20010:20000-20010/udp \
238+
-v $(pwd)/janus.jcfg:/usr/local/etc/janus/janus.jcfg \
239+
-v $(pwd)/janus.plugin.videoroom.jcfg:/usr/local/etc/janus/janus.plugin.videoroom.jcfg \
240+
-v $(pwd)/janus.transport.http.jcfg:/usr/local/etc/janus/janus.transport.http.jcfg \
241+
-v $(pwd)/janus.transport.websockets.jcfg:/usr/local/etc/janus/janus.transport.websockets.jcfg \
242+
-v $(pwd)/videoroomtest.js:/usr/local/share/janus/demos/videoroomtest.js \
243+
ossrs/janus:v1.0.12)
244+
245+
git clone https://github.com/meetecho/simple-whip-server.git
246+
cd simple-whip-server
247+
git checkout bd2d98898b9842bfc329443b46bcc906aab857aa
248+
npm install
249+
npm run build
250+
npm run start &
251+
252+
- name: Streaming with FFmpeg
253+
run: |
254+
set -euxo pipefail
255+
curl -H 'Content-Type: application/json' -d '{"id": "abc123", "room": 2345}' \
256+
http://localhost:7080/whip/create
257+
nohup ./ffmpeg -t 30 -re -f lavfi -i testsrc=size=1280x720 -f lavfi -i sine=frequency=440 -pix_fmt yuv420p \
258+
-vcodec libx264 -profile:v baseline -r 25 -g 50 -acodec libopus -ar 48000 -ac 2 \
259+
-f whip 'http://localhost:7080/whip/endpoint/abc123' \
260+
1>ffstdout.log 2>ffstderr.log &
261+
- name: Stop FFmpeg normally
262+
run: |
263+
pkill -SIGINT ffmpeg && sleep 3 ||
264+
echo "FFmpeg process not found or already stopped."
265+
- name: Show FFmpeg Stdout Log
266+
run: cat ffstdout.log
267+
- name: Show FFmpeg Stderr Log
268+
run: cat ffstderr.log
269+
- name: Check FFmpeg Exit Log
270+
run: |
271+
set -euxo pipefail
272+
cat ffstderr.log |grep 'Exiting normally' && exit 0
273+
echo "Exiting normally not found in ffstderr.log" && exit 1
274+
- name: Check Stream Existence
275+
if: ${{ steps.streaming.outputs.has_stream == 'false' }}
276+
run: exit 1
277+
- name: Setup tmate session
278+
if: ${{ failure() }}
279+
uses: mxschmitt/action-tmate@v3
280+
runs-on: ubuntu-22.04
281+
155282
asan:
156283
name: "FFmpeg with Asan"
157284
needs: build
@@ -705,6 +832,8 @@ jobs:
705832
needs:
706833
- fate
707834
- srs
835+
- pion
836+
- janus
708837
- asan
709838
- openssl-1-0-1k
710839
- openssl-1-0-2

0 commit comments

Comments
 (0)