optimize device selection

Message ID ed9fa2110905101035r3d6fa8e3h1f751ac464f9c6a0@mail.gmail.com
State New
Headers

Commit Message

jlacvdr May 10, 2009, 5:35 p.m. UTC
  Hi,

This patch is for vdr users's which have several cards.

He changes the device selection, by adding two factors in the 'impact' choice :
- prefering a already tuned device
- the last usage time of device

So, all devices are used and zapping time is reduce.

Works better when eitscanner is disable.

Regards,

JLac
  

Comments

Timothy D. Lenz Aug. 8, 2009, 6:43 p.m. UTC | #1
I don't yet know if this patch is the cause, but I have a setup I am working on which has a FusionHDTV7 dual express and after it
has been running for a few days, vdr seems to loose contact with the second tunner. When selecting other channels using vdradmin and
then going back to the channel it had been left on for awhile, I get the xine no signal screen. Switching to any other channel
works. Using femon I switch tunners while on the channel that no longer works and it starts working. I can go to any channel and
swith between the tunners and only get video on the first tunner. The problem may be triggered by recording but sure. The amount of
time to pass for it to show changes.

Using vdr-1.7.8

First I thought it was the driver crashing. So I tried restarting vdr, but not the drivers and that got the second tunner back.

----- Original Message ----- 
From: "jlacvdr" <jlacvdr@gmail.com>
To: "VDR Mailing List" <vdr@linuxtv.org>
Sent: Sunday, May 10, 2009 10:35 AM
Subject: [vdr] [patch] optimize device selection


> Hi,
>
> This patch is for vdr users's which have several cards.
>
> He changes the device selection, by adding two factors in the 'impact' choice :
> - prefering a already tuned device
> - the last usage time of device
>
> So, all devices are used and zapping time is reduce.
>
> Works better when eitscanner is disable.
>
> Regards,
>
> JLac
>


--------------------------------------------------------------------------------


> _______________________________________________
> vdr mailing list
> vdr@linuxtv.org
> http://www.linuxtv.org/cgi-bin/mailman/listinfo/vdr
>
  
Janusz Krzysztofik Aug. 10, 2009, 12:47 p.m. UTC | #2
Timothy D. Lenz wrote:
> I don't yet know if this patch is the cause, but I have a setup I am working on which has a FusionHDTV7 dual express and after it
> has been running for a few days, vdr seems to loose contact with the second tunner. When selecting other channels using vdradmin and
> then going back to the channel it had been left on for awhile, I get the xine no signal screen. Switching to any other channel
> works. Using femon I switch tunners while on the channel that no longer works and it starts working. I can go to any channel and
> swith between the tunners and only get video on the first tunner. The problem may be triggered by recording but sure. The amount of
> time to pass for it to show changes.
> 
> Using vdr-1.7.8
> 
> First I thought it was the driver crashing. So I tried restarting vdr, but not the drivers and that got the second tunner back.

Hi,
Sounds similiar to my problem description posted here some time ago:

http://www.linuxtv.org/pipermail/vdr/2008-December/018991.html

Nobody answered :(, so I am still using that getstream/iptv workaround.

Hoped this patch could help me, but had no opportunity to check for this 
yet.

Thanks,
Janusz
  

Patch

diff -bBurN vdr-1.7.7-orig/device.c vdr-1.7.7/device.c
--- vdr-1.7.7-orig/device.c	2009-05-02 14:17:39.000000000 +0200
+++ vdr-1.7.7/device.c	2009-05-10 18:52:27.000000000 +0200
@@ -84,6 +84,7 @@ 
 
   camSlot = NULL;
   startScrambleDetection = 0;
+  startReceiving = 0;
 
   player = NULL;
   isPlayingVideo = false;
@@ -264,6 +265,11 @@ 
              // to their individual severity, where the one listed first will make the most
              // difference, because it results in the most significant bit of the result.
              uint32_t imp = 0;
+
+             imp <<= 1; imp |= device[i]->IsTunedToTransponder(Channel) ? 0 : 1; // prefer device already tune
+             int t=((time(NULL)-device[i]->startReceiving)/16);
+             imp <<= 4;  imp |= t > 0x0f ? 0 : 0x0f-t;							 // sort devices by last time usage 
+
              imp <<= 1; imp |= LiveView ? !device[i]->IsPrimaryDevice() || ndr : 0;                                  // prefer the primary device for live viewing if we don't need to detach existing receivers
              imp <<= 1; imp |= !device[i]->Receiving() && (device[i] != cTransferControl::ReceiverDevice() || device[i]->IsPrimaryDevice()) || ndr; // use receiving devices if we don't need to detach existing receivers, but avoid primary device in local transfer mode
              imp <<= 1; imp |= device[i]->Receiving();                                                               // avoid devices that are receiving
@@ -290,6 +296,7 @@ 
          break; // no CAM necessary, so just one loop over the devices
       }
   if (d) {
+     d->startReceiving = time(NULL);
      if (NeedsDetachReceivers)
         d->DetachAllReceivers();
      if (s) {
diff -bBurN vdr-1.7.7-orig/device.h vdr-1.7.7/device.h
--- vdr-1.7.7-orig/device.h	2009-05-02 14:16:20.000000000 +0200
+++ vdr-1.7.7/device.h	2009-05-10 18:49:00.000000000 +0200
@@ -340,6 +340,7 @@ 
 
 private:
   time_t startScrambleDetection;
+  time_t startReceiving;
   cCamSlot *camSlot;
 public:
   virtual bool HasCi(void);