Skip to content

Commit e9f84ec

Browse files
authored
Add CI for kvs_gstreamer_audio_video_sample to check for event metadata (#1254)
* Add CI for kvs_gstreamer_audio_video_sample to check for event metadata * WSL syntax
1 parent 508a27a commit e9f84ec

File tree

1 file changed

+105
-3
lines changed

1 file changed

+105
-3
lines changed

.github/workflows/samples.yml

Lines changed: 105 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ jobs:
5151
sample:
5252
- name: kvs_gstreamer_audio_video_sample
5353
args: -f sample.mp4
54+
metadata_args: -e both
5455
- name: kvs_gstreamer_file_uploader_sample
5556
args: sample.mp4 0 audio-video
5657
- name: kvs_gstreamer_sample
@@ -151,7 +152,7 @@ jobs:
151152
working-directory: ./build
152153
run: |
153154
mv ../assets/*.mp4 .
154-
./${{ matrix.sample.name }} demo-stream-producer-cpp-${{ matrix.runner.id }}-ci-${{ matrix.sample.name }} ${{ matrix.sample.args }}
155+
./${{ matrix.sample.name }} demo-stream-producer-cpp-${{ matrix.runner.id }}-ci-${{ matrix.sample.name }} ${{ matrix.sample.args }} ${{ matrix.sample.metadata_args }}
155156
156157
- name: Run ${{ matrix.sample.name }} (Windows)
157158
if: runner.os == 'Windows'
@@ -170,7 +171,7 @@ jobs:
170171
cp -r D:\a\amazon-kinesis-video-streams-producer-sdk-cpp\amazon-kinesis-video-streams-producer-sdk-cpp\assets\*.mp4 .
171172
dir
172173
$exePath = Join-Path $PWD ${{ matrix.sample.name }}.exe
173-
& $exePath demo-stream-producer-cpp-${{ matrix.runner.id }}-ci-${{ matrix.sample.name }} ${{ matrix.sample.args }}
174+
& $exePath demo-stream-producer-cpp-${{ matrix.runner.id }}-ci-${{ matrix.sample.name }} ${{ matrix.sample.args }} ${{ matrix.sample.metadata_args }}
174175
175176
- name: Verify MKV dump exists (Mac & Linux)
176177
if: runner.os == 'Linux' || runner.os == 'macOS'
@@ -208,6 +209,76 @@ jobs:
208209
mkvinfo.exe -v -X "$($file.FullName)"
209210
}
210211
212+
- name: Check fragment metadata is present (Mac & Linux)
213+
if: (runner.os == 'Linux' || runner.os == 'macOS') && matrix.sample.metadata_args != null
214+
working-directory: ./build/debug_output
215+
run: |
216+
shopt -s nullglob
217+
218+
for file in *.mkv; do
219+
echo "Verifying ${file} with mkvinfo:"
220+
mkvinfo -v -X "${file}" > mkvinfo_output.txt 2>&1
221+
found_notification=false
222+
found_image=false
223+
224+
if [ -f "mkvinfo_output.txt" ]; then
225+
if grep -q "AWS_KINESISVIDEO_NOTIFICATION" "mkvinfo_output.txt"; then
226+
found_notification=true
227+
echo "Found AWS_KINESISVIDEO_NOTIFICATION in ${file}"
228+
fi
229+
230+
if grep -q "AWS_KINESISVIDEO_IMAGE_GENERATION" "mkvinfo_output.txt"; then
231+
found_image=true
232+
echo "Found AWS_KINESISVIDEO_IMAGE_GENERATION in ${file}"
233+
fi
234+
235+
if [ "${found_notification}" = false ] || [ "${found_image}" = false ]; then
236+
echo "Error: Required metadata strings not found in ${file}"
237+
echo "AWS_KINESISVIDEO_NOTIFICATION: ${found_notification}"
238+
echo "AWS_KINESISVIDEO_IMAGE_GENERATION: ${found_image}"
239+
rm -f "mkvinfo_output.txt"
240+
exit 1
241+
fi
242+
rm -f "mkvinfo_output.txt"
243+
else
244+
echo "Error: Failed to create mkvinfo output file"
245+
exit 1
246+
fi
247+
done
248+
249+
shell: bash
250+
251+
- name: Check fragment metadata is present (Windows)
252+
if: runner.os == 'Windows' && matrix.sample.metadata_args != null
253+
working-directory: D:\producer\build
254+
run: |
255+
$env:Path += ";C:\Program Files\MKVToolNix"
256+
$mkvFiles = Get-ChildItem -Path "D:\producer\debug_output" -Filter *.mkv
257+
258+
foreach ($file in $mkvFiles) {
259+
$output = mkvinfo.exe -v -X "$($file.FullName)"
260+
$foundNotification = $false
261+
$foundImage = $false
262+
263+
if ($output -match "AWS_KINESISVIDEO_NOTIFICATION") {
264+
$foundNotification = $true
265+
Write-Output "Found AWS_KINESISVIDEO_NOTIFICATION in $($file.Name)"
266+
}
267+
268+
if ($output -match "AWS_KINESISVIDEO_IMAGE_GENERATION") {
269+
$foundImage = $true
270+
Write-Output "Found AWS_KINESISVIDEO_IMAGE_GENERATION in $($file.Name)"
271+
}
272+
273+
if (-not $foundNotification -or -not $foundImage) {
274+
Write-Output "Required metadata strings not found in $($file.Name)"
275+
Write-Output "AWS_KINESISVIDEO_NOTIFICATION: $foundNotification"
276+
Write-Output "AWS_KINESISVIDEO_IMAGE_GENERATION: $foundImage"
277+
exit 1
278+
}
279+
}
280+
shell: pwsh
281+
211282
multistream-sample:
212283
name: Multistream sample on Ubuntu 22.04
213284
runs-on: ubuntu-latest
@@ -355,6 +426,7 @@ jobs:
355426
sample:
356427
- name: kvs_gstreamer_audio_video_sample
357428
args: -f sample.mp4
429+
metadata_args: -e both
358430
- name: kvs_gstreamer_file_uploader_sample
359431
args: sample.mp4 0 audio-video
360432
- name: kvs_gstreamer_sample
@@ -451,7 +523,7 @@ jobs:
451523
export AWS_DEFAULT_REGION=${{ env.AWS_DEFAULT_REGION }}
452524
453525
set +e # Disable exit on error for the timeout command
454-
./${{ matrix.sample.name }} demo-stream-producer-cpp-wsl-${{ matrix.image }}-ci-${{ matrix.sample.name }} ${{ matrix.sample.args }}
526+
./${{ matrix.sample.name }} demo-stream-producer-cpp-wsl-${{ matrix.image }}-ci-${{ matrix.sample.name }} ${{ matrix.sample.args }} ${{ matrix.sample.metadata_args }}
455527
EXIT_CODE=$?
456528
set -e # Re-enable exit on error
457529
@@ -480,3 +552,33 @@ jobs:
480552
echo "Verifying $file with mkvinfo (verbose and hexdump):"
481553
mkvinfo -v -X "$file"
482554
done
555+
556+
- name: Check fragment metadata is present (WSL)
557+
if: matrix.sample.metadata_args != null
558+
run: |
559+
shopt -s nullglob
560+
cd ~/kvs-cpp-repo/build/debug_output
561+
562+
for file in *.mkv; do
563+
echo "Verifying $file with mkvinfo:"
564+
mkvinfo -v -X "${file}" > mkvinfo_output.txt
565+
found_notification=false
566+
found_image=false
567+
568+
if grep -q "AWS_KINESISVIDEO_NOTIFICATION" "mkvinfo_output.txt"; then
569+
found_notification=true
570+
echo "Found AWS_KINESISVIDEO_NOTIFICATION in $file"
571+
fi
572+
573+
if grep -q "AWS_KINESISVIDEO_IMAGE_GENERATION" "mkvinfo_output.txt"; then
574+
found_image=true
575+
echo "Found AWS_KINESISVIDEO_IMAGE_GENERATION in $file"
576+
fi
577+
578+
if [ "$found_notification" = false ] || [ "$found_image" = false ]; then
579+
echo "Error: Required metadata strings not found in $file"
580+
echo "AWS_KINESISVIDEO_NOTIFICATION: ${found_notification}"
581+
echo "AWS_KINESISVIDEO_IMAGE_GENERATION: ${found_image}"
582+
exit 1
583+
fi
584+
done

0 commit comments

Comments
 (0)