Repository navigation
Commit b2583f3
fix(audio): count the silent-bridge gate in encoder frames, not source packets (#474)
The AE#396 detector fired during a healthy start-up on every TrueHD session
and announced a failure that was not happening:
[AudioBridge] ERROR: AE#396 the bridge has produced no encoded audio at all
(mode=surroundCompat): fed=64 decoded=64 enqueued=2560 emitted=0. ... this
session will fail its first segment cut unless output starts.
The threshold was 64 SOURCE PACKETS, but the quantity that bounds the encoder
arm is one ENCODER FRAME: drainFIFOIntoEncoder(requireFull:) cannot encode
below frame_size, so nothing can be emitted before that many samples have been
enqueued. Its derivation named its two constants, an E-AC-3 frame of 1536 and a
DTS packet of 512, and the FLAC arm breaks both: a FLAC frame is 4608 samples
and a TrueHD access unit is 40, so the first output needs 116 packets. The
enqueued=2560 in the reporter's own line is the proof, short of 4608 and short
of any output being possible. Not confined to the opt-in .lossless mode either,
.surroundCompat encodes two channels or fewer to FLAC.
Each arm is now counted in the unit that bounds it: the encoder's own
frame_size where PCM reached the FIFO, packets only where the FIFO never moved,
and the latter from the LAST accepted sample rather than from the start, so a
decoder that answers for a while and then stops is the same shape as one that
never answered. Four frames rather than one, because the first is when output
becomes possible and the second covers an encoder that holds it. The line
arrives sooner than before on the arm it was written for (128 ms of source
audio on E-AC-3 against 64 packets) and now names the encoder and the frame
boundary it judged.
Measured on media, both arms of the same fixture family: a stereo TrueHD MKV on
the default mode printed the ERROR at fed=64 before, prints nothing after, and
plays 20 s clean in both. The decoder arm is pinned through the real bridge in
tests (80 undecodable MP3 packets still report), because no corruption that
could be built here makes libavcodec stop producing frames for a whole session.
Nothing else read the threshold: both sites that classify a silent bridge are
gated on an actual failure (a pump death with muxerFailed, an exhausted revive),
so a healthy start-up never reached them, and $audioDelivery is derived
independently and read `bridged` correctly throughout.
Reported by @cmcpherson274 in #462.
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01Q4QpZDsHPJfbz5gkxxPXF71 parent d6f7c7d commit b2583f3
3 files changed
Lines changed: 235 additions & 17 deletions
File tree
- Sources/AetherEngine/Audio
- Tests/AetherEngineTests
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
29 | 48 | | |
30 | 49 | | |
31 | 50 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
478 | 478 | | |
479 | 479 | | |
480 | 480 | | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
481 | 486 | | |
482 | 487 | | |
483 | 488 | | |
| |||
519 | 524 | | |
520 | 525 | | |
521 | 526 | | |
522 | | - | |
| 527 | + | |
523 | 528 | | |
524 | | - | |
525 | | - | |
526 | | - | |
| 529 | + | |
| 530 | + | |
527 | 531 | | |
528 | 532 | | |
| 533 | + | |
| 534 | + | |
| 535 | + | |
| 536 | + | |
| 537 | + | |
| 538 | + | |
| 539 | + | |
| 540 | + | |
| 541 | + | |
| 542 | + | |
| 543 | + | |
| 544 | + | |
| 545 | + | |
| 546 | + | |
| 547 | + | |
| 548 | + | |
| 549 | + | |
| 550 | + | |
529 | 551 | | |
530 | 552 | | |
531 | 553 | | |
| |||
755 | 777 | | |
756 | 778 | | |
757 | 779 | | |
| 780 | + | |
758 | 781 | | |
759 | 782 | | |
760 | 783 | | |
| |||
839 | 862 | | |
840 | 863 | | |
841 | 864 | | |
842 | | - | |
| 865 | + | |
843 | 866 | | |
844 | 867 | | |
845 | 868 | | |
846 | | - | |
847 | | - | |
848 | | - | |
849 | | - | |
850 | | - | |
| 869 | + | |
| 870 | + | |
| 871 | + | |
| 872 | + | |
| 873 | + | |
| 874 | + | |
| 875 | + | |
| 876 | + | |
| 877 | + | |
| 878 | + | |
| 879 | + | |
| 880 | + | |
| 881 | + | |
| 882 | + | |
| 883 | + | |
| 884 | + | |
| 885 | + | |
| 886 | + | |
| 887 | + | |
| 888 | + | |
| 889 | + | |
851 | 890 | | |
852 | | - | |
853 | | - | |
| 891 | + | |
| 892 | + | |
854 | 893 | | |
| 894 | + | |
| 895 | + | |
855 | 896 | | |
856 | 897 | | |
857 | | - | |
858 | | - | |
859 | | - | |
| 898 | + | |
| 899 | + | |
| 900 | + | |
860 | 901 | | |
861 | 902 | | |
862 | 903 | | |
| |||
998 | 1039 | | |
999 | 1040 | | |
1000 | 1041 | | |
1001 | | - | |
| 1042 | + | |
| 1043 | + | |
| 1044 | + | |
| 1045 | + | |
1002 | 1046 | | |
1003 | 1047 | | |
1004 | 1048 | | |
| |||
1009 | 1053 | | |
1010 | 1054 | | |
1011 | 1055 | | |
1012 | | - | |
| 1056 | + | |
1013 | 1057 | | |
1014 | 1058 | | |
1015 | 1059 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
223 | 223 | | |
224 | 224 | | |
225 | 225 | | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 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 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 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 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 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 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
226 | 381 | | |
0 commit comments