Enable device-backed FFmpeg hardware decoding and verify exact RX queue accounting

This commit is contained in:
evgeny committed 2026-10-19 19:11:07 +02:00
1 parent 4bb2e42a7e
commit 8eb869e41c
2 files changed
+18 -3

No files matched your search

+8 -2
View File
@@ -15,6 +15,8 @@ static const struct call_video_ops *callbacks;
static void *callback_arg;
static unsigned accepted, allowance, offered;
static int concurrent;
static unsigned woken;
static void wake(void *arg) { assert(arg == &woken); ++woken; }
static struct call_video_frame extra;
struct call_session *test_session_find(struct call_ctx *ctx, uint64_t id) {
@@ -45,6 +47,7 @@ int main(void) {
assert(!call_video_port_attach(&inst));
struct call_video_caps caps = {0};
assert(!call_video_port_open(7, &caps)); uasync_poll(ua, 0);
assert(call_video_port_set_wake(7, wake, &woken));
assert(callbacks && callbacks->writable); callbacks->writable(callback_arg, 1);
uint8_t data[8][16]; struct call_video_frame frames[8];
for (unsigned i = 0; i < 8; ++i) {
@@ -70,12 +73,15 @@ int main(void) {
assert(!call_video_port_status(7, &status) && status.can_encode && !status.key_serial);
DEBUG_INFO(DEBUG_CATEGORY_CALL, "PASS video port: all 8 frames preserved across partial send and repeated busy; no KEY or spin");
for (unsigned i = 0; i < 8; ++i) { assert(callbacks->receive_ready(callback_arg, 16)); callbacks->frame(callback_arg, &frames[i]); }
assert(woken == 8 && !call_video_port_status(7, &status) && status.rx_frames == 8);
assert(!callbacks->receive_ready(callback_arg, 16));
for (unsigned i = 0; i < 8; ++i) {
struct call_video_frame f; assert(call_video_port_pull(7, &f) == 1 && f.frame_id == i + 1); u_free((void *)f.data);
assert(callbacks->receive_ready(callback_arg, 16) == (i == 7));
assert(callbacks->receive_ready(callback_arg, 16));
assert(!call_video_port_status(7, &status) && status.rx_frames == 7 - i);
}
DEBUG_INFO(DEBUG_CATEGORY_CALL, "PASS video port: full RX drains completely before resuming producer admission");
DEBUG_INFO(DEBUG_CATEGORY_CALL, "PASS video port: exact RX depth, one wake per frame, resume as soon as space is available");
assert(call_video_port_set_wake(7, NULL, NULL));
call_video_port_close(7); uasync_poll(ua, 0);
call_video_port_detach(&inst); uasync_poll(ua, 0);
uasync_destroy(ua, 0); return 0;
+10 -1
View File
@@ -7,7 +7,7 @@ SRC_DIR="$BUILD_DIR/src"
INSTALL_DIR="$BUILD_DIR/install"
JOBS=$(nproc 2>/dev/null || echo 4)
AMF_HEADERS_VERSION="${AMF_HEADERS_VERSION:-1.5.3}"
FFMPEG_PROFILE_MARKER="$INSTALL_DIR/share/utun-chatgui-ffmpeg-minimal-v4"
FFMPEG_PROFILE_MARKER="$INSTALL_DIR/share/utun-chatgui-ffmpeg-minimal-v5"
case "$(uname -s)" in
Linux) PLATFORM=linux ;;
@@ -273,11 +273,13 @@ for encoder in "${ENCODERS[@]}"; do CONFIGURE_ARGS+=("--enable-encoder=$encoder"
if [ "$PLATFORM" = "windows" ]; then
CONFIGURE_ARGS+=(
--enable-amf --enable-d3d11va
--enable-hwaccel=h264_d3d11va2 --enable-hwaccel=hevc_d3d11va2
--enable-encoder=h264_amf --enable-encoder=hevc_amf --enable-encoder=av1_amf
)
else
CONFIGURE_ARGS+=(
--enable-vaapi
--enable-hwaccel=h264_vaapi --enable-hwaccel=hevc_vaapi
--enable-encoder=h264_vaapi --enable-encoder=hevc_vaapi
--enable-encoder=vp9_vaapi --enable-encoder=av1_vaapi
)
@@ -287,6 +289,13 @@ fi
grep -Eq '^#define CONFIG_CBS_H265 1$' config.h || die "FFmpeg configure did not enable the HEVC header parser"
grep -Eq '^#define CONFIG_TRACE_HEADERS_BSF 1$' config_components.h || die "FFmpeg configure did not enable trace_headers"
if [ "$PLATFORM" = "windows" ]; then
grep -Eq '^#define CONFIG_H264_D3D11VA2_HWACCEL 1$' config_components.h || die "H.264 D3D11VA device decoder unavailable"
grep -Eq '^#define CONFIG_HEVC_D3D11VA2_HWACCEL 1$' config_components.h || die "HEVC D3D11VA device decoder unavailable"
else
grep -Eq '^#define CONFIG_H264_VAAPI_HWACCEL 1$' config_components.h || die "H.264 VAAPI decoder unavailable"
grep -Eq '^#define CONFIG_HEVC_VAAPI_HWACCEL 1$' config_components.h || die "HEVC VAAPI decoder unavailable"
fi
if [ "$PLATFORM" = "windows" ]; then
for encoder in CONFIG_H264_AMF_ENCODER CONFIG_HEVC_AMF_ENCODER; do