On Mon Mar 24 20:12:01 2025 +0000, Nikolay Sivov wrote:
How stable are duration values? Is that encoded in the file or calculated? I'm worried about potentially failing tests.
It looks like they are calculated. For aac it's easy to calculate; it's just the number of samples in each frame (always 1024 for aac) divided by the sample rate (44.1kHz in this case). Then multiplied by 10,000,000 to get the 10<sup>-7</sup> second timescale. i.e. `1024÷44100×10000000=232199.546485261`. That must get rounded to 232,200.
For wma, I couldn't find great documentation. But Wikipedia states:
The bit stream of WMA is composed of superframes, each containing 1 or more frames of 2048 samples
The sample rate for the wma file is 22050Hz, but with two channels it's effectively 44.1kHz. So `2048÷44100×10000000=464399.092970522`. The test expects one of two values, 464399 or 928798. So one or two frames (at 464399 10<sup>-7</sup> seconds per frame). The number of frames is likely encoded in the file.