Fixed HLS live playback on Apple devices, by resetting internal timestamps to zero for the beginning of all segments.

This commit is contained in:
Thulinma 2015-08-04 11:34:51 +02:00
parent d2241886e5
commit 45e82e76eb
3 changed files with 5 additions and 7 deletions

View file

@ -225,6 +225,7 @@ namespace Mist {
}
seek(from);
ts_from = from;
lastVid = from * 90;
H.SetHeader("Content-Type", "video/mp2t");

View file

@ -4,6 +4,7 @@ namespace Mist {
TSOutput::TSOutput(Socket::Connection & conn) : TS_BASECLASS(conn){
packCounter=0;
haveAvcc = false;
ts_from = 0;
until=0xFFFFFFFFFFFFFFFFull;
setBlocking(true);
sendRepeatingHeaders = false;
@ -92,7 +93,7 @@ namespace Mist {
while (currPack <= splitCount){
unsigned int alreadySent = 0;
bs = TS::Packet::getPESVideoLeadIn((currPack != splitCount ? watKunnenWeIn1Ding : dataLen+extraSize - currPack*watKunnenWeIn1Ding), thisPacket.getTime() * 90, thisPacket.getInt("offset") * 90, !currPack);
bs = TS::Packet::getPESVideoLeadIn((currPack != splitCount ? watKunnenWeIn1Ding : dataLen+extraSize - currPack*watKunnenWeIn1Ding), (thisPacket.getTime() - ts_from) * 90, thisPacket.getInt("offset") * 90, !currPack);
fillPacket(bs.data(), bs.size());
if (!currPack){
if (myMeta.tracks[thisPacket.getTrackId()].codec == "H264" && (dataPointer[4] & 0x1f) != 0x09){
@ -161,13 +162,8 @@ namespace Mist {
if (appleCompat){
tempTime = 0;// myMeta.tracks[thisPacket.getTrackId()].rate / 1000;
}else{
tempTime = thisPacket.getTime() * 90;
tempTime = (thisPacket.getTime() - ts_from) * 90;
}
///\todo stuur 70ms aan audio per PES pakket om applecompat overbodig te maken.
//static unsigned long long lastSent=thisPacket.getTime() * 90;
//if( (thisPacket.getTime() * 90)-lastSent >= 70*90 ){
// lastSent=(thisPacket.getTime() * 90);
//}
bs = TS::Packet::getPESAudioLeadIn(tempLen, tempTime);// myMeta.tracks[thisPacket.getTrackId()].rate / 1000 );
fillPacket(bs.data(), bs.size());
if (myMeta.tracks[thisPacket.getTrackId()].codec == "AAC"){

View file

@ -26,6 +26,7 @@ namespace Mist {
MP4::AVCC avccbox;
bool appleCompat;
bool sendRepeatingHeaders;
long long unsigned int ts_from;
long long unsigned int until;
long long unsigned int lastVid;
};