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);
|
sprintf(id, "%s%lu", streamName.c_str(), trackId);
|
||||||
indexPages[trackId].init(id, 8 * 1024);
|
indexPages[trackId].init(id, 8 * 1024);
|
||||||
}
|
}
|
||||||
for (int i = 0; i < indexPages[trackId].len / 8; i++){
|
char * mpd = indexPages[trackId].mapped;
|
||||||
long amountKey = ntohl((((long long int*)indexPages[trackId].mapped)[i]) & 0xFFFFFFFF);
|
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;}
|
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){
|
if (tmpKey <= keyNum && ((tmpKey?tmpKey:1) + amountKey) > keyNum){
|
||||||
return tmpKey;
|
return tmpKey;
|
||||||
}
|
}
|
||||||
|
@ -479,9 +481,10 @@ namespace Mist {
|
||||||
DTSC::Packet tmpPack;
|
DTSC::Packet tmpPack;
|
||||||
tmpPack.reInit(curPages[tid].mapped + tmp.offset, 0, true);
|
tmpPack.reInit(curPages[tid].mapped + tmp.offset, 0, true);
|
||||||
tmp.time = tmpPack.getTime();
|
tmp.time = tmpPack.getTime();
|
||||||
|
char * mpd = curPages[tid].mapped;
|
||||||
while ((long long)tmp.time < pos && tmpPack){
|
while ((long long)tmp.time < pos && tmpPack){
|
||||||
tmp.offset += tmpPack.getDataLen();
|
tmp.offset += tmpPack.getDataLen();
|
||||||
tmpPack.reInit(curPages[tid].mapped + tmp.offset, 0, true);
|
tmpPack.reInit(mpd + tmp.offset, 0, true);
|
||||||
tmp.time = tmpPack.getTime();
|
tmp.time = tmpPack.getTime();
|
||||||
}
|
}
|
||||||
if (tmpPack){
|
if (tmpPack){
|
||||||
|
|
|
@ -91,7 +91,7 @@ namespace Mist {
|
||||||
OutHLS::OutHLS(Socket::Connection & conn) : HTTPOutput(conn) {
|
OutHLS::OutHLS(Socket::Connection & conn) : HTTPOutput(conn) {
|
||||||
haveAvcc = false;
|
haveAvcc = false;
|
||||||
realTime = 0;
|
realTime = 0;
|
||||||
myConn.setBlocking(true);
|
setBlocking(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
OutHLS::~OutHLS() {}
|
OutHLS::~OutHLS() {}
|
||||||
|
|
|
@ -191,6 +191,9 @@ namespace Mist {
|
||||||
DEBUG_MSG(DLVL_DONTEVEN, "onRequest");
|
DEBUG_MSG(DLVL_DONTEVEN, "onRequest");
|
||||||
onRequest();
|
onRequest();
|
||||||
}
|
}
|
||||||
|
if (!myConn.Received().size()){
|
||||||
|
Util::sleep(500);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
if (!isBlocking && !parseData){
|
if (!isBlocking && !parseData){
|
||||||
|
|
Loading…
Add table
Reference in a new issue