This patch requires a patch from #1835 first.
This patch adds real-time bitrate estimation for raw AAC streams handled by the FAAD/AAC input plugin.
Currently, AAC stream bitrate may be missing or may depend on server-provided metadata. For live streams, server metadata such as icy-br can be absent, stale, misleading, or simply not representative of the actual encoded data being received. This is especially undesirable for VBR AAC streams.
The patch deliberately ignores server-provided bitrate metadata for AAC playback and instead estimates the bitrate from the actual decoded stream.
Implementation summary:
- Adds a small 3-second measurement window.
- Accumulates
NeAACDecFrameInfo::bytesconsumed, i.e. how many encoded bytes FAAD consumed.
- Accumulates decoded audio duration using
NeAACDecFrameInfo::samples, channels, and samplerate.
- Computes bitrate as:
encoded bytes consumed * 8 / decoded duration
- Calls
set_stream_bitrate() with the estimated runtime bitrate.
- Updates
Tuple::Bitrate so the playlist bitrate column can be populated during playback.
- Avoids excessive UI churn by only updating the tuple when the displayed bitrate changes by at least 5 kbit/s.
- Clears
Tuple::Bitrate initially if no reliable bitrate is known yet, so Audacious does not display server-provided or stale data before enough stream data has actually been decoded.
The intent is similar to classic Winamp-style real-time bitrate reporting: show the bitrate of the actual stream being decoded, rather than trusting headers or server metadata.
This is particularly useful for online AAC streams where the nominal server-advertised bitrate may not match the real stream, and for VBR AAC streams where bitrate naturally changes over time.
audacious-plugins-ffaudio-format-metadata-v2-streams.patch
This patch requires a patch from #1835 first.
This patch adds real-time bitrate estimation for raw AAC streams handled by the FAAD/AAC input plugin.
Currently, AAC stream bitrate may be missing or may depend on server-provided metadata. For live streams, server metadata such as
icy-brcan be absent, stale, misleading, or simply not representative of the actual encoded data being received. This is especially undesirable for VBR AAC streams.The patch deliberately ignores server-provided bitrate metadata for AAC playback and instead estimates the bitrate from the actual decoded stream.
Implementation summary:
NeAACDecFrameInfo::bytesconsumed, i.e. how many encoded bytes FAAD consumed.NeAACDecFrameInfo::samples,channels, andsamplerate.set_stream_bitrate()with the estimated runtime bitrate.Tuple::Bitrateso the playlist bitrate column can be populated during playback.Tuple::Bitrateinitially if no reliable bitrate is known yet, so Audacious does not display server-provided or stale data before enough stream data has actually been decoded.The intent is similar to classic Winamp-style real-time bitrate reporting: show the bitrate of the actual stream being decoded, rather than trusting headers or server metadata.
This is particularly useful for online AAC streams where the nominal server-advertised bitrate may not match the real stream, and for VBR AAC streams where bitrate naturally changes over time.
audacious-plugins-ffaudio-format-metadata-v2-streams.patch