Repository navigation
Description
Reported by cmcpherson274 in #462, on a device TrueHD leg that played correctly from start to finish.
The bridge's silent-feed detector (AudioBridge.noteSilentFeedIfNeeded, AE#396) fires during normal start-up whenever the encoder is FLAC and the source packet is small, and says the session is about to fail:
[AudioBridge] ERROR: AE#396 the bridge has produced no encoded audio at all (mode=surroundCompat):
fed=64 decoded=64 enqueued=2560 emitted=0. The mp4 muxer can only build an AC-3/E-AC-3 sample entry
from a packet that was written, so this session will fail its first segment cut unless output starts.
The same run then cuts its first segment carrying that track and plays through.
The gate is counted in the wrong unit
silentFeedPacketThreshold is 64 source packets, and the comment that derives it names its two constants:
The largest encoder frame the bridge builds is 1536 samples (E-AC-3) and the smallest source packet it is fed is 512 (DTS), so three packets is the honest worst case before the first output and 64 is two orders past it.
Both are false on the FLAC arm, which has been in the same file since the mode landed (ec4723dc, 2026-05-22) and predates the gate (9870892c, 2026-08-18):
| encoder frame | source packet | packets before the first output is possible | |
|---|---|---|---|
| E-AC-3 arm | 1536 | 512 (DTS) … 1536 | 3 |
| FLAC arm | 4608 | 40 (TrueHD access unit) | 116 |
So on TrueHD the gate fires at 64, roughly half way to the first frame the encoder could build. enqueued=2560 is the proof in the reporter's own line: 2560 < 4608, the FIFO has not yet held one frame, drainFIFOIntoEncoder(requireFull: true) has correctly declined to encode, and nothing can have been emitted.
Deterministic, not a race, and it is not confined to the opt-in .lossless mode: .surroundCompat encodes any source of 2 channels or fewer to FLAC, so a stereo TrueHD file reproduces it on the default setting.
Repro
ffmpeg -f lavfi -i testsrc=size=1280x720:rate=25:duration=90 -f lavfi -i sine=frequency=440:duration=90 \
-map 0:v -map 1:a -c:v libx264 -preset ultrafast -g 50 -pix_fmt yuv420p \
-c:a truehd -strict -2 -ac 2 -ar 48000 truehd2.mkv
aetherctl play --seconds 20 file://$PWD/truehd2.mkv[AudioBridge] init: mode=surroundCompat encoder=flac srcCodec=86060 sampleRate=48000 sourceChannels=2 …
[AudioBridge] ERROR: AE#396 the bridge has produced no encoded audio at all (mode=surroundCompat):
fed=64 decoded=64 enqueued=2560 emitted=0. …
[AetherEngine] AE#462: audio delivery = bridged
[NativeAVPlayerHost] #1 item.audioTrack codec='flac' enabled=true sr=48000 ch=2 (readyToPlay)
t=20 state=playing phase=playing cur=20.20 … drop=0
Identical counters to the reporter's device log, on the default mode.
Blast radius
The line is the only thing that misreports. The two decision sites that read the same counters are both gated on an actual failure (HLSVideoEngine+LiveReopen.swift:206 on a pump death with muxerFailed, :632 on the exhausted revive), so a healthy start-up never reaches them, and $audioDelivery (#462) is derived independently and read bridged correctly throughout. What is wrong is the engine's own honesty surface: it announces a failure that is not happening, in an ERROR: line, on the one path a host is now expected to build a fallback ladder on.
Shape of the fix
A packet count cannot express "one encoder frame's worth of PCM", because the ratio between the two spans a factor of 100 across the arms the bridge already builds. The gate needs the encoder's own frame_size on the arm the encoder is on, and the packet count only where no sample count exists (the decoder never handed the FIFO anything, which is the original AE#396 shape).
Activity
Merge fix/ae396-silent-feed-startup-false-positive: count the silent-…
superuser404notfound commentedon Sep 3, 2026
Fixed in
b2583f34(PR #475), merged to main, not yet released.Each arm of the gate is now counted in the unit that bounds it: the encoder's own
frame_size(four frames) 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. That third shape was unreachable for the old gate in both directions.Four frames rather than one because the first is when output becomes possible and the second covers an encoder that holds it. It is still inside the first half second of source audio on every arm (128 ms on E-AC-3, 384 ms on FLAC at 48 kHz), so the line now arrives SOONER in wall clock than the 64-packet threshold it replaces on the arm that threshold was written for. FLAC's 4608 at 48 kHz measured rather than assumed (
ffprobe -show_entries frame=nb_sampleson a libavcodec FLAC encode).Measured on the fixture in the report: the ERROR line before, nothing after, 20 s of clean playback in both arms.
Limit: the decoder arm is pinned through the real bridge in tests, not in a session. No corruption that could be built here (the
noisebitstream filter at every byte, on MP3, AC-3 and TrueHD) makes libavcodec stop producing frames for a whole session.Staying open until it ships.
superuser404notfound commentedon Sep 3, 2026
Released in 6.67.0 as
b2583f34. Closing.