Skip to content

demuxer: Fix demuxer assert logic and refactor FindFFmpeg#186

Open
crmurillo wants to merge 2 commits intoKhronosGroup:mainfrom
crmurillo:fix_ffmpeg_cmake
Open

demuxer: Fix demuxer assert logic and refactor FindFFmpeg#186
crmurillo wants to merge 2 commits intoKhronosGroup:mainfrom
crmurillo:fix_ffmpeg_cmake

Conversation

@crmurillo
Copy link
Copy Markdown
Contributor

Description

This PR addresses two issues:

  1. Logic inside the demuxer to detect errors in case FFmpeg is not found.

When FFmpeg is not found at build time and no codec is explicitly passed at runtime, codecType defaults to VK_VIDEO_CODEC_OPERATION_NONE_KHR. The assert() calls validating this are stripped in release builds, so the demuxer silently proceeds with invalid parameters and fails with a misleading "Video decode queue family not supported" error. See linked issue for more details.

  1. The cmake logic to detect FFmpeg and the relevant required libraries.

The FindFFmpeg.cmake module had two separate search passes for FFmpeg libraries: one via a custom FFMPEG_FIND macro and another via pkg_check_modules + find_library. It used FFMPEG as the pkg-config prefix, which caused pkg-config to overwrite the module's own output variables

Type of change

bug fix

Issue (optional)

Fixes #185.

Tests

NVIDIA GeForce RTX 4060 Ti / NVIDIA 595.44.00 / Ubuntu 24.04.4 LTS

Total Tests: 73
Passed: 62
Crashed: 0
Failed: 0
Not Supported: 9
Skipped: 2 (in skip list)
Success Rate: 100.0%

AMD Radeon RX 7600 (RADV NAVI33) / radv Mesa 26.1.0-devel (git-055aec542e) / Ubuntu 24.04.4 LTS

Total Tests: 73
Passed: 63
Crashed: 0
Failed: 0
Not Supported: 6
Skipped: 4 (in skip list)
Success Rate: 100.0%

Intel(R) UHD Graphics 770 (ADL-S GT1) / Intel open-source Mesa driver Mesa 26.1.0-devel (git-055aec542e) / Ubuntu 24.04.4 LTS

Total Tests: 73
Passed: 54
Crashed: 0
Failed: 0
Not Supported: 14
Skipped: 5 (in skip list)
Success Rate: 100.0%

…ions

The module searched for FFmpeg libraries twice (once via a macro, once via
pkg-config + find_library) and used "FFMPEG" as the pkg-config prefix, which
meant pkg-config wrote over the module's own output variables like
FFMPEG_FOUND and FFMPEG_LIBRARIES.

The following changes were made:
- Replace with a single search pass using PC_FFMPEG as the pkg-config prefix.
- Remove avdevice/x264/x265 since nothing links against them.
- Drop the outdated Win32 stdint.h check.
- Make swscale optional.
When FFmpeg is not found and no codec is explicitly passed, codecType
defaults to VK_VIDEO_CODEC_OPERATION_NONE_KHR). In release builds,
the asserts validating this are stripped, causing the demuxer to
silently proceed with invalid parameters and ultimately fail with a
misleading "Video decode queue family not supported by hardware/driver" error.

Replace asserts with explicit validation that returns
VK_ERROR_FORMAT_NOT_SUPPORTED with descriptive error messages. Also
print a hint when FFmpeg demuxer support is not available, since this
is the most common cause of the failure.
@crmurillo crmurillo changed the title Fix demuxer assert logic and refactor FindFFmpeg demuxer: Fix demuxer assert logic and refactor FindFFmpeg Mar 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] Demuxer behavior if FFmpeg is not found

1 participant