Fix for HLS URLs when only one track is available.

This commit is contained in:
Thulinma 2014-08-05 22:59:17 +02:00
parent 507eb80707
commit 875e8ef317
2 changed files with 18 additions and 12 deletions

View file

@ -52,11 +52,11 @@ namespace Controller {
}
return;
}
if (URL.substr(0, 4) == "push"){
if (URL.substr(0, 1) != "/"){
//push-style stream
if (hasViewers(name)){
data["meta"].null();
IPC::sharedPage streamIndex(name,0,false,false);
IPC::sharedPage streamIndex(name,8 * 1024 * 1024,false,false);
if (!streamIndex.mapped){
return;
}

View file

@ -221,17 +221,23 @@ namespace Mist {
std::string fmtStr = "/hls/" + streamName + "/%u_%u/%llu_%llu.ts";
long long unsigned int from;
if (sscanf(tmpStr.c_str(), fmtStr.c_str(), &vidTrack, &audTrack, &from, &until) != 4){
fmtStr = "/hls/" + streamName + "/%u/%llu_%llu.ts";
if (sscanf(tmpStr.c_str(), fmtStr.c_str(), &vidTrack, &from, &until) != 3){
WARN_MSG("Could not parse URL: %s", HTTP_R.getUrl().c_str());
HTTP_S.Clean();
HTTP_S.SetBody("The HLS URL wasn't understood - what did you want, exactly?\n");
myConn.SendNow(HTTP_S.BuildResponse("404", "URL mismatch"));
HTTP_R.Clean(); //clean for any possible next requests
continue;
}else{
selectedTracks.clear();
selectedTracks.insert(vidTrack);
}
DEBUG_MSG(DLVL_DEVEL, "Vid %u, Aud %u, From %llu, Until %llu", vidTrack, audTrack, from, until);
}else{
selectedTracks.clear();
selectedTracks.insert(vidTrack);
selectedTracks.insert(audTrack);
}
if (myMeta.live){
/// \todo Detection of out-of-range parts.