Fix stopping behaviour for outgoing pushes when streams end.

This commit is contained in:
Thulinma 2016-05-26 12:48:52 +02:00
parent 4dffb10eb9
commit 9e245c2b51

View file

@ -547,9 +547,11 @@ namespace Mist {
}
MEDIUM_MSG("Seeking to %llums", pos);
for (std::set<long unsigned int>::iterator it = selectedTracks.begin(); it != selectedTracks.end(); it++){
if (myMeta.tracks.count(*it)){
seek(*it, pos);
}
}
}
bool Output::seek(unsigned int tid, unsigned long long pos, bool getNextKey){
if (myMeta.tracks[tid].lastms < pos){
@ -954,7 +956,7 @@ namespace Mist {
return 0;
}
for (std::set<long unsigned int>::iterator it = selectedTracks.begin(); it != selectedTracks.end(); it++){
if (myMeta.tracks[*it].type == "video"){
if (myMeta.tracks.count(*it) && myMeta.tracks[*it].type == "video"){
return *it;
}
}
@ -962,11 +964,16 @@ namespace Mist {
}
void Output::prepareNext(){
if (!myConn){return;}//stop if connection was closed
static bool atLivePoint = false;
static int nonVideoCount = 0;
if (!sought){
if (myMeta.live){
long unsigned int mainTrack = getMainSelectedTrack();
if (!myMeta.tracks.count(mainTrack)){
myConn.close();
return;
}
if (myMeta.tracks[mainTrack].keys.size() < 2){
if (!myMeta.tracks[mainTrack].keys.size()){
myConn.close();
@ -1002,6 +1009,12 @@ namespace Mist {
sortedPageInfo nxt = *(buffer.begin());
buffer.erase(buffer.begin());
if (!myMeta.tracks.count(nxt.tid)){
MEDIUM_MSG("Track %s@%u disappeared from stream - dropping.");
prepareNext();
return;
}
DEBUG_MSG(DLVL_DONTEVEN, "Loading track %u (next=%lu), %llu ms", nxt.tid, nxtKeyNum[nxt.tid], nxt.time);
if (nxt.offset >= nProxy.curPage[nxt.tid].len){