1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
//! What a decoder is made with and what it takes.
use Duration;
use VideoCodec;
use crateExternalSurface;
// How long `submit` waits for the decoder to take an access unit before it reports `Full`.
//
// On Android the wait is the timeout of `AMediaCodec_dequeueInputBuffer`, which returns the moment
// the codec has a free input buffer. On Apple the wait is a condition variable that the output
// callback signals when a unit leaves the eight in flight. On both the wait ends when the decoder
// finishes a unit.
//
// A refused unit breaks the reference chain of the pictures after it, so a refusal costs a
// keyframe. A client that streamed a 3840 by 2160 desktop to a Quest 3 measured a decode time of
// 5.9 ms on average and 15.9 ms at most. A wait of 4 ms, the former default, is shorter than the
// average decode. That client saw refusals at 4 ms and set 30 ms, which covers its longest decode
// with a margin.
//
// The wait blocks the thread that calls `submit`. That thread feeds the decoder. It is not the
// frame loop, which reads pictures through `DecodedFrames`. Those calls hold a lock for a few
// instructions and wait for no decode.
const INPUT_WAIT: Duration = from_millis;
/// Where a decoder puts its pictures.
/// What [`VideoDecoder::new`](super::VideoDecoder::new) makes a decoder from.
/// One picture's coded bytes, with the values that come back with the decoded picture.