Merge branch 'development' into LTS_development

# Conflicts:
#	src/output/output_hls.cpp
This commit is contained in:
Thulinma 2020-07-13 17:06:23 +02:00
commit b7e6cbbf89
3 changed files with 9 additions and 11 deletions

View file

@ -383,8 +383,6 @@ namespace Mist {
return;
}
appleCompat = (H.GetHeader("User-Agent").find("iPad") != std::string::npos) || (H.GetHeader("User-Agent").find("iPod") != std::string::npos) || (H.GetHeader("User-Agent").find("iPhone") != std::string::npos);
bool VLCworkaround = false;
if (H.GetHeader("User-Agent").substr(0, 3) == "VLC") {
std::string vlcver = H.GetHeader("User-Agent").substr(4);

View file

@ -7,7 +7,6 @@ namespace Mist {
ts_from = 0;
setBlocking(true);
sendRepeatingHeaders = 0;
appleCompat=false;
lastHeaderTime = 0;
}
@ -70,13 +69,6 @@ namespace Mist {
size_t tmpDataLen = 0;
thisPacket.getString("data", dataPointer, tmpDataLen); //data
uint64_t dataLen = tmpDataLen;
//apple compatibility timestamp correction
if (appleCompat){
packTime -= ts_from;
if (Trk.type == "audio"){
packTime = 0;
}
}
packTime *= 90;
std::string bs;
//prepare bufferstring
@ -196,6 +188,15 @@ namespace Mist {
long unsigned int tempLen = dataLen;
if (Trk.codec == "AAC"){
tempLen += 7;
//Make sure TS timestamp is sample-aligned, if possible
uint32_t freq = Trk.rate;
uint64_t aacSamples = (packTime/90) * freq / 1000;
//round to nearest packet, assuming all 1024 samples (probably wrong, but meh)
aacSamples += 512;
aacSamples /= 1024;
aacSamples *= 1024;
//Get closest 90kHz clock time to perfect sample alignment
packTime = aacSamples * 90000 / freq;
}
bs = TS::Packet::getPESAudioLeadIn(tempLen, packTime, Trk.bps);
fillPacket(bs.data(), bs.size(), firstPack, video, keyframe, pkgPid, contPkg);

View file

@ -30,7 +30,6 @@ namespace Mist {
int contSDT;
unsigned int packCounter;
TS::Packet packData;
bool appleCompat;
uint64_t sendRepeatingHeaders; ///< Amount of ms between PAT/PMT. Zero means do not repeat.
uint64_t lastHeaderTime; ///< Timestamp last PAT/PMT were sent.
uint64_t ts_from; ///< Starting time to subtract from timestamps