Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

BUG: Video scorers block the event loop while decoding frames and audio

未关闭
#3,358 0 条评论 0 个 reaction 已指派 1 人 在 GitHub 查看

维护者通常 2 天内回复

@Shizoqua 已经在做这个了。

开始于 2026年10月20日。

  • #3359 来自 @Shizoqua —— 未关闭

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
35/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
停滞
技术栈
opencv, python

调研方向

Read pyrit/score/video_scorer.py and inspect _score_frames_async and _score_video_audio_async; compare with AudioTranscriptHelper._transcribe_audio_async, which already uses asyncio.to_thread. Check the scorer tests for coverage of frame and audio decoding. Done means OpenCV and PyAV decoding no longer block the event loop; linked pull request #3359 is already open.

由索引模型根据 Issue 内容生成。

描述

Describe the bug

VideoTrueFalseScorer and VideoFloatScaleScorer decode video directly on the event loop. In pyrit/score/video_scorer.py, _score_frames_async calls _extract_frames (OpenCV) and _score_video_audio_async calls AudioTranscriptHelper.extract_audio_from_video (PyAV) without asyncio.to_thread. While a video is decoded, every other attack, scorer and target request on the loop is frozen.

The style guide says cv2 and av calls must go through asyncio.to_thread, and AudioTranscriptHelper._transcribe_audio_async already does this.

Steps to Reproduce

Score a 1080p, 300-frame video with VideoTrueFalseScorer(num_sampled_frames=10) while a coroutine ticks every 10 ms with asyncio.sleep(0.01), and record the longest gap between ticks.

Expected Results

Ticks keep arriving about every 10 ms.

Actual Results

The longest gap is about 2.4 s. With the decodes moved to asyncio.to_thread, it drops to about 150 ms.

Versions

Linux, Python 3.13.16, PyRIT 1.2.0.dev0 from main (a799842b)

主要语言
Python
星标
4.6k
派生
962
平均合并
2 天 15 小时
30 天内合并 PR
398

环境准备

在 Codespaces 中打开

在浏览器里用你自己的 GitHub 账号启动这个项目的开发容器。

  • 没有 Dockerfile 或 Docker Compose 文件
  • 有 Pull Request 模板
  • 没有贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

microsoft/PyRIT 的其他 Issue

查看 microsoft/PyRIT 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。