mirror of
https://github.com/libretro/RetroArch.git
synced 2026-11-23 00:36:42 -10:00
Connect the admitted desktop Vulkan encode queue to viewport recording through an asynchronous worker. Capture GPU pixels in the renderer submission, publish only successful submissions, and retain source/device resources through stop, resize and deferred video reinitialization. Refuse unsupported devices, HDR, formats and audio layouts before creating output. Start after the first core frame so admission uses its actual audio layout. Hold PCM on the existing worker queue until encoded video establishes its clock limit. Trim trailing queued PCM at video EOS before AC-3 padding and publish the actual consumed count after worker retirement. This prevents a threaded resize from leaving audio beyond the last captured picture. Add no producer locks, waits, pixel readbacks or pacing logs. Configure selects the driver on desktop Vulkan builds with its dependencies; existing default driver priority is retained. Add frontend admission/lifetime, delayed-video PCM, terminal-result publication and native isolated-window resize/reinit/stop regression coverage. Validation: GCC/Clang ASan+UBSan frontend contracts, Vulkan encode contracts, recording output/session/dispatch contracts and independent MP4 A/V checks. Windows native recording passes threaded/direct multichannel float PCM at 32/44.1/48 kHz, plus resize, reinit and stop with Khronos sync validation. Desktop Linux and Windows frontends build with automatic feature selection. Native Linux GPU acceptance remains open. The unrelated extended RSLC unsized uniform-buffer fixture is rejected by the installed standalone SPIR-V validator; that check is retained as a failure, not reported as an extended-suite pass.
421 lines
18 KiB
YAML
421 lines
18 KiB
YAML
name: CI Linux samples/record
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- master
|
|
paths:
|
|
- 'record/**'
|
|
- 'gfx/common/vulkan_encode*'
|
|
- 'gfx/drivers/vulkan.c'
|
|
- 'gfx/video_driver.h'
|
|
- 'Makefile.common'
|
|
- 'qb/config.*.sh'
|
|
- 'libretro-common/net/net_rtmp*'
|
|
- 'libretro-common/net/net_socket.c'
|
|
- 'libretro-common/net/net_resolve.c'
|
|
- 'libretro-common/include/net/net_resolve.h'
|
|
- 'libretro-common/include/net/net_socket.h'
|
|
- 'libretro-common/include/net/net_rtmp*'
|
|
- 'libretro-common/formats/flv/**'
|
|
- 'libretro-common/include/formats/rflv_mux.h'
|
|
- 'libretro-common/samples/net/rtmp/**'
|
|
- 'libretro-common/samples/formats/flv/**'
|
|
- 'gfx/common/videotoolbox_encode*.h'
|
|
- 'libretro-common/queues/**'
|
|
- 'libretro-common/include/retro_spsc.h'
|
|
- 'libretro-common/include/retro_atomic.h'
|
|
- 'samples/record/**'
|
|
- '.github/workflows/Linux-samples-record.yml'
|
|
pull_request:
|
|
branches:
|
|
- master
|
|
paths:
|
|
- 'record/**'
|
|
- 'gfx/common/vulkan_encode*'
|
|
- 'gfx/drivers/vulkan.c'
|
|
- 'gfx/video_driver.h'
|
|
- 'Makefile.common'
|
|
- 'qb/config.*.sh'
|
|
- 'libretro-common/net/net_rtmp*'
|
|
- 'libretro-common/net/net_socket.c'
|
|
- 'libretro-common/net/net_resolve.c'
|
|
- 'libretro-common/include/net/net_resolve.h'
|
|
- 'libretro-common/include/net/net_socket.h'
|
|
- 'libretro-common/include/net/net_rtmp*'
|
|
- 'libretro-common/formats/flv/**'
|
|
- 'libretro-common/include/formats/rflv_mux.h'
|
|
- 'libretro-common/samples/net/rtmp/**'
|
|
- 'libretro-common/samples/formats/flv/**'
|
|
- 'gfx/common/videotoolbox_encode*.h'
|
|
- 'libretro-common/queues/**'
|
|
- 'libretro-common/include/retro_spsc.h'
|
|
- 'libretro-common/include/retro_atomic.h'
|
|
- 'samples/record/**'
|
|
- '.github/workflows/Linux-samples-record.yml'
|
|
workflow_dispatch:
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
env:
|
|
ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: true
|
|
|
|
concurrency:
|
|
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
|
|
cancel-in-progress: ${{ github.ref != 'refs/heads/master' }}
|
|
|
|
jobs:
|
|
samples-record:
|
|
name: Build and run samples/record
|
|
runs-on: ubuntu-latest
|
|
env:
|
|
APT_PKGS: clang mingw-w64 wine build-essential pkg-config ffmpeg openssl python3 libavcodec-dev libavformat-dev libavutil-dev libswscale-dev libswresample-dev ccache
|
|
timeout-minutes: 25
|
|
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v5
|
|
|
|
- name: Apt cache key
|
|
id: apt
|
|
run: sh .github/workflows/scripts/apt-cache-key.sh "$APT_PKGS"
|
|
|
|
- name: Restore apt cache
|
|
uses: actions/cache/restore@v4
|
|
with:
|
|
path: ~/.apt-cache
|
|
key: ${{ steps.apt.outputs.key }}
|
|
restore-keys: ${{ steps.apt.outputs.prefix }}
|
|
|
|
- name: Install dependencies
|
|
timeout-minutes: 20
|
|
run: sh .github/workflows/scripts/apt-install.sh $APT_PKGS
|
|
|
|
- name: Save apt cache
|
|
if: env.APT_CACHE_SAVE == '1'
|
|
uses: actions/cache/save@v4
|
|
with:
|
|
path: ~/.apt-cache
|
|
key: ${{ steps.apt.outputs.key }}
|
|
|
|
- name: Link with lld
|
|
run: sh .github/workflows/scripts/use-lld.sh
|
|
|
|
- name: Restore ccache
|
|
uses: actions/cache/restore@v4
|
|
with:
|
|
path: ~/.ccache
|
|
key: ccache-${{ github.workflow }}-${{ github.job }}-${{ github.sha }}
|
|
restore-keys: |
|
|
ccache-${{ github.workflow }}-${{ github.job }}-
|
|
|
|
- name: Enable ccache
|
|
run: |
|
|
set -eu
|
|
export CCACHE_DIR="$HOME/.ccache"
|
|
echo "CCACHE_DIR=$CCACHE_DIR" >> "$GITHUB_ENV"
|
|
echo "/usr/lib/ccache" >> "$GITHUB_PATH"
|
|
ccache -M 250M
|
|
ccache -z
|
|
|
|
- name: Build and run ffmpeg_pipeline_test (ASan + UBSan, TSan)
|
|
shell: bash
|
|
working-directory: samples/record/ffmpeg_pipeline
|
|
run: |
|
|
set -eu
|
|
# record/drivers/record_ffmpeg.c end to end: frames whose
|
|
# pixels encode their number, plus audio, pushed from the
|
|
# test thread while the driver's encoder thread drains the
|
|
# attr/video/audio rings; the file is decoded back and every
|
|
# frame checked in order and pixel-exact. Covers the rings
|
|
# under contention, the full-queue wait, and the drain after
|
|
# the encoder thread is joined. Needs libavcodec with
|
|
# libx264rgb (Ubuntu's has it).
|
|
make clean SANITIZER=address,undefined && make -j$(nproc) all SANITIZER=address,undefined
|
|
test -x ffmpeg_pipeline_test
|
|
ASAN_OPTIONS=detect_leaks=1:detect_stack_use_after_return=1 \
|
|
UBSAN_OPTIONS=print_stacktrace=1 timeout 300 \
|
|
./ffmpeg_pipeline_test
|
|
echo "[pass] ffmpeg_pipeline_test (ASan)"
|
|
make clean SANITIZER=thread && make -j$(nproc) all SANITIZER=thread
|
|
TSAN_OPTIONS=halt_on_error=1 timeout 300 ./ffmpeg_pipeline_test
|
|
echo "[pass] ffmpeg_pipeline_test (TSan)"
|
|
# The same run on a video ring that cannot be mirrored, as on
|
|
# a platform without a double mapping: frames that straddle
|
|
# the wrap go through the encoder side's scratch copy.
|
|
make clean SANITIZER=address,undefined PLAIN_RING=1 && make -j$(nproc) all SANITIZER=address,undefined PLAIN_RING=1
|
|
ASAN_OPTIONS=detect_leaks=1:detect_stack_use_after_return=1 \
|
|
UBSAN_OPTIONS=print_stacktrace=1 timeout 300 \
|
|
./ffmpeg_pipeline_test
|
|
echo "[pass] ffmpeg_pipeline_test (plain ring, ASan)"
|
|
|
|
- name: Native overlapped file output
|
|
working-directory: samples/record/file_win32
|
|
run: |
|
|
set -eu
|
|
. "$GITHUB_WORKSPACE/.github/workflows/scripts/wine-server.sh"
|
|
make clean && make check SANITIZER=address,undefined
|
|
make clean && make check CC=x86_64-w64-mingw32-gcc EXE=.exe RUNNER=wine
|
|
make clean
|
|
|
|
|
|
|
|
- name: Native MP4 mux (ASan + UBSan, mingw-w64)
|
|
shell: bash
|
|
working-directory: samples/record/mp4_mux
|
|
run: |
|
|
set -eu
|
|
. "$GITHUB_WORKSPACE/.github/workflows/scripts/wine-server.sh"
|
|
make clean && make -j$(nproc) check SANITIZER=address,undefined
|
|
make clean && make -j$(nproc) check CC=x86_64-w64-mingw32-gcc EXE=.exe RUNNER=wine
|
|
make clean
|
|
|
|
- name: Native FLV mux (ASan + UBSan, mingw-w64)
|
|
shell: bash
|
|
working-directory: libretro-common/samples/formats/flv
|
|
run: |
|
|
set -eu
|
|
. "$GITHUB_WORKSPACE/.github/workflows/scripts/wine-server.sh"
|
|
make clean && make check stream-check SANITIZER=address,undefined
|
|
make clean && make check stream-check CC=x86_64-w64-mingw32-gcc EXE=.exe RUNNER=wine
|
|
make clean
|
|
|
|
- name: Media Foundation AAC portable and cross builds
|
|
shell: bash
|
|
working-directory: samples/record/mf_audio
|
|
run: |
|
|
set -eu
|
|
make clean all SANITIZER=address,undefined
|
|
make clean all CC=x86_64-w64-mingw32-gcc EXE=.exe
|
|
x86_64-w64-mingw32-objdump -p encode_test.exe > imports.txt
|
|
if grep -Ei 'DLL Name:.*(mfplat|mfaacenc|ole32)\.dll' imports.txt; then
|
|
echo 'Native AAC must load optional entry points at runtime'
|
|
exit 1
|
|
fi
|
|
make clean
|
|
|
|
- name: Pollable producer wake (Clang ASan + UBSan, mingw-w64)
|
|
shell: bash
|
|
working-directory: libretro-common/samples/net/wake
|
|
run: |
|
|
set -eu
|
|
. "$GITHUB_WORKSPACE/.github/workflows/scripts/wine-server.sh"
|
|
make clean && make check CC=clang SANITIZER=address,undefined
|
|
make clean && make check CC=x86_64-w64-mingw32-gcc EXE=.exe RUNNER=wine
|
|
make clean
|
|
|
|
- name: RTMP protocol and sockets (ASan + UBSan, TSan, mingw-w64)
|
|
shell: bash
|
|
working-directory: libretro-common/samples/net/rtmp
|
|
run: |
|
|
set -eu
|
|
. "$GITHUB_WORKSPACE/.github/workflows/scripts/wine-server.sh"
|
|
make clean && make rtmp_handshake_test CC=clang SANITIZER=address,undefined
|
|
./rtmp_handshake_test
|
|
make clean && make check peer-check SANITIZER=address,undefined
|
|
make rtmps_socket_native_test SANITIZER=address,undefined
|
|
python3 media_peer.py --mux --tls 1.2 ./rtmps_socket_native_test
|
|
python3 media_peer.py --mux --tls 1.3 ./rtmps_socket_native_test
|
|
make rtmps_client_native_test SANITIZER=address,undefined
|
|
python3 media_peer.py --caps --mux --tls 1.2 ./rtmps_client_native_test
|
|
python3 media_peer.py --caps --mux --tls 1.3 ./rtmps_client_native_test
|
|
python3 media_peer.py --codec av1 --caps --mux --tls 1.2 ./rtmps_client_native_test
|
|
python3 media_peer.py --codec av1 --caps --mux --tls 1.3 ./rtmps_client_native_test
|
|
python3 media_peer.py --codec hevc --caps --mux --tls 1.2 ./rtmps_client_native_test
|
|
python3 media_peer.py --codec hevc --caps --mux --tls 1.3 ./rtmps_client_native_test
|
|
make clean && make rtmp_resolve_native_test SANITIZER=thread
|
|
TSAN_OPTIONS=halt_on_error=1 timeout 30 ./rtmp_resolve_native_test
|
|
make clean && make check peer-check CC=x86_64-w64-mingw32-gcc EXE=.exe RUNNER=wine
|
|
make rtmps_socket_native_test.exe CC=x86_64-w64-mingw32-gcc EXE=.exe
|
|
python3 media_peer.py --runner wine --mux --tls 1.2 ./rtmps_socket_native_test.exe
|
|
python3 media_peer.py --runner wine --mux --tls 1.3 ./rtmps_socket_native_test.exe
|
|
make rtmps_client_native_test.exe CC=x86_64-w64-mingw32-gcc EXE=.exe
|
|
python3 media_peer.py --runner wine --caps --mux --tls 1.2 ./rtmps_client_native_test.exe
|
|
python3 media_peer.py --runner wine --caps --mux --tls 1.3 ./rtmps_client_native_test.exe
|
|
python3 media_peer.py --runner wine --codec av1 --caps --mux --tls 1.2 ./rtmps_client_native_test.exe
|
|
python3 media_peer.py --runner wine --codec av1 --caps --mux --tls 1.3 ./rtmps_client_native_test.exe
|
|
python3 media_peer.py --runner wine --codec hevc --caps --mux --tls 1.2 ./rtmps_client_native_test.exe
|
|
python3 media_peer.py --runner wine --codec hevc --caps --mux --tls 1.3 ./rtmps_client_native_test.exe
|
|
make clean
|
|
|
|
- name: Native encoder stream ownership contracts
|
|
working-directory: samples/record/rtmp_stream
|
|
run: |
|
|
set -eu
|
|
. "$GITHUB_WORKSPACE/.github/workflows/scripts/wine-server.sh"
|
|
make clean check SANITIZER=address,undefined
|
|
make clean vt_thread_test SANITIZER=thread
|
|
TSAN_OPTIONS=halt_on_error=1 timeout 120 ./vt_thread_test
|
|
make clean check CC=x86_64-w64-mingw32-gcc EXE=.exe RUNNER=wine
|
|
make clean
|
|
|
|
- name: GPU PCM output pipeline (ASan + UBSan, TSan, mingw-w64)
|
|
working-directory: samples/record/gpu_av_output
|
|
run: |
|
|
set -eu
|
|
. "$GITHUB_WORKSPACE/.github/workflows/scripts/wine-server.sh"
|
|
make clean && make -j$(nproc) check SANITIZER=address,undefined
|
|
make clean && make thread_test session_test vulkan_thread_test vulkan_session_thread_test vulkan_dispatch_test SANITIZER=thread
|
|
TSAN_OPTIONS=halt_on_error=1 timeout 120 ./thread_test
|
|
TSAN_OPTIONS=halt_on_error=1 timeout 120 ./session_test
|
|
TSAN_OPTIONS=halt_on_error=1 timeout 120 ./vulkan_thread_test
|
|
TSAN_OPTIONS=halt_on_error=1 timeout 120 ./vulkan_session_thread_test
|
|
TSAN_OPTIONS=halt_on_error=1 timeout 120 ./vulkan_dispatch_test
|
|
make clean && make -j$(nproc) check CC=x86_64-w64-mingw32-gcc EXE=.exe RUNNER=wine
|
|
make clean
|
|
|
|
- name: GPU recording dispatcher (ASan + UBSan, TSan, mingw-w64)
|
|
working-directory: samples/record/gpu_dispatch
|
|
run: |
|
|
set -eu
|
|
make clean && make check SANITIZER=address,undefined
|
|
make clean && make dispatch_test session_integration SANITIZER=thread
|
|
TSAN_OPTIONS=halt_on_error=1 timeout 120 ./dispatch_test
|
|
TSAN_OPTIONS=halt_on_error=1 timeout 120 ./session_integration
|
|
# one Wine server for the three tests: one each, a test that
|
|
# starts as the last server leaves is cut off before main()
|
|
wineserver -p
|
|
trap 'wineserver -k || true' EXIT
|
|
make clean && make check CC=x86_64-w64-mingw32-gcc EXE=.exe RUNNER=wine
|
|
make clean
|
|
|
|
- name: Native recording frontend clock and PCM (ASan + UBSan, mingw-w64)
|
|
working-directory: samples/record/nvenc_frontend
|
|
run: |
|
|
set -eu
|
|
. "$GITHUB_WORKSPACE/.github/workflows/scripts/wine-server.sh"
|
|
make clean && make check SANITIZER=address,undefined
|
|
make clean && make check CC=x86_64-w64-mingw32-gcc EXE=.exe RUNNER=wine
|
|
make clean
|
|
|
|
- name: Vulkan recording frontend admission and retirement (sanitizers, mingw-w64)
|
|
working-directory: samples/record/vulkan_frontend
|
|
run: |
|
|
set -eu
|
|
. "$GITHUB_WORKSPACE/.github/workflows/scripts/wine-server.sh"
|
|
make clean && make check SANITIZER=address,undefined
|
|
make clean && make check CC=clang SANITIZER=address,undefined
|
|
make clean && make check CC=x86_64-w64-mingw32-gcc EXE=.exe RUNNER=wine
|
|
make clean
|
|
|
|
- name: AudioToolbox AAC input and packet ownership contracts
|
|
working-directory: samples/record/audiotoolbox_audio
|
|
run: |
|
|
set -eu
|
|
. "$GITHUB_WORKSPACE/.github/workflows/scripts/wine-server.sh"
|
|
make clean && make check CC=clang
|
|
make clean && make check SANITIZER=address,undefined
|
|
make clean && make check CC=x86_64-w64-mingw32-gcc EXE=.exe RUNNER=wine
|
|
make clean
|
|
|
|
# The Apple API stand-in checks ownership/configuration only. Native
|
|
# compilation and hardware encode run in MacOS-videotoolbox-encode.yml.
|
|
- name: VideoToolbox encode callback and session contracts
|
|
working-directory: samples/record/videotoolbox_encode
|
|
run: |
|
|
set -eu
|
|
. "$GITHUB_WORKSPACE/.github/workflows/scripts/wine-server.sh"
|
|
make clean && make check thread_test worker_thread_test audio_thread_test av_session_thread_test SANITIZER=address,undefined
|
|
./thread_test
|
|
./worker_thread_test
|
|
./audio_thread_test
|
|
./av_session_thread_test
|
|
make clean && make thread_test worker_thread_test audio_thread_test av_session_thread_test SANITIZER=thread
|
|
TSAN_OPTIONS=halt_on_error=1 timeout 120 ./thread_test
|
|
TSAN_OPTIONS=halt_on_error=1 timeout 120 ./worker_thread_test
|
|
TSAN_OPTIONS=halt_on_error=1 timeout 120 ./audio_thread_test
|
|
TSAN_OPTIONS=halt_on_error=1 timeout 120 ./av_session_thread_test
|
|
make clean && make check CC=x86_64-w64-mingw32-gcc EXE=.exe RUNNER=wine
|
|
make clean
|
|
|
|
- name: ccache statistics
|
|
if: ${{ !cancelled() }}
|
|
continue-on-error: true
|
|
run: ccache -sv
|
|
|
|
- name: Save ccache
|
|
# Only master's pushes keep a cache: pull requests restore
|
|
# master's, so one push does not evict the next one's.
|
|
if: success() && github.event_name == 'push' && github.ref == 'refs/heads/master'
|
|
uses: actions/cache/save@v4
|
|
with:
|
|
path: ~/.ccache
|
|
key: ccache-${{ github.workflow }}-${{ github.job }}-${{ github.sha }}
|
|
|
|
mf-audio-native:
|
|
name: Native Windows AAC packets and source clock
|
|
runs-on: windows-latest
|
|
timeout-minutes: 15
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v5
|
|
|
|
- name: Ensure the server media component is installed
|
|
shell: pwsh
|
|
run: |
|
|
if ((Get-CimInstance Win32_OperatingSystem).ProductType -ne 1) {
|
|
$feature = Get-WindowsFeature Server-Media-Foundation -ErrorAction Stop
|
|
if (-not $feature.Installed) {
|
|
$result = Install-WindowsFeature Server-Media-Foundation -ErrorAction Stop
|
|
if (-not $result.Success) { throw 'Media Foundation installation failed' }
|
|
}
|
|
}
|
|
|
|
- name: Native compiler and independent decoder
|
|
uses: msys2/setup-msys2@v2
|
|
with:
|
|
msystem: MINGW64
|
|
update: false
|
|
install: make mingw-w64-x86_64-gcc mingw-w64-x86_64-python mingw-w64-x86_64-ffmpeg
|
|
|
|
- name: Encode and independently decode native AAC
|
|
shell: msys2 {0}
|
|
working-directory: samples/record/mf_audio
|
|
run: |
|
|
set -eu
|
|
make clean native-check CC=gcc EXE=.exe
|
|
objdump -p encode_test.exe > imports.txt
|
|
if grep -Ei 'DLL Name:.*(mfplat|mfaacenc|ole32)\.dll' imports.txt; then
|
|
echo 'Native AAC must load optional entry points at runtime'
|
|
exit 1
|
|
fi
|
|
make clean
|
|
|
|
- name: Native Metal frontend profiles and source clocks
|
|
shell: msys2 {0}
|
|
working-directory: samples/record/metal_frontend
|
|
run: |
|
|
set -eu
|
|
make clean
|
|
make check CC=gcc EXE=.exe
|
|
make clean
|
|
|
|
- name: Config include ownership and stack budget
|
|
shell: msys2 {0}
|
|
working-directory: libretro-common/samples/file/config_file
|
|
run: |
|
|
set -eu
|
|
make clean
|
|
make check CC=gcc EXE=.exe
|
|
make clean CC=gcc EXE=.exe
|
|
|
|
- name: Native streaming worker readiness and cancellation
|
|
shell: msys2 {0}
|
|
working-directory: samples/record/gpu_dispatch
|
|
run: |
|
|
set -eu
|
|
make clean
|
|
make stream_dispatch_test.exe CC=gcc EXE=.exe
|
|
./stream_dispatch_test.exe
|
|
make clean
|
|
|
|
- name: Native FLV source color metadata interoperability
|
|
shell: msys2 {0}
|
|
working-directory: libretro-common/samples/formats/flv
|
|
run: |
|
|
set -eu
|
|
make clean
|
|
make check stream-check CC=gcc EXE=.exe COLOR_METADATA_ORACLE=1
|
|
make clean
|