WS/MP4 reliability edits:

- Stream selecting now obeys new "maxdelay" capa entry
- Output::liveSeek now takes an optional bool argument to indicate only rate control should be applied (no seeking)
- dataWaitTimeout is now configurable per-output, defaults to the old 25s
- WS/MP4 uses the new liveSeek with rate-control only
- WS/MP4 uses the new dataWaitTimeout and sets it to 4.5s
- WS/MP4 uses the new maxdelay capa, sets it to 5s
- WS/MP4 will now auto-reselect tracks if a track is dropped for data wait timeout or disappeared from metadata reasons
- Added support for jitter information in WS/MP4 protocol
- Robustify sendWebsocketCodecData being ran when sendHeader is ran
- Fix race condition when switching video tracks before previous video track has sent a single frame
This commit is contained in:
Thulinma 2021-07-08 14:02:50 +02:00
parent a0eb42f1dd
commit 200e1e4a1c
6 changed files with 113 additions and 73 deletions

View file

@ -86,6 +86,7 @@ namespace Mist{
}
Output::Output(Socket::Connection &conn) : myConn(conn){
dataWaitTimeout = 2500;
pushing = false;
recursingSync = false;
firstTime = 0;
@ -1097,7 +1098,7 @@ namespace Mist{
/// This function attempts to forward playback in live streams to a more live point.
/// It seeks to the last sync'ed keyframe of the main track, no closer than needsLookAhead+minKeepAway ms from the end.
/// Aborts if not live, there is no main track or it has no keyframes.
bool Output::liveSeek(){
bool Output::liveSeek(bool rateOnly){
if (!realTime){return false;}//Makes no sense when playing in turbo mode
uint64_t seekPos = 0;
if (!meta.getLive()){return false;}
@ -1113,7 +1114,7 @@ namespace Mist{
if (lMs - mKa - needsLookAhead - extraKeepAway > cTime + 50){
// We need to speed up!
uint64_t diff = (lMs - mKa - needsLookAhead - extraKeepAway) - cTime;
if (diff > 3000){
if (!rateOnly && diff > 3000){
noReturn = true;
newSpeed = 1000;
}else if (diff > 1000){
@ -1687,7 +1688,7 @@ namespace Mist{
//Okay, there's no next page yet, and no next packet on this page either.
//That means we're waiting for data to show up, somewhere.
// after ~25 seconds, give up and drop the track.
if (++emptyCount >= 2500){
if (++emptyCount >= dataWaitTimeout){
dropTrack(nxt.tid, "EOP: data wait timeout");
return false;
}