mirror of
https://github.com/VDR4Arch/vdr.git
synced 2023-10-10 13:36:52 +02:00
Fixed handling the uncorrected block counter for DVB API 3 devices when calculating signal quality
This commit is contained in:
parent
686831caf5
commit
9cd28b2ded
2
HISTORY
2
HISTORY
@ -8983,3 +8983,5 @@ Video Disk Recorder Revision History
|
|||||||
- Updated the Finnish OSD texts (thanks to Rolf Ahrenberg).
|
- Updated the Finnish OSD texts (thanks to Rolf Ahrenberg).
|
||||||
- Fixed displaying remote timers in the main menu of skin LCARS.
|
- Fixed displaying remote timers in the main menu of skin LCARS.
|
||||||
- Fixed editing a remote timer immediately after it has been created.
|
- Fixed editing a remote timer immediately after it has been created.
|
||||||
|
- Fixed handling the uncorrected block counter for DVB API 3 devices when calculating
|
||||||
|
signal quality.
|
||||||
|
37
dvbdevice.c
37
dvbdevice.c
@ -4,7 +4,7 @@
|
|||||||
* See the main source file 'vdr.c' for copyright information and
|
* See the main source file 'vdr.c' for copyright information and
|
||||||
* how to reach the author.
|
* how to reach the author.
|
||||||
*
|
*
|
||||||
* $Id: dvbdevice.c 4.8 2017/04/18 13:11:07 kls Exp $
|
* $Id: dvbdevice.c 4.9 2017/04/20 14:42:35 kls Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "dvbdevice.h"
|
#include "dvbdevice.h"
|
||||||
@ -309,6 +309,9 @@ private:
|
|||||||
int tuneTimeout;
|
int tuneTimeout;
|
||||||
int lockTimeout;
|
int lockTimeout;
|
||||||
time_t lastTimeoutReport;
|
time_t lastTimeoutReport;
|
||||||
|
mutable uint32_t lastUncValue;
|
||||||
|
mutable uint32_t lastUncDelta;
|
||||||
|
mutable time_t lastUncChange;
|
||||||
cChannel channel;
|
cChannel channel;
|
||||||
const cDiseqc *lastDiseqc;
|
const cDiseqc *lastDiseqc;
|
||||||
int diseqcOffset;
|
int diseqcOffset;
|
||||||
@ -364,6 +367,9 @@ cDvbTuner::cDvbTuner(const cDvbDevice *Device, int Fd_Frontend, int Adapter, int
|
|||||||
tuneTimeout = 0;
|
tuneTimeout = 0;
|
||||||
lockTimeout = 0;
|
lockTimeout = 0;
|
||||||
lastTimeoutReport = 0;
|
lastTimeoutReport = 0;
|
||||||
|
lastUncValue = 0;
|
||||||
|
lastUncDelta = 0;
|
||||||
|
lastUncChange = 0;
|
||||||
lastDiseqc = NULL;
|
lastDiseqc = NULL;
|
||||||
diseqcOffset = 0;
|
diseqcOffset = 0;
|
||||||
lastSource = 0;
|
lastSource = 0;
|
||||||
@ -818,8 +824,35 @@ int cDvbTuner::GetSignalQuality(void) const
|
|||||||
#endif
|
#endif
|
||||||
uint32_t Unc;
|
uint32_t Unc;
|
||||||
while (1) {
|
while (1) {
|
||||||
if (ioctl(fd_frontend, FE_READ_UNCORRECTED_BLOCKS, &Unc) != -1)
|
if (ioctl(fd_frontend, FE_READ_UNCORRECTED_BLOCKS, &Unc) != -1) {
|
||||||
|
if (Unc != lastUncValue) {
|
||||||
|
#ifdef DEBUG_SIGNALQUALITY
|
||||||
|
fprintf(stderr, "FE %d/%d: API3 UNC = %u %u %u\n", adapter, frontend, Unc, lastUncValue, lastUncDelta);
|
||||||
|
#endif
|
||||||
|
lastUncDelta = (Unc >= lastUncValue) ? Unc - lastUncValue : lastUncValue - Unc;
|
||||||
|
lastUncValue = Unc;
|
||||||
|
lastUncChange = time(NULL);
|
||||||
|
}
|
||||||
|
// The number of uncorrected blocks is a counter, which is normally
|
||||||
|
// at a constant value and only increases if there are new uncorrected
|
||||||
|
// blocks. So a change in the Unc value indicates reduced signal quality.
|
||||||
|
// Whenever the Unc counter changes, we take the delta between the old
|
||||||
|
// and new value into account for calculating the overall signal quality.
|
||||||
|
// The impact of Unc is considered for 2 seconds, and after that it is
|
||||||
|
// bisected with every passing second in order to phase it out. Otherwise
|
||||||
|
// once one or more uncorrected blocks occur, the signal quality would
|
||||||
|
// be considered low even if there haven't been any more uncorrected bocks
|
||||||
|
// for quite a while.
|
||||||
|
Unc = lastUncDelta;
|
||||||
|
int t = time(NULL) - lastUncChange - 2;
|
||||||
|
if (t > 0)
|
||||||
|
Unc >>= min(t, 32);
|
||||||
|
#ifdef DEBUG_SIGNALQUALITY
|
||||||
|
if (Unc > 0)
|
||||||
|
fprintf(stderr, "FE %d/%d: API3 UNC = %u\n", adapter, frontend, Unc);
|
||||||
|
#endif
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
if (errno != EINTR) {
|
if (errno != EINTR) {
|
||||||
Unc = 0;
|
Unc = 0;
|
||||||
#ifdef DEBUG_SIGNALQUALITY
|
#ifdef DEBUG_SIGNALQUALITY
|
||||||
|
Loading…
Reference in New Issue
Block a user