Fix seek-to-end issues with very near-live outputs

This commit is contained in:
Thulinma 2016-07-29 09:48:43 +02:00
parent 2bdafc245d
commit bd174d6db0

View file

@ -488,6 +488,14 @@ namespace Mist {
} }
bool Output::seek(unsigned int tid, unsigned long long pos, bool getNextKey){ bool Output::seek(unsigned int tid, unsigned long long pos, bool getNextKey){
if (myMeta.live && myMeta.tracks[tid].lastms < pos){
unsigned int maxTime = 0;
while (myMeta.tracks[tid].lastms < pos && myConn && ++maxTime <= 20){
Util::wait(500);
stats();
updateMeta();
}
}
if (myMeta.tracks[tid].lastms < pos){ if (myMeta.tracks[tid].lastms < pos){
WARN_MSG("Aborting seek to %llums in track %u: past end of track (= %llums).", pos, tid, myMeta.tracks[tid].lastms); WARN_MSG("Aborting seek to %llums in track %u: past end of track (= %llums).", pos, tid, myMeta.tracks[tid].lastms);
selectedTracks.erase(tid); selectedTracks.erase(tid);