Summary
vaapi_h264.rs and vaapi_av1.rs share ~200 lines of nearly identical decode loop / drain_decoder_events logic, including the EAGAIN_YIELD_THRESHOLD backoff pattern. Similar patterns also exist in dav1d.rs and av1.rs.
Suggestion
Abstract the common decode loop into a generic vaapi_decode_loop<C>() function (or similar) to avoid maintaining multiple copies of the backoff logic in sync. This would reduce the risk of divergent bug fixes.
Files involved
crates/nodes/src/video/vaapi_h264.rs — drain_decoder_events, EAGAIN_YIELD_THRESHOLD
crates/nodes/src/video/vaapi_av1.rs — drain_decoder_events, EAGAIN_YIELD_THRESHOLD
crates/nodes/src/video/dav1d.rs — similar EAGAIN_YIELD_THRESHOLD pattern
crates/nodes/src/video/av1.rs — similar EAGAIN_YIELD_THRESHOLD pattern
Context
Identified during code review of PR #279 (custom VA-API H.264 encoder shim). Scoped out of that PR to keep changes focused.
Summary
vaapi_h264.rsandvaapi_av1.rsshare ~200 lines of nearly identical decode loop /drain_decoder_eventslogic, including theEAGAIN_YIELD_THRESHOLDbackoff pattern. Similar patterns also exist indav1d.rsandav1.rs.Suggestion
Abstract the common decode loop into a generic
vaapi_decode_loop<C>()function (or similar) to avoid maintaining multiple copies of the backoff logic in sync. This would reduce the risk of divergent bug fixes.Files involved
crates/nodes/src/video/vaapi_h264.rs—drain_decoder_events,EAGAIN_YIELD_THRESHOLDcrates/nodes/src/video/vaapi_av1.rs—drain_decoder_events,EAGAIN_YIELD_THRESHOLDcrates/nodes/src/video/dav1d.rs— similarEAGAIN_YIELD_THRESHOLDpatterncrates/nodes/src/video/av1.rs— similarEAGAIN_YIELD_THRESHOLDpatternContext
Identified during code review of PR #279 (custom VA-API H.264 encoder shim). Scoped out of that PR to keep changes focused.