Do not cause a floating point exception during stream shutdown in TS-based outputs with AAC audio
This commit is contained in:
parent
84113218b8
commit
19840f32d4
1 changed files with 9 additions and 7 deletions
|
@ -190,13 +190,15 @@ namespace Mist {
|
||||||
tempLen += 7;
|
tempLen += 7;
|
||||||
//Make sure TS timestamp is sample-aligned, if possible
|
//Make sure TS timestamp is sample-aligned, if possible
|
||||||
uint32_t freq = Trk.rate;
|
uint32_t freq = Trk.rate;
|
||||||
uint64_t aacSamples = (packTime/90) * freq / 1000;
|
if (freq){
|
||||||
//round to nearest packet, assuming all 1024 samples (probably wrong, but meh)
|
uint64_t aacSamples = (packTime/90) * freq / 1000;
|
||||||
aacSamples += 512;
|
//round to nearest packet, assuming all 1024 samples (probably wrong, but meh)
|
||||||
aacSamples /= 1024;
|
aacSamples += 512;
|
||||||
aacSamples *= 1024;
|
aacSamples /= 1024;
|
||||||
//Get closest 90kHz clock time to perfect sample alignment
|
aacSamples *= 1024;
|
||||||
packTime = aacSamples * 90000 / freq;
|
//Get closest 90kHz clock time to perfect sample alignment
|
||||||
|
packTime = aacSamples * 90000 / freq;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
bs = TS::Packet::getPESAudioLeadIn(tempLen, packTime, Trk.bps);
|
bs = TS::Packet::getPESAudioLeadIn(tempLen, packTime, Trk.bps);
|
||||||
fillPacket(bs.data(), bs.size(), firstPack, video, keyframe, pkgPid, contPkg);
|
fillPacket(bs.data(), bs.size(), firstPack, video, keyframe, pkgPid, contPkg);
|
||||||
|
|
Loading…
Add table
Reference in a new issue