AAC-LC LOAS/LATM sometimes leads to discarded/unplayable frames
The following two files have been demultiplexed from an error-free German DVB-T2 MPEG-TS recording:
The problematic file is equal to the working file, except that the first 40206 bytes have been discarded. Both files contain a frame-aligned LOAS/LATM stream with AAC-LC (so no SBR).
In both files the AudioSpecificConfig is not contained in the first audio frame (instead useSameConfig is set then), but in a later one. I'm not sure whether this has an impact here.
The multiplexing of the working file to mkv works fine, e.g. using:
mkvmerge aac_lc_latm_ok.aac -o aac_lc_latm_ok.mkv
The result file contains about two second of audio (97 frames), which makes sense.
With the problematic file, the text output of mkvmerge is the same. The result file however cannot be played (it should contain about one second of audio here). mkvinfo
here reports only three frames and also too large frame sizes.
When I add debug output to figure out whether LATM or ADTS is recognized (as far as I can see, a successful ADTS recognition doesn't have any debug output yet), it seems that ADTS is recognized here sometime during multiplexing for the problematic file. I actually wonder why the ADTS recognition sometimes is still successful here, as the LOAS stream consists of valid sync bits and frame lengths...
When I disable the ADTS recognition call by hand here, the result file can be played. But still many frames of the source file are discarded then; the result file only contains 17 frames.
I used the current Git version for testing, but this also applies to version 86.0 from your package sources.