added sleep in output_http, fix for high CPU usage

This commit is contained in:
wouter spruit 2015-02-25 14:27:15 +01:00 committed by Thulinma
parent a8deda2fab
commit bac101b1e5
3 changed files with 11 additions and 5 deletions

View file

@ -390,10 +390,12 @@ namespace Mist {
sprintf(id, "%s%lu", streamName.c_str(), trackId);
indexPages[trackId].init(id, 8 * 1024);
}
for (int i = 0; i < indexPages[trackId].len / 8; i++){
long amountKey = ntohl((((long long int*)indexPages[trackId].mapped)[i]) & 0xFFFFFFFF);
char * mpd = indexPages[trackId].mapped;
int len = indexPages[trackId].len / 8;
for (int i = 0; i < len; i++){
long amountKey = ntohl((((long long int*)mpd)[i]) & 0xFFFFFFFF);
if (amountKey == 0){continue;}
long tmpKey = ntohl(((((long long int*)indexPages[trackId].mapped)[i]) >> 32) & 0xFFFFFFFF);
long tmpKey = ntohl(((((long long int*)mpd)[i]) >> 32) & 0xFFFFFFFF);
if (tmpKey <= keyNum && ((tmpKey?tmpKey:1) + amountKey) > keyNum){
return tmpKey;
}
@ -479,9 +481,10 @@ namespace Mist {
DTSC::Packet tmpPack;
tmpPack.reInit(curPages[tid].mapped + tmp.offset, 0, true);
tmp.time = tmpPack.getTime();
char * mpd = curPages[tid].mapped;
while ((long long)tmp.time < pos && tmpPack){
tmp.offset += tmpPack.getDataLen();
tmpPack.reInit(curPages[tid].mapped + tmp.offset, 0, true);
tmpPack.reInit(mpd + tmp.offset, 0, true);
tmp.time = tmpPack.getTime();
}
if (tmpPack){

View file

@ -91,7 +91,7 @@ namespace Mist {
OutHLS::OutHLS(Socket::Connection & conn) : HTTPOutput(conn) {
haveAvcc = false;
realTime = 0;
myConn.setBlocking(true);
setBlocking(true);
}
OutHLS::~OutHLS() {}

View file

@ -191,6 +191,9 @@ namespace Mist {
DEBUG_MSG(DLVL_DONTEVEN, "onRequest");
onRequest();
}
if (!myConn.Received().size()){
Util::sleep(500);
}
}
}else{
if (!isBlocking && !parseData){