HLS input improvements
This commit is contained in:
parent
69f84d4409
commit
652835cedd
3 changed files with 21 additions and 6 deletions
|
@ -1135,6 +1135,13 @@ namespace TS{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
MEDIUM_MSG("Initialized track %zu as %s %s", idx, codec.c_str(), type.c_str());
|
MEDIUM_MSG("Initialized track %zu as %s %s", idx, codec.c_str(), type.c_str());
|
||||||
|
if (tid != INVALID_TRACK_ID){return;}
|
||||||
|
}
|
||||||
|
if (tid != INVALID_TRACK_ID){
|
||||||
|
WARN_MSG("Could not init track %zu!", tid);
|
||||||
|
for (std::map<size_t, uint32_t>::const_iterator it = pidToCodec.begin(); it != pidToCodec.end(); it++){
|
||||||
|
INFO_MSG("Track %zu (%" PRIu32 ") no match", it->first, it->second);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -324,7 +324,12 @@ namespace Mist{
|
||||||
}
|
}
|
||||||
if (currBuf->size() < offset + 188 + 188){return false;}
|
if (currBuf->size() < offset + 188 + 188){return false;}
|
||||||
}
|
}
|
||||||
offset += 188;
|
// First packet is at offset 0, not 188. Skip increment for this one.
|
||||||
|
if (!firstPacket){
|
||||||
|
offset += 188;
|
||||||
|
}else{
|
||||||
|
firstPacket = false;
|
||||||
|
}
|
||||||
packetPtr = *currBuf + offset;
|
packetPtr = *currBuf + offset;
|
||||||
if (!packetPtr || packetPtr[0] != 0x47){
|
if (!packetPtr || packetPtr[0] != 0x47){
|
||||||
FAIL_MSG("Not a valid TS packet: first byte %" PRIu8, packetPtr?(uint8_t)packetPtr[0]:0);
|
FAIL_MSG("Not a valid TS packet: first byte %" PRIu8, packetPtr?(uint8_t)packetPtr[0]:0);
|
||||||
|
@ -354,14 +359,16 @@ namespace Mist{
|
||||||
hexIvec.c_str());
|
hexIvec.c_str());
|
||||||
|
|
||||||
offset = 0;
|
offset = 0;
|
||||||
|
firstPacket = true;
|
||||||
buffered = segBufs.count(entry.filename);
|
buffered = segBufs.count(entry.filename);
|
||||||
if (!buffered){
|
if (!buffered){
|
||||||
|
INFO_MSG("Reading non-cache: %s", entry.filename.c_str());
|
||||||
if (!segDL.open(entry.filename)){
|
if (!segDL.open(entry.filename)){
|
||||||
FAIL_MSG("Could not open %s", entry.filename.c_str());
|
FAIL_MSG("Could not open %s", entry.filename.c_str());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!segDL){return false;}
|
if (!segDL){return false;}
|
||||||
if (segBufs.size() > 60){
|
if (segBufs.size() > 30){
|
||||||
segBufs.erase(segBufAccs.back());
|
segBufs.erase(segBufAccs.back());
|
||||||
segBufAccs.pop_back();
|
segBufAccs.pop_back();
|
||||||
}
|
}
|
||||||
|
@ -848,7 +855,7 @@ namespace Mist{
|
||||||
}
|
}
|
||||||
entId++;
|
entId++;
|
||||||
allowRemap = true;
|
allowRemap = true;
|
||||||
while (!segDowner.atEnd() && config->is_active){
|
while ((!segDowner.atEnd() || tsStream.hasPacket()) && config->is_active){
|
||||||
// Wait for packets on each track to make sure the offset is set based on the earliest packet
|
// Wait for packets on each track to make sure the offset is set based on the earliest packet
|
||||||
hasPacket = tsStream.hasPacketOnEachTrack() || (segDowner.atEnd() && tsStream.hasPacket());
|
hasPacket = tsStream.hasPacketOnEachTrack() || (segDowner.atEnd() && tsStream.hasPacket());
|
||||||
if (hasPacket){
|
if (hasPacket){
|
||||||
|
@ -868,7 +875,7 @@ namespace Mist{
|
||||||
// keyframe data exists, so always add 19 bytes keyframedata.
|
// keyframe data exists, so always add 19 bytes keyframedata.
|
||||||
uint32_t packOffset = headerPack.hasMember("offset") ? headerPack.getInt("offset") : 0;
|
uint32_t packOffset = headerPack.hasMember("offset") ? headerPack.getInt("offset") : 0;
|
||||||
size_t packSendSize = 24 + (packOffset ? 17 : 0) + (entId >= 0 ? 15 : 0) + 19 + dataLen + 11;
|
size_t packSendSize = 24 + (packOffset ? 17 : 0) + (entId >= 0 ? 15 : 0) + 19 + dataLen + 11;
|
||||||
VERYHIGH_MSG("Adding packet (%zuB) at %" PRIu64 " with an offset of %" PRIu32 " on track %zu", dataLen, packetTime, packOffset, idx);
|
DONTEVEN_MSG("Adding packet (%zuB) at %" PRIu64 " with an offset of %" PRIu32 " on track %zu", dataLen, packetTime, packOffset, idx);
|
||||||
meta.update(packetTime, packOffset, idx, dataLen, entId, headerPack.hasMember("keyframe"), packSendSize);
|
meta.update(packetTime, packOffset, idx, dataLen, entId, headerPack.hasMember("keyframe"), packSendSize);
|
||||||
tsStream.getEarliestPacket(headerPack);
|
tsStream.getEarliestPacket(headerPack);
|
||||||
}
|
}
|
||||||
|
@ -884,7 +891,7 @@ namespace Mist{
|
||||||
DTSC::Packet headerPack;
|
DTSC::Packet headerPack;
|
||||||
tsStream.getEarliestPacket(headerPack);
|
tsStream.getEarliestPacket(headerPack);
|
||||||
while (headerPack){
|
while (headerPack){
|
||||||
int tmpTrackId = headerPack.getTrackId();
|
size_t tmpTrackId = headerPack.getTrackId();
|
||||||
uint64_t packetId = getPacketID(pListIt->first, tmpTrackId);
|
uint64_t packetId = getPacketID(pListIt->first, tmpTrackId);
|
||||||
uint64_t packetTime = getPacketTime(headerPack.getTime(), tmpTrackId, pListIt->first, entryIt->mUTC);
|
uint64_t packetTime = getPacketTime(headerPack.getTime(), tmpTrackId, pListIt->first, entryIt->mUTC);
|
||||||
size_t idx = M.trackIDToIndex(packetId, getpid());
|
size_t idx = M.trackIDToIndex(packetId, getpid());
|
||||||
|
@ -897,7 +904,7 @@ namespace Mist{
|
||||||
// keyframe data exists, so always add 19 bytes keyframedata.
|
// keyframe data exists, so always add 19 bytes keyframedata.
|
||||||
uint32_t packOffset = headerPack.hasMember("offset") ? headerPack.getInt("offset") : 0;
|
uint32_t packOffset = headerPack.hasMember("offset") ? headerPack.getInt("offset") : 0;
|
||||||
size_t packSendSize = 24 + (packOffset ? 17 : 0) + (entId >= 0 ? 15 : 0) + 19 + dataLen + 11;
|
size_t packSendSize = 24 + (packOffset ? 17 : 0) + (entId >= 0 ? 15 : 0) + 19 + dataLen + 11;
|
||||||
VERYHIGH_MSG("Adding packet (%zuB) at %" PRIu64 " with an offset of %" PRIu32 " on track %zu", dataLen, packetTime, packOffset, idx);
|
DONTEVEN_MSG("Adding packet (%zuB) at %" PRIu64 " with an offset of %" PRIu32 " on track %zu", dataLen, packetTime, packOffset, idx);
|
||||||
meta.update(packetTime, packOffset, idx, dataLen, entId, headerPack.hasMember("keyframe"), packSendSize);
|
meta.update(packetTime, packOffset, idx, dataLen, entId, headerPack.hasMember("keyframe"), packSendSize);
|
||||||
tsStream.getEarliestPacket(headerPack);
|
tsStream.getEarliestPacket(headerPack);
|
||||||
}
|
}
|
||||||
|
|
|
@ -65,6 +65,7 @@ namespace Mist{
|
||||||
bool encrypted;
|
bool encrypted;
|
||||||
bool buffered;
|
bool buffered;
|
||||||
size_t offset;
|
size_t offset;
|
||||||
|
bool firstPacket;
|
||||||
Util::ResizeablePointer outData;
|
Util::ResizeablePointer outData;
|
||||||
Util::ResizeablePointer * currBuf;
|
Util::ResizeablePointer * currBuf;
|
||||||
size_t encOffset;
|
size_t encOffset;
|
||||||
|
|
Loading…
Add table
Reference in a new issue