summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CONTRIBUTORS3
-rw-r--r--HISTORY2
-rw-r--r--eitscan.c61
-rw-r--r--eitscan.h5
4 files changed, 34 insertions, 37 deletions
diff --git a/CONTRIBUTORS b/CONTRIBUTORS
index 33d17c67..799069ff 100644
--- a/CONTRIBUTORS
+++ b/CONTRIBUTORS
@@ -549,3 +549,6 @@ Torsten Herz <torsten.herz@web.de>
for fixing a possible deadlock when using the "Blue" button in the "Schedules" menu
to switch to an other channel
for reporting a wrong EPG bugfix code number for the MAX_USEFUL_SUBTITLE_LENGTH fix
+
+Steffen Becker <stbecker@rbg.informatik.tu-darmstadt.de>
+ for reporting a problem with CPU load peaks (in the EPG scanner)
diff --git a/HISTORY b/HISTORY
index f781a5fd..71b7a79f 100644
--- a/HISTORY
+++ b/HISTORY
@@ -1984,3 +1984,5 @@ Video Disk Recorder Revision History
to switch to an other channel (thanks to Torsten Herz).
- Fixed the EPG bugfix code number for the MAX_USEFUL_SUBTITLE_LENGTH fix (thanks to
Torsten Herz for reporting this one).
+- Modified the EPG scanner to avoid CPU load peaks (thanks to Steffen Becker for
+ reporting this one).
diff --git a/eitscan.c b/eitscan.c
index 5768a423..a5c1a7b9 100644
--- a/eitscan.c
+++ b/eitscan.c
@@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
- * $Id: eitscan.c 1.11 2003/01/26 16:19:24 kls Exp $
+ * $Id: eitscan.c 1.12 2003/03/16 13:29:55 kls Exp $
*/
#include "eitscan.h"
@@ -16,7 +16,7 @@ cEITScanner::cEITScanner(void)
{
lastScan = lastActivity = time(NULL);
currentChannel = 0;
- lastChannel = 0;
+ memset(lastChannel, 0, sizeof(lastChannel));
numTransponders = 0;
transponders = NULL;
}
@@ -51,42 +51,33 @@ void cEITScanner::Process(void)
if (Setup.EPGScanTimeout && Channels.MaxNumber() > 1) {
time_t now = time(NULL);
if (now - lastScan > ScanTimeout && now - lastActivity > ActivityTimeout) {
- do {
- int oldLastChannel = lastChannel;
- for (int i = 0; i < cDevice::NumDevices(); i++) {
- cDevice *Device = cDevice::GetDevice(i);
- if (Device && Device->CardIndex() < MAXDVBDEVICES) {
- if (Device != cDevice::PrimaryDevice() || (cDevice::NumDevices() == 1 && Setup.EPGScanTimeout && now - lastActivity > Setup.EPGScanTimeout * 3600)) {
- if (!(Device->Receiving(true) || Device->Replaying())) {
- int oldCh = lastChannel;
- int ch = oldCh + 1;
- while (ch != oldCh) {
- if (ch > Channels.MaxNumber()) {
- ch = 1;
- numTransponders = 0;
- }
- cChannel *Channel = Channels.GetByNumber(ch, 1);
- if (Channel) {
- if (!Device->ProvidesChannel(Channel))
- break;
- if (Channel->Sid() && !TransponderScanned(Channel)) {
- if (Device == cDevice::PrimaryDevice() && !currentChannel)
- currentChannel = Device->CurrentChannel();
- Device->SwitchChannel(Channel, false);
- lastChannel = ch;
- break;
- }
- }
- ch = Channel->Number() + 1;
- }
- }
+ for (int i = 0; i < cDevice::NumDevices(); i++) {
+ cDevice *Device = cDevice::GetDevice(i);
+ if (Device && Device->CardIndex() < MAXDVBDEVICES) {
+ if (Device != cDevice::PrimaryDevice() || (cDevice::NumDevices() == 1 && Setup.EPGScanTimeout && now - lastActivity > Setup.EPGScanTimeout * 3600)) {
+ if (!(Device->Receiving(true) || Device->Replaying())) {
+ for (;;) {
+ cChannel *Channel = Channels.GetByNumber(lastChannel[Device->DeviceNumber()] + 1, 1);
+ if (Channel) {
+ lastChannel[Device->DeviceNumber()] = Channel->Number();
+ if (Channel->Sid() && Device->ProvidesChannel(Channel) && !TransponderScanned(Channel)) {
+ if (Device == cDevice::PrimaryDevice() && !currentChannel)
+ currentChannel = Device->CurrentChannel();
+ Device->SwitchChannel(Channel, false);
+ break;
+ }
+ }
+ else {
+ if (lastChannel[Device->DeviceNumber()])
+ numTransponders = 0;
+ lastChannel[Device->DeviceNumber()] = 0;
+ break;
+ }
+ }
}
}
}
- if (lastChannel != oldLastChannel)
- break;
- lastChannel++;
- } while (time(NULL) - now < 2);
+ }
lastScan = time(NULL);
}
}
diff --git a/eitscan.h b/eitscan.h
index 7dacb822..5b40ddd6 100644
--- a/eitscan.h
+++ b/eitscan.h
@@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
- * $Id: eitscan.h 1.1 2002/05/20 11:00:05 kls Exp $
+ * $Id: eitscan.h 1.2 2003/03/16 13:20:40 kls Exp $
*/
#ifndef __EITSCAN_H
@@ -19,7 +19,8 @@ private:
ScanTimeout = 20
};
time_t lastScan, lastActivity;
- int currentChannel, lastChannel;
+ int currentChannel;
+ int lastChannel[MAXDEVICES];
int numTransponders, *transponders;
bool TransponderScanned(cChannel *Channel);
public: