From dfb1d78abf1a849302d2b93013ad2b8252c5035c Mon Sep 17 00:00:00 2001 From: Klaus Schmidinger Date: Sun, 21 Apr 2002 10:09:56 +0200 Subject: Fixed a possible endless loop in shifting recordings between DVB cards --- dvbapi.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'dvbapi.c') 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; -- cgit v1.2.3