Skip to content

Commit a07b13f

Browse files
committed
Adding sample checks & invalid dts fix
1 parent 1ba1872 commit a07b13f

File tree

5 files changed

+314
-15
lines changed

5 files changed

+314
-15
lines changed

.github/workflows/ci.yml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ jobs:
4040
role-duration-seconds: 10800
4141
- name: Run tests
4242
run: |
43-
cd build
43+
cd build
4444
./tst/producerTest
4545
4646
mac-os-build-gcc:
@@ -73,10 +73,10 @@ jobs:
7373
aws-region: ${{ secrets.AWS_REGION }}
7474
role-duration-seconds: 10800
7575
- name: Run tests
76-
run: |
76+
run: |
7777
cd build
7878
./tst/producerTest
79-
79+
8080
linux-gcc-code-coverage:
8181
runs-on: ubuntu-20.04
8282
env:
@@ -88,7 +88,7 @@ jobs:
8888
- name: Clone repository
8989
uses: actions/checkout@v3
9090
- name: Install dependencies
91-
run: |
91+
run: |
9292
sudo apt clean && sudo apt update
9393
sudo apt install -y libunwind-dev
9494
sudo apt-get install -y libssl-dev libcurl4-openssl-dev liblog4cplus-dev libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev gstreamer1.0-plugins-base-apps gstreamer1.0-plugins-bad gstreamer1.0-plugins-good gstreamer1.0-plugins-ugly gstreamer1.0-tools
@@ -115,7 +115,7 @@ jobs:
115115
cd build
116116
for test_file in $(find CMakeFiles/KinesisVideoProducer.dir gstkvssink.dir KinesisVideoProducerJNI.dir -name '*.gcno'); do gcov $test_file; done
117117
bash <(curl -s https://codecov.io/bash)
118-
118+
119119
address-sanitizer:
120120
runs-on: ubuntu-20.04
121121
permissions:
@@ -189,7 +189,7 @@ jobs:
189189
timeout --signal=SIGABRT 60m ./tst/producerTest
190190
191191
# memory-sanitizer:
192-
# runs-on: ubuntu-20.04
192+
# runs-on: ubuntu-20.04
193193
# permissions:
194194
# id-token: write
195195
# contents: read
@@ -237,9 +237,9 @@ jobs:
237237
# mkdir build && cd build
238238
# cmake .. -DBUILD_TEST=TRUE -DTHREAD_SANITIZER=TRUE -DBUILD_GSTREAMER_PLUGIN=TRUE -DBUILD_JNI=TRUE
239239
# make
240-
# ulimit -c unlimited -S
240+
# ulimit -c unlimited -S
241241
# timeout --signal=SIGABRT 20m ./tst/producerTest
242-
242+
243243
ubuntu-gcc:
244244
runs-on: ubuntu-20.04
245245
env:
@@ -312,7 +312,7 @@ jobs:
312312
- name: Run tests
313313
run: |
314314
$env:Path += ';C:\Strawberry\perl\site\bin;C:\Strawberry\perl\bin;C:\Strawberry\c\bin;C:\Program Files\NASM;D:\producer\open-source\local\lib;D:\producer\open-source\local\bin'
315-
& "D:\producer\build\tst\producerTest.exe"
315+
& "D:\producer\build\tst\producerTest.exe"
316316
317317
arm64-cross-compilation:
318318
runs-on: ubuntu-20.04

.github/workflows/raspberry-pi.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ on:
88

99
jobs:
1010
build:
11-
runs-on: ubuntu-latest
11+
runs-on: ubuntu-22.04
1212
timeout-minutes: 30
1313
permissions:
1414
id-token: write
@@ -70,7 +70,7 @@ jobs:
7070
make -j$(nproc)
7171
7272
export GST_PLUGIN_PATH=$(pwd)
73-
73+
7474
set +e # Disable exit on error for the timeout command
7575
timeout --preserve-status --signal=SIGINT --kill-after=15s 30s \
7676
gst-launch-1.0 -v videotestsrc is-live=true \
@@ -81,10 +81,10 @@ jobs:
8181
! kvssink stream-name="cpp-producer-rpi-${{ matrix.os }}"
8282
EXIT_CODE=$?
8383
set -e # Re-enable exit on error
84-
84+
8585
# 0: Process exited after interrupt with code 0
8686
# 1: Process exited with error code 1
87-
# 137: Process killed by SIGKILL (if the --kill-after timeout is reached)
87+
# 137: Process killed by SIGKILL (if the --kill-after timeout is reached)
8888
echo "Command exited with code: $EXIT_CODE"
8989
if [ $EXIT_CODE -ne 0 ]; then
9090
echo "Command did not exit gracefully after interrupt."

.github/workflows/samples.yml

Lines changed: 290 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,290 @@
1+
name: Producer CPP Sample Checks
2+
3+
on:
4+
push:
5+
branches:
6+
- develop
7+
- master
8+
pull_request:
9+
branches:
10+
- develop
11+
- master
12+
13+
jobs:
14+
sample-checks:
15+
name: ${{ matrix.runner.id }} - ${{ matrix.sample.name }}
16+
17+
strategy:
18+
matrix:
19+
sample:
20+
- name: kvs_gstreamer_audio_video_sample
21+
args: -f sample.mp4
22+
- name: kvs_gstreamer_file_uploader_sample
23+
args: sample.mp4 0 audio-video
24+
- name: kvs_gstreamer_sample
25+
args: sample.mp4
26+
- name: kvssink_gstreamer_sample
27+
args: sample.mp4
28+
runner:
29+
- id: macos-13
30+
image: macos-13
31+
32+
- id: ubuntu-22.04
33+
image: ubuntu-latest
34+
docker: public.ecr.aws/ubuntu/ubuntu:22.04_stable
35+
36+
- id: ubuntu-20.04
37+
image: ubuntu-latest
38+
docker: public.ecr.aws/ubuntu/ubuntu:20.04_stable
39+
40+
- id: windows-2022
41+
image: windows-2022
42+
43+
fail-fast: false
44+
45+
runs-on: ${{ matrix.runner.image }}
46+
container: ${{ matrix.runner.docker || '' }}
47+
timeout-minutes: 30
48+
49+
env:
50+
AWS_KVS_LOG_LEVEL: 2
51+
KVS_DEBUG_DUMP_DATA_FILE_DIR: ${{ github.workspace }}/build/debug_output
52+
DEBIAN_FRONTEND: noninteractive
53+
GST_PLUGIN_PATH: ${{ github.workspace }}/build
54+
55+
permissions:
56+
id-token: write
57+
contents: read
58+
59+
steps:
60+
- name: Clone repository
61+
uses: actions/checkout@v4
62+
63+
- name: Install dependencies (macOS)
64+
if: runner.os == 'macOS'
65+
run: |
66+
brew install gstreamer log4cplus mkvtoolnix
67+
68+
- name: Install dependencies (Linux)
69+
if: runner.os == 'Linux'
70+
run: |
71+
apt-get update
72+
apt-get install -y git cmake build-essential pkg-config libssl-dev libcurl4-openssl-dev \
73+
liblog4cplus-dev libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev \
74+
gstreamer1.0-plugins-base-apps gstreamer1.0-plugins-bad gstreamer1.0-plugins-good \
75+
gstreamer1.0-plugins-ugly gstreamer1.0-tools curl mkvtoolnix
76+
77+
- name: Install dependencies (Windows)
78+
if: runner.os == 'Windows'
79+
run: |
80+
choco install nasm strawberryperl pkgconfiglite mkvtoolnix
81+
choco install gstreamer --version=1.22.8
82+
choco install gstreamer-devel --version=1.22.8
83+
84+
- name: Build samples (Linux & Mac)
85+
if: runner.os == 'Linux' || runner.os == 'macOS'
86+
run: |
87+
mkdir build && cd build
88+
mkdir -p $KVS_DEBUG_DUMP_DATA_FILE_DIR
89+
cmake .. -DBUILD_GSTREAMER_PLUGIN=ON -DBUILD_DEPENDENCIES=OFF
90+
make -j$(nproc)
91+
92+
- name: Build samples (Windows)
93+
if: runner.os == 'Windows'
94+
run: |
95+
$env:Path += ';C:\Strawberry\perl\site\bin;C:\Strawberry\perl\bin;C:\Strawberry\c\bin;C:\Program Files\NASM;D:\producer\open-source\local\lib;D:\producer\open-source\local\bin'
96+
mkdir D:\producer
97+
Move-Item -Path "D:\a\amazon-kinesis-video-streams-producer-sdk-cpp\amazon-kinesis-video-streams-producer-sdk-cpp\*" -Destination "D:\producer"
98+
cd D:\producer
99+
git config --system core.longpaths true
100+
dir
101+
.github\build_windows.bat
102+
103+
- name: Configure AWS Credentials
104+
uses: aws-actions/configure-aws-credentials@v4
105+
with:
106+
role-to-assume: ${{ secrets.AWS_ROLE_TO_ASSUME }}
107+
role-session-name: ${{ secrets.AWS_ROLE_SESSION_NAME }}
108+
aws-region: ${{ secrets.AWS_REGION }}
109+
role-duration-seconds: 10800
110+
111+
- name: Run ${{ matrix.sample.name }} (Linux & Mac)
112+
if: runner.os == 'Linux' || runner.os == 'macOS'
113+
working-directory: ./build
114+
run: |
115+
curl -fsSL -o sample.mp4 https://awsj-iot-handson.s3-ap-northeast-1.amazonaws.com/kvs-workshop/sample.mp4
116+
./${{ matrix.sample.name }} demo-stream-producer-cpp-${{ matrix.runner.id }}-ci-${{ matrix.sample.name }} ${{ matrix.sample.args }}
117+
118+
- name: Run ${{ matrix.sample.name }} (Windows)
119+
if: runner.os == 'Windows'
120+
env:
121+
GST_PLUGIN_PATH: D:\producer\build
122+
KVS_DEBUG_DUMP_DATA_FILE_DIR: D:\producer\debug_output
123+
working-directory: D:\producer\build
124+
run: |
125+
# Equivalent to set -x
126+
Set-PSDebug -Trace 1
127+
128+
$env:Path += ';C:\Strawberry\perl\site\bin;C:\Strawberry\perl\bin;C:\Strawberry\c\bin;C:\Program Files\NASM;D:\producer\open-source\local\lib;D:\producer\open-source\local\bin;D:\gstreamer\1.0\msvc_x86_64\bin'
129+
130+
mkdir D:\producer\debug_output
131+
132+
Invoke-WebRequest -Uri https://awsj-iot-handson.s3-ap-northeast-1.amazonaws.com/kvs-workshop/sample.mp4 -OutFile sample.mp4
133+
dir
134+
$exePath = Join-Path $PWD ${{ matrix.sample.name }}.exe
135+
& $exePath demo-stream-producer-cpp-${{ matrix.runner.id }}-ci-${{ matrix.sample.name }} ${{ matrix.sample.args }}
136+
137+
- name: Verify MKV dump (Mac & Linux)
138+
if: runner.os == 'Linux' || runner.os == 'macOS'
139+
working-directory: ./build/debug_output
140+
run: |
141+
shopt -s nullglob # Ensure globbing works correctly and avoids errors when no files are found
142+
143+
ls -tlrh
144+
mkvfiles=(*.mkv)
145+
if [ ${#mkvfiles[@]} -eq 0 ]; then
146+
echo "No MKV files found in debug_output"
147+
exit 1
148+
fi
149+
150+
for file in "${mkvfiles[@]}"; do
151+
echo "Verifying $file with mkvinfo (verbose and hexdump):"
152+
mkvinfo -v -X "$file"
153+
done
154+
shell: bash
155+
156+
- name: Verify MKV dump (Windows)
157+
if: runner.os == 'Windows'
158+
working-directory: D:\producer\build
159+
run: |
160+
$env:Path += ";C:\Program Files\MKVToolNix"
161+
dir D:\producer\debug_output
162+
$mkvFiles = Get-ChildItem -Path "D:\producer\debug_output" -Filter *.mkv
163+
if ($mkvFiles.Count -eq 0) {
164+
Write-Error "No MKV files found in D:\producer\build\debug_output"
165+
exit 1
166+
}
167+
# Run mkvinfo on each MKV file
168+
foreach ($file in $mkvFiles) {
169+
Write-Output "Verifying $($file.FullName) with mkvinfo (verbose and hexdump):"
170+
mkvinfo.exe -v -X "$($file.FullName)"
171+
}
172+
173+
multistream-sample:
174+
name: Multistream sample on Mac
175+
runs-on: macos-13
176+
timeout-minutes: 30
177+
178+
env:
179+
AWS_KVS_LOG_LEVEL: 2
180+
KVS_DEBUG_DUMP_DATA_FILE_DIR: ${{ github.workspace }}/build/debug_output
181+
GST_PLUGIN_PATH: ${{ github.workspace }}/build
182+
DEBIAN_FRONTEND: noninteractive
183+
184+
permissions:
185+
id-token: write
186+
contents: read
187+
188+
steps:
189+
- name: Clone repository
190+
uses: actions/checkout@v4
191+
192+
- name: Install dependencies
193+
run: |
194+
brew install gstreamer log4cplus mkvtoolnix coreutils
195+
brew install --cask docker
196+
197+
- name: Build samples
198+
run: |
199+
mkdir build && cd build
200+
mkdir -p $KVS_DEBUG_DUMP_DATA_FILE_DIR
201+
cmake .. -DBUILD_GSTREAMER_PLUGIN=ON -DBUILD_DEPENDENCIES=OFF
202+
make -j$(nproc)
203+
204+
- name: Configure AWS Credentials
205+
uses: aws-actions/configure-aws-credentials@v4
206+
with:
207+
role-to-assume: ${{ secrets.AWS_ROLE_TO_ASSUME }}
208+
role-session-name: ${{ secrets.AWS_ROLE_SESSION_NAME }}
209+
aws-region: ${{ secrets.AWS_REGION }}
210+
role-duration-seconds: 10800
211+
212+
- name: Run multistream sample
213+
working-directory: ./build
214+
run: |
215+
set -x
216+
217+
open -a /Applications/Docker.app --args --unattended --accept-license
218+
echo "We are waiting for Docker to be up and running. It can take over 2 minutes..."
219+
while ! /Applications/Docker.app/Contents/Resources/bin/docker info &>/dev/null; do sleep 1; done
220+
221+
sudo ln -s ~/.docker/run/docker.sock /var/run/docker.sock
222+
223+
docker run -d --rm -it -e RTSP_PROTOCOLS=tcp -p 8554:8554 bluenviron/mediamtx:latest
224+
docker run -d --rm -it -e RTSP_PROTOCOLS=tcp -p 8555:8554 bluenviron/mediamtx:latest
225+
226+
(
227+
ffmpeg -re -f lavfi -i "testsrc=size=640x480:rate=10" -vcodec libx264 -x264-params keyint=25 -f rtsp rtsp://localhost:8554/mystream
228+
) &
229+
(
230+
ffmpeg -re -f lavfi -i "testsrc=size=640x480:rate=10" -vcodec libx264 -x264-params keyint=25 -f rtsp rtsp://localhost:8555/mystream
231+
) &
232+
233+
echo "rtsp://0.0.0.0:8554/mystream" > rtsp-urls.txt
234+
echo "rtsp://0.0.0.0:8555/mystream" >> rtsp-urls.txt
235+
236+
sleep 10
237+
gst-discoverer-1.0 rtsp://0.0.0.0:8554/mystream
238+
gst-discoverer-1.0 rtsp://0.0.0.0:8555/mystream
239+
240+
set +e # Disable exit on error for the timeout command
241+
gtimeout --preserve-status --signal=SIGINT --kill-after=15s 30s \
242+
./kvs_gstreamer_multistream_sample demo-stream-producer-cpp-macos-13-ci-kvs_gstreamer_multistream_sample rtsp-urls.txt
243+
EXIT_CODE=$?
244+
set -e # Re-enable exit on error
245+
246+
# 130 (128 + 2): Process killed by SIGINT
247+
# 137: Process killed by SIGKILL (if the --kill-after timeout is reached)
248+
echo "Command exited with code: $EXIT_CODE"
249+
if [ $EXIT_CODE -ne 130 ]; then
250+
echo "Command did not exit gracefully after interrupt."
251+
exit 1
252+
fi
253+
254+
shell: bash
255+
256+
- name: Verify MKV dump
257+
working-directory: ./build/debug_output
258+
run: |
259+
shopt -s nullglob # Ensure globbing works correctly and avoids errors when no files are found
260+
261+
ls -tlrh
262+
mkvfiles=(*.mkv)
263+
if [ ${#mkvfiles[@]} -eq 0 ]; then
264+
echo "No MKV files found in debug_output"
265+
exit 1
266+
fi
267+
268+
found_0=0
269+
found_1=0
270+
271+
for file in "${mkvfiles[@]}"; do
272+
if [[ "$file" == demo-stream-producer-cpp-macos-13-ci-kvs_gstreamer_multistream_sample_0* ]]; then
273+
found_0=1
274+
elif [[ "$file" == demo-stream-producer-cpp-macos-13-ci-kvs_gstreamer_multistream_sample_1* ]]; then
275+
found_1=1
276+
fi
277+
done
278+
279+
if [ $found_0 -eq 0 ] || [ $found_1 -eq 0 ]; then
280+
echo "Expected at least one file starting with each prefix:"
281+
echo " - demo-stream-producer-cpp-macos-13-ci-kvs_gstreamer_multistream_sample_0"
282+
echo " - demo-stream-producer-cpp-macos-13-ci-kvs_gstreamer_multistream_sample_1"
283+
exit 1
284+
fi
285+
286+
for file in "${mkvfiles[@]}"; do
287+
echo "Verifying $file with mkvinfo (verbose and hexdump):"
288+
mkvinfo -v -X "$file"
289+
done
290+
shell: bash

0 commit comments

Comments
 (0)