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

Reduced locking scope for a performance improvement.

Reduced the time that cSatipTunerStatistics() is locked.
This is important for poller thread as every lock in cSatipTunerStatistics()
leads to the poller thread waiting in SatipTuner::ProcessVideoData().
This commit is contained in:
nafets227 2014-11-29 23:07:38 +01:00 committed by Rolf Ahrenberg
parent 4600a2a070
commit 561ca26098

View File

@ -150,14 +150,16 @@ cSatipTunerStatistics::~cSatipTunerStatistics()
cString cSatipTunerStatistics::GetTunerStatistic()
{
//debug("cSatipTunerStatistics::%s()", __FUNCTION__);
cMutexLock MutexLock(&mutexM);
mutexM.Lock();
uint64_t elapsed = timerM.Elapsed(); /* in milliseconds */
timerM.Set();
long bitrate = elapsed ? (long)(1000.0L * dataBytesM / KILOBYTE(1) / elapsed) : 0L;
dataBytesM = 0;
mutexM.Unlock();
if (!SatipConfig.GetUseBytes())
bitrate *= 8;
cString s = cString::sprintf("%ld k%s/s", bitrate, SatipConfig.GetUseBytes() ? "B" : "bit");
dataBytesM = 0;
return s;
}