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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
//! Error types for the WebCodecs adapter.
use Cow;
use Error;
use ;
/// A WebCodecs / DOM error captured from a `JsValue`. JS errors
/// don't carry a stable Rust type, so we stringify at the boundary
/// and keep the message; consumers needing the original
/// [`web_sys::DomException`] can downcast `JsValue` themselves.
///
/// The message is a `Cow<'static, str>` rather than a `String` so
/// allocation-failure error paths can construct an `Error` without
/// touching the allocator. Codex round 22 flagged that the OOM
/// handlers in `copy_video_frame` and `copy_audio_data` were
/// allocating a formatted `String` (and then a JS string and another
/// `Error`-internal `String`) at the exact moment the global
/// allocator had just refused a request, which can panic and abort
/// the wasm tab. With this `Cow`, [`Error::from_static`] takes a
/// `&'static str` and clones it as `Cow::Borrowed`, no allocation.
/// Errors from [`crate::WebCodecsVideoStreamDecoder`] — **faults
/// only**.
///
/// Three arms used to live here that were not faults at all.
/// `NoFrameReady` and `Eof` are
/// [`Received::NeedsInput`](mediadecode::Received) and
/// [`Received::Ended`](mediadecode::Received) now, and `OutputFull` is
/// [`Sent::MustDrain`](mediadecode::Sent) — so a consumer generic over
/// the traits reads the same protocol from this backend as from any
/// other. This adapter had the family's only complete four-arm
/// vocabulary, and that was the problem rather than the fix: the
/// vocabulary belonged one tier up, where every backend answers it.///
/// **Open fault taxonomy, so it is `#[non_exhaustive]`.** New ways to
/// fail are discovered — a browser version, a codec, a DOM exception
/// nobody has met — and a consumer that meets one it has never heard of
/// should take its generic-fault path, which is exactly what the
/// wildcard arm this attribute forces is for. The status vocabularies
/// opposite it, [`Sent`](mediadecode::Sent) and
/// [`Received`](mediadecode::Received), are exhaustive for the
/// mirror-image reason: their arms are the substrate's fixed state set,
/// and there the wildcard would be dead weight hiding a state a
/// consumer forgot.
/// Errors from [`crate::WebCodecsAudioStreamDecoder`] — **faults
/// only**. See [`VideoDecodeError`] for what left and why.///
/// **Open fault taxonomy, so it is `#[non_exhaustive]`.** New ways to
/// fail are discovered — a browser version, a codec, a DOM exception
/// nobody has met — and a consumer that meets one it has never heard of
/// should take its generic-fault path, which is exactly what the
/// wildcard arm this attribute forces is for. The status vocabularies
/// opposite it, [`Sent`](mediadecode::Sent) and
/// [`Received`](mediadecode::Received), are exhaustive for the
/// mirror-image reason: their arms are the substrate's fixed state set,
/// and there the wildcard would be dead weight hiding a state a
/// consumer forgot.