Performance improvement by avoiding locks in cSatipTuner::ProcessApplicationData().

Don't use malloc, but put variable on stack (=local char array).
This avoids a possible lock with other threads, because malloc uses global
storage and needs a lock then.

Tests eliminated the long lasting processing of RTCP packaged in poller
Thread.
This commit is contained in:
nafets227 2014-11-29 19:16:59 +01:00 committed by Rolf Ahrenberg
parent 52f54d2177
commit 4600a2a070
1 changed files with 2 additions and 2 deletions

View File

@ -262,7 +262,8 @@ void cSatipTuner::ProcessApplicationData(u_char *bufferP, int lengthP)
// DVB-C2:
// ver=1.2;tuner=<feID>,<level>,<lock>,<quality>,<freq>,<bw>,<msys>,<mtype>,<sr>,<c2tft>,<ds>,<plp>,<specinv>;pids=<pid0>,...,<pidn>
if (lengthP > 0) {
char *s = strndup((char *)bufferP, lengthP);
char s[lengthP];
memcpy(s, (char *)bufferP, lengthP);
//debug("cSatipTuner::%s(%s) [device %d]", __FUNCTION__, s, deviceIdM);
char *c = strstr(s, ";tuner=");
if (c) {
@ -297,7 +298,6 @@ void cSatipTuner::ProcessApplicationData(u_char *bufferP, int lengthP)
// Scale value to 0-100
signalQualityM = (hasLockM && (value >= 0)) ? (value * 100 / 15) : 0;
}
free(s);
}
reConnectM.Set(eConnectTimeoutMs);
}