Using VideoDecoder for security camera app leads to codec reclaimation
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 5/5
- 预计耗时
- 一周以上
- 新手友好度
- 25/100
- Issue 类型
- 功能
- 描述清晰度
- 需要澄清
- 活跃度
- 停滞
- 技术栈
- javascript
调研方向
从 WebCodecs 的资源回收部分和 samples/video-decode-display 示例开始,然后将报告的后台标签页行为与 VideoDecoder 的要求进行比较。要完成这项工作,需要达成一个规范层面的解决方案,在不进行音频或视频编码的情况下保持后台解码器可用,而不是进行范围狭窄的代码修改。
由索引模型根据 Issue 内容生成。
描述
As suggested in #121, I'm opening a new issue to discuss my use case.
I have just started using WebCodecs for a security camera application, and my VideoDecoders are getting reclaimed due to inactivity if the tab stays in the background for too long.
Use Case
The app is fairly simple, I spawn a single Worker which makes a WebSocket connection to the server. The server makes an RTSP connection to each of the configured cameras and then sends frames to the client through the WebSocket. The worker then uses VideoDecoders to draw the frames on canvases (essentially following this sample). It works really well until the I put the tab in the background. After a short while I get QuotaExceeded errors due to the "inactive" codecs being reclaimed.
I understand from these docs that the only way to keep an active VideoDecoder in the background from being reclaimed is to have an active VideoEncoder or an active AudioEncoder on the same global object. The problem for my use case is that these are security camera feeds that don't have audio (even if they did, I would only be decoding it).
You might ask what's the point of having a security camera app in a background tab? That's a good question. In common usage, you would expect to keep the app active all the time to view the video feeds. That said, in testing I have found that I often need to switch to another browser tab, and I imagine that will be the case at least some of the time in production.
Workarounds
Of course, there are a few workarounds I can implement. The simplest thing will be to watch for these errors and then attempt to restart the video streams when I run into them. The next idea is to run a dummy AudioEncoder of some kind in the Worker just to keep the VideoDecoders alive. But, it would be nice if there was a less hacky solution.
Solutions
I'm not sure what the best solution would be here. Maybe we can ask for user permission to run background video like we do for wake locks, location, etc.?
Also, it was suggested that I file a bug with Chromium since that's where I'm seeing this behavior. I'm happy to do that, but since the issue seems to be with the spec itself, I thought it would make sense to discuss it here first.
- 主要语言
- HTML
- 星标
- 1.3k
- 派生
- 192
- 平均合并
- 14 小时 40 分钟
- 30 天内合并 PR
- 8
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
w3c/webcodecs 的其他 Issue
-
privacy-needs-resolution
难度 1/5 1 小时以内 新手友好度 65/100
维护者通常 1 天内回复
-
editorial
难度 1/5 1 小时以内 新手友好度 68/100
维护者通常 1 天内回复
-
TPAC2026
难度 5/5 一周以上 新手友好度 8/100
维护者通常 1 天内回复
-
VideoFrame.copyTo is manipulating JS objects in a background queue可能已有人在做 @Djuffin 于 5 天前认领。 未关闭CR Blocking PR exists
难度 5/5 一周以上 新手友好度 30/100
w3c/webcodecs#955 · 8 条评论 · 已指派 1 人 ·
维护者通常 1 天内回复
-
ColorSpace override is not well defined可能已有人在做 @dalecurtis 于 38 天前认领。 未关闭agenda CR Blocking PR exists
w3c/webcodecs#940 · 25 条评论 · 已指派 1 人 ·
维护者通常 1 天内回复
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 67/100
wilbowes/EchoMuse#869 · 1 条评论 ·
维护者通常 1 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 82/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 72/100
-
area: editor bug
难度 2/5 1-3 小时 新手友好度 72/100
-
难度 2/5 1-3 小时 新手友好度 62/100
Sendspin/sendspin-python-cli#291 ·
维护者通常 6 天内回复