Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

Using VideoDecoder for security camera app leads to codec reclaimation

Đang mở
#889 6 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
5/5
Thời gian dự kiến
Hơn một tuần
Mức phù hợp với người mới
25/100
Loại issue
Tính năng
Độ rõ ràng
Cần làm rõ
Mức độ hoạt động
Đình trệ
Công nghệ
javascript
Lĩnh vực
audio-video-rtc, web-dev

Hướng nghiên cứu

Bắt đầu với phần thu hồi tài nguyên của WebCodecs và ví dụ samples/video-decode-display, sau đó so sánh hành vi được báo cáo trong các tab chạy nền với các yêu cầu của VideoDecoder. Để được xem là hoàn tất, cần có một giải pháp được thống nhất ở cấp đặc tả nhằm duy trì khả năng sử dụng các bộ giải mã trong nền mà không cần mã hóa âm thanh hoặc video, thay vì một thay đổi mã có phạm vi hẹp.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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.

Ngôn ngữ chính
HTML
Star
1.3k
Fork
192
Merge trung bình
14 giờ 40 phút
Pull request đã merge (30 ngày)
8

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của w3c/webcodecs

Tất cả issue của w3c/webcodecs

Issue tương tự

Thêm issue về Audio/Video & RTC

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.