added sleep in output_http, fix for high CPU usage
This commit is contained in:
parent
a8deda2fab
commit
bac101b1e5
3 changed files with 11 additions and 5 deletions
|
@ -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){
|
||||
|
|
|
@ -91,7 +91,7 @@ namespace Mist {
|
|||
OutHLS::OutHLS(Socket::Connection & conn) : HTTPOutput(conn) {
|
||||
haveAvcc = false;
|
||||
realTime = 0;
|
||||
myConn.setBlocking(true);
|
||||
setBlocking(true);
|
||||
}
|
||||
|
||||
OutHLS::~OutHLS() {}
|
||||
|
|
|
@ -191,6 +191,9 @@ namespace Mist {
|
|||
DEBUG_MSG(DLVL_DONTEVEN, "onRequest");
|
||||
onRequest();
|
||||
}
|
||||
if (!myConn.Received().size()){
|
||||
Util::sleep(500);
|
||||
}
|
||||
}
|
||||
}else{
|
||||
if (!isBlocking && !parseData){
|
||||
|
|
Loading…
Add table
Reference in a new issue