1
0
mirror of https://github.com/rofafor/vdr-plugin-satip.git synced 2023-10-10 13:37:42 +02:00

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

View File

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