[PATCH] Priority of transfer-mode should not be -1

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Anssi Hannula wrote:
> The Receiving(bool CheckAny) is modified so that if it is called on the
> transfer-moded device, it returns true if receivers are found with
> priority < 0 even if CheckAny == false.

>  bool cDevice::Receiving(bool CheckAny) const
>  {
> +  if (this == ActualDevice())
> +      CheckAny = true;

No, what if primary device is not receiving, but has -1 priority 
receivers? This reports true then, when it shouldn't.

It should be this instead:
+  if (this == cTransferControl::ReceiverDevice())
+      return true;

Attached is a revised patch.

-- 
Anssi Hannula
-------------- next part --------------
diff -Nurp -x '*~' vdr-1.4.0/device.c vdr-1.4.0-fix/device.c
--- vdr-1.4.0/device.c	2006-04-14 17:34:43.000000000 +0300
+++ vdr-1.4.0-fix/device.c	2006-05-12 06:31:20.000000000 +0300
@@ -627,7 +627,7 @@ eSetChannelResult cDevice::SetChannel(co
   // use the card that actually can receive it and transfer data from there:
 
   if (NeedsTransferMode) {
-     cDevice *CaDevice = GetDevice(Channel, 0, &NeedsDetachReceivers);
+     cDevice *CaDevice = GetDevice(Channel, Setup.PrimaryLimit, &NeedsDetachReceivers);
      if (CaDevice && CanReplay()) {
         cStatus::MsgChannelSwitch(this, 0); // only report status if we are actually going to switch the channel
         if (CaDevice->SetChannel(Channel, false) == scrOk) { // calling SetChannel() directly, not SwitchChannel()!
@@ -1158,7 +1158,7 @@ int cDevice::Ca(void) const
 
 int cDevice::Priority(void) const
 {
-  int priority = IsPrimaryDevice() ? Setup.PrimaryLimit - 1 : DEFAULTPRIORITY;
+  int priority = ActualDevice() == this ? Setup.PrimaryLimit - 1 : DEFAULTPRIORITY;
   for (int i = 0; i < MAXRECEIVERS; i++) {
       if (receiver[i])
          priority = max(receiver[i]->priority, priority);
@@ -1183,6 +1183,8 @@ int cDevice::ProvidesCa(const cChannel *
 
 bool cDevice::Receiving(bool CheckAny) const
 {
+  if (this == cTransferControl::ReceiverDevice())
+      return true;
   for (int i = 0; i < MAXRECEIVERS; i++) {
       if (receiver[i] && (CheckAny || receiver[i]->priority >= 0)) // cReceiver with priority < 0 doesn't count
          return true;

[Index of Archives]     [Linux Media]     [Asterisk]     [DCCP]     [Netdev]     [Xorg]     [Util Linux NG]     [Xfree86]     [Big List of Linux Books]     [Fedora Users]     [Fedora Women]     [ALSA Devel]     [Linux USB]

  Powered by Linux