summaryrefslogtreecommitdiff
path: root/dvbapi.c
diff options
context:
space:
mode:
authorKlaus Schmidinger <vdr@tvdr.de>2002-04-21 10:09:56 +0200
committerKlaus Schmidinger <vdr@tvdr.de>2002-04-21 10:09:56 +0200
commitdfb1d78abf1a849302d2b93013ad2b8252c5035c (patch)
tree28d93c1cbd677e7fdd95f5d1c29ccc46e4ce0dba /dvbapi.c
parentc47891d786f4d0f6ce2d97e39a7e92e8c9276d9d (diff)
downloadvdr-dfb1d78abf1a849302d2b93013ad2b8252c5035c.tar.gz
vdr-dfb1d78abf1a849302d2b93013ad2b8252c5035c.tar.bz2
Fixed a possible endless loop in shifting recordings between DVB cards
Diffstat (limited to 'dvbapi.c')
-rw-r--r--dvbapi.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/dvbapi.c b/dvbapi.c
index 1c4a9521..786aff99 100644
--- a/dvbapi.c
+++ b/dvbapi.c
@@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
- * $Id: dvbapi.c 1.171 2002/04/20 10:45:33 kls Exp $
+ * $Id: dvbapi.c 1.172 2002/04/21 09:54:40 kls Exp $
*/
#include "dvbapi.h"
@@ -1812,21 +1812,24 @@ bool cDvbApi::SetPrimaryDvbApi(int n)
return false;
}
-int cDvbApi::CanShift(int Ca, int Priority)
+int cDvbApi::CanShift(int Ca, int Priority, int UsedCards)
{
// Test whether a recording on this DVB device can be shifted to another one
// in order to perform a new recording with the given Ca and Priority on this device:
int ShiftLevel = -1; // default means this device can't be shifted
+ if (UsedCards & (1 << CardIndex()) != 0)
+ return ShiftLevel; // otherwise we would get into a loop
if (Recording()) {
if (ProvidesCa(Ca) // this device provides the requested Ca
&& (Ca != this->Ca() // the requested Ca is different from the one currently used...
|| Priority > this->Priority())) { // ...or the request comes from a higher priority
cDvbApi *d = NULL;
int Provides[MAXDVBAPI];
+ UsedCards |= (1 << CardIndex());
for (int i = 0; i < NumDvbApis; i++) {
if ((Provides[i] = dvbApi[i]->ProvidesCa(this->Ca())) != 0) { // this device is basicly able to do the job
if (dvbApi[i] != this) { // it is not _this_ device
- int sl = dvbApi[i]->CanShift(this->Ca(), Priority); // this is the original Priority!
+ int sl = dvbApi[i]->CanShift(this->Ca(), Priority, UsedCards); // this is the original Priority!
if (sl >= 0 && (ShiftLevel < 0 || sl < ShiftLevel)) {
d = dvbApi[i];
ShiftLevel = sl;