Fixed handling UNC values

This commit is contained in:
Klaus Schmidinger 2017-05-01 12:50:12 +02:00
parent 073268bd45
commit 9491948f04
2 changed files with 10 additions and 5 deletions

View File

@ -8995,3 +8995,5 @@ Video Disk Recorder Revision History
- CAMs are now sent a generated EIT packet that contains a single 'present event' for
the current SID, in order to avoid any parental rating dialogs.
- Fixed handling UNC values (the shift operator behaves unexpected for shift values
larger than the size of the variable).

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: dvbdevice.c 4.9 2017/04/20 14:42:35 kls Exp $
* $Id: dvbdevice.c 4.10 2017/05/01 12:48:55 kls Exp $
*/
#include "dvbdevice.h"
@ -844,13 +844,16 @@ int cDvbTuner::GetSignalQuality(void) const
// 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);
if (Unc > 0) {
int t = time(NULL) - lastUncChange - 2;
if (t > 0)
Unc >>= min(t, int(sizeof(Unc) * 8 - 1));
if (Unc == 0)
lastUncDelta = 0;
#ifdef DEBUG_SIGNALQUALITY
if (Unc > 0)
fprintf(stderr, "FE %d/%d: API3 UNC = %u\n", adapter, frontend, Unc);
#endif
}
break;
}
if (errno != EINTR) {