Round down audio timestamps in PES packets, instead of rounding to nearest. Fixes HLS in Firefox.

This commit is contained in:
Thulinma 2020-11-13 21:59:18 +01:00
parent ecee86bb1b
commit 10be747522

View file

@ -155,11 +155,9 @@ namespace Mist{
// Make sure TS timestamp is sample-aligned, if possible
uint32_t freq = M.getRate(thisIdx);
if (freq){
uint64_t aacSamples = (packTime / 90) * freq / 1000;
uint64_t aacSamples = packTime * freq / 90000;
//round to nearest packet, assuming all 1024 samples (probably wrong, but meh)
aacSamples += 512;
aacSamples /= 1024;
aacSamples *= 1024;
aacSamples &= ~0x3FF;
//Get closest 90kHz clock time to perfect sample alignment
packTime = aacSamples * 90000 / freq;
}