Fixes hls crash on non-existing streams

This commit is contained in:
Erik Zandvliet 2017-10-20 14:23:29 +02:00 committed by Thulinma
parent 90c017bfcd
commit c1373fba17
2 changed files with 9 additions and 4 deletions

View file

@ -75,9 +75,6 @@ namespace Mist {
virtual void onFail();
virtual void requestHandler();
private://these *should* not be messed with in child classes.
inline bool keepGoing(){
return config->is_active && myConn;
}
std::map<unsigned long, unsigned int> currKeyOpen;
void loadPageForKey(long unsigned int trackId, long long int keyNum);
int pageNumForKey(long unsigned int trackId, long long int keyNum);
@ -119,6 +116,9 @@ namespace Mist {
void waitForStreamPushReady();
bool pushIsOngoing;
void bufferLivePacket(const DTSC::Packet & packet);
inline bool keepGoing(){
return config->is_active && myConn;
}
};
}

View file

@ -175,8 +175,13 @@ namespace Mist {
}
initialize();
if (!keepGoing()){
return;
}
if (H.url.find(".m3u") == std::string::npos){
std::string tmpStr = H.getUrl().substr(5+streamName.size());
std::string tmpStr = H.getUrl().substr(5 + streamName.size());
long long unsigned int from;
if (sscanf(tmpStr.c_str(), "/%u_%u/%llu_%llu.ts", &vidTrack, &audTrack, &from, &until) != 4){
if (sscanf(tmpStr.c_str(), "/%u/%llu_%llu.ts", &vidTrack, &from, &until) != 3){