Removed appleCompat mode from TS/HLS outputs, now sends identical segments to all client devices

This commit is contained in:
Thulinma 2020-07-13 16:16:40 +02:00
parent 90c9d16a32
commit 16bb689b7e
3 changed files with 9 additions and 10 deletions

View file

@ -184,7 +184,6 @@ namespace Mist {
}
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
@ -179,6 +171,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

@ -25,7 +25,6 @@ namespace Mist {
int contSDT;
unsigned int packCounter; ///\todo update constructors?
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