From c78cbc22eabd8a2dc4d6ce197fe2aea692f480e0 Mon Sep 17 00:00:00 2001 From: Thulinma Date: Thu, 7 Jul 2016 22:31:11 +0200 Subject: [PATCH] Fixed real-time playback of VoD streams that do not start at a zero timestamp --- src/output/output.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/output/output.cpp b/src/output/output.cpp index 2429e28a..4326cf3e 100644 --- a/src/output/output.cpp +++ b/src/output/output.cpp @@ -455,7 +455,6 @@ namespace Mist { /// Prepares all tracks from selectedTracks for seeking to the specified ms position. void Output::seek(unsigned long long pos){ sought = true; - firstTime = Util::getMS() - pos; if (!isInitialized){ initialize(); } @@ -471,6 +470,7 @@ namespace Mist { seek(*it, pos); } } + firstTime = Util::getMS() - buffer.begin()->time; } bool Output::seek(unsigned int tid, unsigned long long pos, bool getNextKey){ @@ -603,7 +603,7 @@ namespace Mist { //slow down processing, if real time speed is wanted if (realTime){ - while (thisPacket.getTime() > (((Util::getMS() - firstTime)*1000)+maxSkipAhead)/realTime) { + while (thisPacket.getTime() > (((Util::getMS() - firstTime)*1000)+maxSkipAhead)/realTime && config->is_active && myConn) { Util::sleep(std::min(thisPacket.getTime() - (((Util::getMS() - firstTime)*1000)+minSkipAhead)/realTime, 1000llu)); stats(); }