Skip to content

refactor: deduplicate VA-API decode loops between vaapi_h264.rs and vaapi_av1.rs #299

@staging-devin-ai-integration

Description

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.rsdrain_decoder_events, EAGAIN_YIELD_THRESHOLD
  • crates/nodes/src/video/vaapi_av1.rsdrain_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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions