Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

VideoDecoder output guarantees

Aperta
#900 3 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
5/5
Tempo stimato
Più di una settimana
Idoneità per principianti
25/100
Tipo di issue
Funzionalità
Chiarezza
Abbastanza chiara
Stato di attività
Ferma

Direzione di ricerca

Inizia leggendo le sezioni della specifica di VideoDecoder che riguardano output, flush e optimizeForLatency. Confronta il loro comportamento previsto con le discussioni collegate nelle issue 650, 698 e 206, inclusa la questione della hardware acceleration. Il lavoro è completato quando l’issue documenta se i chiamanti possono sapere quando sono necessari altri pacchetti, in che modo l’ottimizzazione della latenza influisce sull’output e quali compromessi prestazionali sono rilevanti.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

My use case requires me to decode multiple video streams at the same time. The source files can be of extremely high bitrate, 4K videos, so I would like to be mindful of how I use the GPU.

My root issue is that I cannot find any guarantee of when I might receive a frame or when I need to send more data to the decoder. If I investigate the packets and check the P or B frames, I see no reason why a packet would not be sent to the output. When I call flush I receive frames in the output perfectly.

Based on that experience, I thought I could decode GOPs, then call flush. In terms of decoding the bare minimum it's far from optimal, but at least it gives me some guarantee of when I can receive a frame. However, this is not trivial to do either since I work with libav under the hood, what I consider a keyframe might not be accepted by WebCodecs. Same issue as described here. The idea of flush without invalidating whatever inner state it has seemed like a good idea to me.

The answer to my question could be the optimizeForLatency, as in the specification it seems to do exactly what I want. However, as I read the threads here, I am now confused on what it does and what it doesn't. As @dalecurtis mentioned here, in Chromium, this flag does not affect flush directly, just omits using threading which can hold back frames. According to another thread though, I got the impression this only applies to software decoders, not hardware-accelerated ones. Does this have an effect in hw-accelerated decoding? If so, what are the performance drawbacks to consider?

Very different in nature but what I love about FFmpeg/libav is that this is very trivial to do:

int ret = avcodec_receive_frame(decoder->codec_ctx, decoder->frame);
if (ret == AVERROR(EAGAIN)) {
  // I know the decoder needs more frames before it can give me something
}

To summarize, my question is how can I have a guarantee that I passed enough packets (or how can I know for sure that I didn't ) to the VideoDecoder to surely have an output? Ideally, I want to decode the smallest amount possible for a guaranteed output.

Lingua principale
HTML
Stelle
1.3k
Fork
192
Merge medio
3h 36m
PR unite (30g)
7

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di w3c/webcodecs

Tutte le issue di w3c/webcodecs

Issue simili

Altre issue su Backend & API Design

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.