Repository navigation
FIX: Decode video frames and audio off the event loop in video scorers - #3359
Merged
Richard Lundeen (richlundeen) merged 3 commits intoOct 25, 2026
Conversation
Lanre Shittu (Shizoqua)
force-pushed
the
claude/wizardly-brahmagupta-5obhxm-video-scorer
branch
from
October 19, 2026 22:28
f8084c5 to
9bd0f3b
Compare
Richard Lundeen (richlundeen)
approved these changes
Oct 25, 2026
Richard Lundeen (richlundeen)
enabled auto-merge
October 25, 2026 07:52
Wait for off-loop audio extraction before propagating cancellation, then remove generated audio without deleting the source. Cover single and repeated cancellation with regression tests. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.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.
Description
Fixes #3358.
VideoHelperran its two media decodes directly on the event loop:_extract_frames(OpenCV) in_score_frames_async, andAudioTranscriptHelper.extract_audio_from_video(PyAV) in_score_video_audio_async. Both now run throughasyncio.to_thread, which is what the style guide asks for withcv2andavand whatAudioTranscriptHelper._transcribe_audio_asyncalready does for its own PyAV conversion.With the setup from the issue, the longest event loop stall while scoring a 1080p clip goes from about 2.4 s to about 150 ms. Scores, rationales and temp file cleanup are unchanged.
Tests and Documentation
Added
test_video_scorer_decodes_frames_and_audio_off_the_event_looptotests/unit/score/test_video_scorer.py. It wraps both extractors to record which thread they run on, scores the sample video with an image scorer and an audio scorer, and asserts that neither ran on the event loop thread. Existing video scorer tests are unchanged.No docs or notebooks changed, so JupyText was not needed.