edith
Clone
https://git.tahinli.com/Tahinli/edith.git
0 watching0 forksRust18.3 MiBfbc29d1Tahinli2 months ago972 commits
| 1 | //! What an edit is allowed to tear down, and what it is not. |
| 2 | //! |
| 3 | //! Every setting a person can move while a timeline plays dirties *one* half of |
| 4 | //! the pipeline at most: a grade, a fit policy and the project resolution are |
| 5 | //! pictures, an equalizer is sound, and a fader is not even that -- it is a |
| 6 | //! number the running mixer picks up between two blocks. The tests here are the |
| 7 | //! measurement of that claim, and the thing they measure is the **audio tap**: |
| 8 | //! it is the sound the device was handed last, and a restart clears it (the |
| 9 | //! ring is flushed and nothing is fed again until a decoder has reopened, tens |
| 10 | //! of milliseconds later). An empty tap right after an edit therefore *is* the |
| 11 | //! hole in the sound the user reported hearing when they dragged a colour |
| 12 | //! slider. |
| 13 | //! |
| 14 | //! Every test runs anywhere: with no PipeWire daemon there is no device, no tap |
| 15 | //! and nothing to protect, so the audio assertions are made only when there is |
| 16 | //! sound to make them about -- the clock assertions run either way. |
| 17 | //! |
| 18 | //! ```text |
| 19 | //! cargo test -p engine --test invalidation -- --nocapture |
| 20 | //! ``` |
| 21 | |
| 22 | use ; |
| 23 | use sleep; |
| 24 | use Duration; |
| 25 | |
| 26 | use PlaybackSession; |
| 27 | use ColorParams; |
| 28 | use Limiter; |
| 29 | use Lane; |
| 30 | |
| 31 | |
| 32 | |
| 33 | |
| 34 | |
| 35 | |
| 36 | |
| 37 | /// Silent, like every other suite that plays a real file: these tests are about |
| 38 | /// whether the sound is *interrupted*, not about what it sounds like, and the |
| 39 | /// gain is the last multiply before the device -- everything measured here is |
| 40 | /// decoded, fed and counted exactly as it is when it is audible. |
| 41 | |
| 42 | |
| 43 | |
| 44 | |
| 45 | |
| 46 | |
| 47 | /// How many samples the device has been handed lately. `None` with no audio |
| 48 | /// device at all -- the machine's business, and nothing to assert about. |
| 49 | |
| 50 | |
| 51 | |
| 52 | |
| 53 | /// Plays until the device has really been handed something, so a later empty |
| 54 | /// tap means "this edit emptied it" rather than "it was never filled". |
| 55 | |
| 56 | |
| 57 | |
| 58 | |
| 59 | |
| 60 | |
| 61 | |
| 62 | |
| 63 | |
| 64 | |
| 65 | |
| 66 | |
| 67 | |
| 68 | |
| 69 | |
| 70 | |
| 71 | |
| 72 | /// A grade dragged while the timeline plays. The slider commits per pointer |
| 73 | /// sample (`set_color_live`), which used to reseek the whole session per |
| 74 | /// sample: an audio flush, an audio re-open and a video decoder rebuild, ~40 |
| 75 | /// times across one drag of the bar. The sound must not notice. |
| 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 | /// The project resolution, changed while the timeline plays -- the 4K film the |
| 122 | /// report came from. Every clip is recomposed onto the new canvas, which is a |
| 123 | /// video decoder rebuild and nothing else: no sample changes, so no sample may |
| 124 | /// be discarded and the clock may not be re-anchored (that re-anchor, onto an |
| 125 | /// empty ring, is what put the picture permanently ahead of the sound). |
| 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 | /// A fader and the master ceiling, moved while the timeline plays. Both live at |
| 174 | /// the mix and nowhere else, so a running mixer picks them up between blocks -- |
| 175 | /// nothing is flushed, nothing is reopened, and the picture does not blink. |
| 176 | /// |
| 177 | /// The *first* move is allowed one restart: a single audio lane at unity with |
| 178 | /// the limiter off is not mixed at all (the bit-exact path), so moving off it |
| 179 | /// is what opens a mixer. Every move after that is live, which is what an arrow |
| 180 | /// key held down on the mix card actually does. |
| 181 | |
| 182 | |
| 183 | |
| 184 | |
| 185 | |
| 186 | |
| 187 | |
| 188 | |
| 189 | |
| 190 | |
| 191 | |
| 192 | |
| 193 | |
| 194 | |
| 195 | |
| 196 | |
| 197 | |
| 198 | |
| 199 | |
| 200 | |
| 201 | |
| 202 | |
| 203 | |
| 204 | |
| 205 | |
| 206 | |
| 207 | |
| 208 | |
| 209 | |
| 210 | |
| 211 | |
| 212 | |
| 213 | |
| 214 | |
| 215 | |
| 216 | |
| 217 | |
| 218 | |
| 219 | |
| 220 | |
| 221 | /// The same rule on the timeline that has **no mixer at all**: one audio lane |
| 222 | /// at unity with the limiter off is the bit-exact single-stream path, and a |
| 223 | /// ceiling dragged while the limiter is *off* changes not one sample of it. |
| 224 | /// That drag used to reopen the sound at every nudge -- there was no mixer to |
| 225 | /// hand the number to, so the rebuild was the only way to apply a setting that |
| 226 | /// did not apply to anything. |
| 227 | /// |
| 228 | /// The device queue is the oracle, as above; the worker count is the second |
| 229 | /// one, because a rebuild is a feeder thread per nudge whether the ear catches |
| 230 | /// it or not. |
| 231 | |
| 232 | |
| 233 | |
| 234 | |
| 235 | |
| 236 | |
| 237 | |
| 238 | |
| 239 | |
| 240 | |
| 241 | |
| 242 | |
| 243 | |
| 244 | |
| 245 | |
| 246 | |
| 247 | |
| 248 | |
| 249 | |
| 250 | |
| 251 | |
| 252 | |
| 253 | |
| 254 | |
| 255 | |
| 256 | |
| 257 | |
| 258 | |
| 259 | |
| 260 | |
| 261 | |
| 262 | |
| 263 | |
| 264 | |
| 265 | /// The other half of the rule, and the one that makes it a *classification* |
| 266 | /// rather than a blanket "never rebuild": an equalizer really is a change to |
| 267 | /// the samples, so it does restart the audio -- and must leave the picture |
| 268 | /// alone while it does. |
| 269 | |
| 270 | |
| 271 | |
| 272 | |
| 273 | |
| 274 | |
| 275 | |
| 276 | |
| 277 | |
| 278 | |
| 279 | |
| 280 | |
| 281 | |
| 282 | |
| 283 | |
| 284 | |
| 285 | |
| 286 | |
| 287 | |
| 288 | |
| 289 | |
| 290 | |
| 291 | |
| 292 | |
| 293 | |
| 294 | |
| 295 | |
| 296 | |
| 297 | |
| 298 | /// The same classification asked at the one place it decides something a person |
| 299 | /// can see: **after the timeline has played out**. A sound edit rebuilds the |
| 300 | /// sound and starts no picture worker, so end of stream stands -- the last frame |
| 301 | /// is still the last frame, the transport is still `Ended`, and the next press |
| 302 | /// restarts from the top with the new curve on it. A revival here would spend |
| 303 | /// that state on an edit with nothing new to show, leaving a play press to run |
| 304 | /// the clock off the end instead of starting the film again. |
| 305 | |
| 306 | |
| 307 | |
| 308 | |
| 309 | |
| 310 | |
| 311 | |
| 312 | |
| 313 | |
| 314 | |
| 315 | |
| 316 | |
| 317 | |
| 318 | |
| 319 | |
| 320 | |
| 321 | |
| 322 | |
| 323 | |
| 324 | |
| 325 | |
| 326 | |
| 327 | |
| 328 | |
| 329 | |
| 330 | |
| 331 | |
| 332 | |
| 333 | |
| 334 | |
| 335 | |
| 336 | |
| 337 | |
| 338 | |
| 339 | |
| 340 | |
| 341 | |
| 342 | |
| 343 | |
| 344 | |
| 345 | |
| 346 | |
| 347 | |
| 348 | |
| 349 | |
| 350 | |
| 351 | |
| 352 |