Repository navigation
VAAPI interop: accept VA surface ID 0 - #1532
Merged
Merged
Conversation
MythVAAPIInterop::VerifySurface() rejected a frame whose m_buffer was null and also returned 0 to signal failure. m_buffer holds the VASurfaceID cast to a pointer, and 0 is a valid surface ID: the Intel iHD driver issues it to the first surface created. FFmpeg preallocates the hardware frame pool in order and returns the frames to its LIFO free list in the same order, so surface 0 sits at the bottom of the list. It is handed out only when every surface is in use at once. When that happens, it stays in rotation and every frame decoded into it is silently dropped. The previous image is held for one extra frame, roughly every 12-15 frames (about 0.4 s for 1080i). With the VAAPI deinterlacer, the gap in frame numbers also triggers the discontinuity check, so the deinterlacer is destroyed and recreated every cycle. Use VA_INVALID_SURFACE as the failure value instead of 0, and stop treating a null m_buffer as an invalid VAAPI frame. Also use VA_INVALID_SURFACE for the "no last filtered frame" state in the deinterlacer, so a filtered surface with ID 0 is handled the same way. Fixes MythTV#1530 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
MythVAAPIInterop::VerifySurface() rejected a frame whose m_buffer was null and also returned 0 to signal failure. m_buffer holds the VASurfaceID cast to a pointer, and 0 is a valid surface ID: the Intel iHD driver issues it to the first surface created.
FFmpeg preallocates the hardware frame pool in order and returns the frames to its LIFO free list in the same order, so surface 0 sits at the bottom of the list. It is handed out only when every surface is in use at once. When that happens, it stays in rotation and every frame decoded into it is silently dropped. The previous image is held for one extra frame, roughly every 12-15 frames (about 0.4 s for 1080i). With the VAAPI deinterlacer, the gap in frame numbers also triggers the discontinuity check, so the deinterlacer is destroyed and recreated every cycle.
Use VA_INVALID_SURFACE as the failure value instead of 0, and stop treating a null m_buffer as an invalid VAAPI frame. Also use VA_INVALID_SURFACE for the "no last filtered frame" state in the deinterlacer, so a filtered surface with ID 0 is handled the same way.
Fixes #1530
Testing
qt5CMake preset (Debug), with VAAPI (DRM, GLX, X11) and EGL enabled. libmythtv and mythfrontend compile and link. The three changed files produce no warnings under the project's flags (-Wall -Wextra -Wshadow -Wnull-dereferenceand others).Original Template
Thank you for contributing to MythTV!
Please review the checklist below to ensure that your contribution
to MythTV is ready for review by our developers.
It is helpful to regularly rebase your pull request to ensure changes
apply cleanly to the current MythTV development branch.
Checklist