On 25.02.2012 00:21, Frank Schmirler wrote:
On Fri, 24 Feb 2012 19:33:06 +0100, Udo Richter wrote
Am 24.02.2012 17:23, schrieb Klaus Schmidinger:
IIRC that whole "Primary Limit" thing was introduced because in the
the full featured DVB cards were unable to record and play at the same
So it could happen that a timer occupied the primary device and left the
user with a black screen. Since the old FF cards have been given the
to do simultaneous recording and replay a long time ago, and the new TT
has been able to do this from the very start, I'd rather prefer to do
away with
the "Primary Limit" altogether - to make things simpler instead of more
complex ;-)

I was not aware of this as I have no FF card. For me, "Primary Limit" always
was the "Priority of Live TV". Ok, MANUAL talks about being allowed to "use
the primary DVB interface" and not denial to "affect live TV", but the use
case "recordings that should take place only when there is nothing else to do,
but should never keep the user from viewing stuff on the primary interface"
clearly pointed into that direction.

Always using priority 0 instead of a configurable "Primary Limit" means
there's no way to get anything with less priority than live TV but without the
"may always be detached" meaning of negative priorities.

Streamdev is using the "Primary Limit" to control priorities between multiple
clients and partially also between clients and server. Only "partially" due to
transfer mode receiver device running with priority -1. Currently a plugin
can't simply call GetDevice with a non-negative priority without disturbing
Live TV in transfer mode. Some ugly workarounds were necessary in streamdev to
handle this.

Well, I don't like the idea of introducing yet another parameter
("volatile") here.
The "priority" should be sufficient to solve this. So if you can suggest
a solution
that works solely with priorities, I might take a look ;-)

Well, the -1 priority on the transfer mode receiver device solves the
"receivers still attached when switching channels" problem. But it introduces
an exceptional case which causes problems (osdteletext) or makes apparently
simple things hard to handle (streamdev GetDevice). Trading this for an
explicit parameter sounds like a very good deal to me.

Letting VDR know that a device will probably soon be detached was
one of the smarter solutions to this. Another alternative I was
thinking of was to let the device know that a receiver is 'live-
related', and thus can be canceled for another live view, but the
'volatile' solution was more general.

Maybe it would be possible to manually lower the transfer mode receivers
to -1 when calling GetDevice with live view, and raise them back to
PrimaryLimit (or 0) at the end. Not sure if that's more elegant...

+1 for the "volatile" solution. Streamdev-server has to handle channel
switches, too. On the server side they are not "live-related", but the problem
is the same: The receivers for the previous channel are still attached.
"Volatile" would obsolete an other workaround in streamdev.

Definitely *no* "volatile"!

PrimaryLimit is going to be dropped, since the old FF-DVB cards can now (since
version 1.7.21) be run with the --outputonly option to avoid problems with 
high bandwidth channels. Besides, with HDTV becoming ever more popular those 
are pretty much obsolete by now (the TT S2-6400 has no problems recording and 
high bandwidth channels simultaneously). And, last but not least, people using 
players won't notice this change, anyway.

There was also apparently some misunderstanding about what PrimaryLimit was 
to do. It was *never* meant to allow "Channel switching can cancel timers with priority 
<= Setup.PrimaryLimit" (as noted at the bottom of 
Its sole purpose was to not use the primary device for recording low priority
timers and leave the user with a black screen. Those days are long gone, and 
is obsolete and causing nothing but trouble.

A recording shall *always* have priority over live viewing.

Since cReceivers can have priorities between -99 and 99, the priority
for an unused device has been changed from -1 to -100.

The attached patch implements all these changes (*.po files left out for
clarity). Please try this and let me know if anything doesn't work as
I did try running a recording on the primary device, so that live view
would be done in Transfer mode from the secondary device (only two devices
activated for testing) and had no problem with zapping through channels
with Up/Down. I also tried starting a recording on device 2 while in
Transfer Mode, and the live channel was switched to device 1 when the
recording kicked in.

retrieving revision 2.15
diff -u -b -r2.15 ./MANUAL
--- ./MANUAL	2012/01/14 13:03:21	2.15
+++ ./MANUAL	2012/02/25 13:38:52
@@ -763,15 +763,6 @@
                          These margins are added automatically to timers that
                          are created from the EPG data.
-  Primary limit = 0      The minimum priority a timer must have to be allowed to
-                         use the primary DVB interface, or to force another timer
-                         with higher priority to use the primary DVB interface.
-                         This is mainly useful for recordings that should take
-                         place only when there is nothing else to do, but should
-                         never keep the user from viewing stuff on the primary
-                         interface. On systems with only one DVB card, timers
-                         with a priority below PrimaryLimit will never execute.
   Default priority = 50  The default Priority and Lifetime values used when
   Default lifetime = 99  creating a new timer event. A Lifetime value of 99
                          means that this recording will never be deleted
RCS file: ./RCS/config.c
retrieving revision 2.18
diff -u -b -r2.18 ./config.c
--- ./config.c	2012/01/14 13:04:59	2.18
+++ ./config.c	2012/02/25 13:31:46
@@ -406,7 +406,6 @@
   SVDRPTimeout = 300;
   ZapTimeout = 3;
   ChannelEntryTimeout = 1000;
-  PrimaryLimit = 0;
   DefaultPriority = 50;
   DefaultLifetime = 99;
   PauseKeyHandling = 2;
@@ -601,7 +600,6 @@
   else if (!strcasecmp(Name, "SVDRPTimeout"))        SVDRPTimeout       = atoi(Value);
   else if (!strcasecmp(Name, "ZapTimeout"))          ZapTimeout         = atoi(Value);
   else if (!strcasecmp(Name, "ChannelEntryTimeout")) ChannelEntryTimeout= atoi(Value);
-  else if (!strcasecmp(Name, "PrimaryLimit"))        PrimaryLimit       = atoi(Value);
   else if (!strcasecmp(Name, "DefaultPriority"))     DefaultPriority    = atoi(Value);
   else if (!strcasecmp(Name, "DefaultLifetime"))     DefaultLifetime    = atoi(Value);
   else if (!strcasecmp(Name, "PauseKeyHandling"))    PauseKeyHandling   = atoi(Value);
@@ -699,7 +697,6 @@
   Store("SVDRPTimeout",       SVDRPTimeout);
   Store("ZapTimeout",         ZapTimeout);
-  Store("PrimaryLimit",       PrimaryLimit);
   Store("DefaultPriority",    DefaultPriority);
   Store("DefaultLifetime",    DefaultLifetime);
   Store("PauseKeyHandling",   PauseKeyHandling);
RCS file: ./RCS/config.h
retrieving revision 2.41
diff -u -b -r2.41 ./config.h
--- ./config.h	2012/02/19 14:33:23	2.41
+++ ./config.h	2012/02/25 13:31:34
@@ -264,7 +264,6 @@
   int SVDRPTimeout;
   int ZapTimeout;
   int ChannelEntryTimeout;
-  int PrimaryLimit;
   int DefaultPriority, DefaultLifetime;
   int PausePriority, PauseLifetime;
   int PauseKeyHandling;
RCS file: ./RCS/device.c
retrieving revision 2.49
diff -u -b -r2.49 ./device.c
--- ./device.c	2012/02/15 13:15:19	2.49
+++ ./device.c	2012/02/25 12:45:53
@@ -59,9 +59,6 @@
 // --- cDevice ---------------------------------------------------------------
-// The default priority for non-primary devices:
 // The minimum number of unknown PS1 packets to consider this a "pre 1.3.19 private stream":
 #define MIN_PRE_1_3_19_PRIVATESTREAM 10
@@ -269,7 +266,7 @@
           if (NumUsableSlots && !CamSlots.Get(j)->Assign(device[i], true))
              continue; // CAM slot can't be used with this device
           bool ndr;
-          if (device[i]->ProvidesChannel(Channel, (LiveView && device[i]->IsPrimaryDevice()) ? Setup.PrimaryLimit : Priority, &ndr)) { // this device is basicly able to do the job
+          if (device[i]->ProvidesChannel(Channel, Priority, &ndr)) { // this device is basicly able to do the job
              if (NumUsableSlots && device[i]->CamSlot() && device[i]->CamSlot() != CamSlots.Get(j))
                 ndr = true; // using a different CAM slot requires detaching receivers
              // Put together an integer number that reflects the "impact" using
@@ -690,7 +687,7 @@
      cChannel *channel;
      while ((channel = Channels.GetByNumber(n, Direction)) != NULL) {
            // try only channels which are currently available
-           if (GetDevice(channel, 0, true))
+           if (GetDevice(channel, LIVEPRIORITY, true))
            n = channel->Number() + Direction;
@@ -717,7 +714,7 @@
-  cDevice *Device = (LiveView && IsPrimaryDevice()) ? GetDevice(Channel, 0, LiveView) : this;
+  cDevice *Device = (LiveView && IsPrimaryDevice()) ? GetDevice(Channel, LIVEPRIORITY, true) : this;
   bool NeedsTransferMode = Device != this;
@@ -1495,7 +1492,7 @@
 int cDevice::Priority(void) const
-  int priority = IsPrimaryDevice() ? Setup.PrimaryLimit - 1 : DEFAULTPRIORITY;
+  int priority = IDLEPRIORITY;
   cMutexLock MutexLock(&mutexReceiver);
   for (int i = 0; i < MAXRECEIVERS; i++) {
       if (receiver[i])
RCS file: ./RCS/device.h
retrieving revision 2.33
diff -u -b -r2.33 ./device.h
--- ./device.h	2012/02/14 14:42:42	2.33
+++ ./device.h	2012/02/25 12:54:39
@@ -31,6 +31,8 @@
 #define MAXVOLUME         255
 #define VOLUMEDELTA         5 // used to increase/decrease the volume
 #define MAXOCCUPIEDTIMEOUT 99 // max. time (in seconds) a device may be occupied
+#define LIVEPRIORITY        0 // priority used when selecting a device for live viewing
+#define IDLEPRIORITY       (-MAXPRIORITY - 1)
 enum eSetChannelResult { scrOk, scrNotAvailable, scrNoTransfer, scrFailed };
@@ -237,9 +239,8 @@
          ///< the given channel's transponder.
   virtual bool ProvidesChannel(const cChannel *Channel, int Priority = -1, bool *NeedsDetachReceivers = NULL) const;
          ///< Returns true if this device can provide the given channel.
-         ///< In case the device has cReceivers attached to it or it is the primary
-         ///< device, Priority is used to decide whether the caller's request can
-         ///< be honored.
+         ///< In case the device has cReceivers attached to it, Priority is used to
+         ///< decide whether the caller's request can be honored.
          ///< The special Priority value -1 will tell the caller whether this device
          ///< is principally able to provide the given Channel, regardless of any
          ///< attached cReceivers.
@@ -719,9 +720,8 @@
   cReceiver *receiver[MAXRECEIVERS];
   int Priority(void) const;
-      ///< Returns the priority of the current receiving session (0..MAXPRIORITY),
-      ///< or -1 if no receiver is currently active. The primary device will
-      ///< always return at least Setup.PrimaryLimit-1.
+      ///< Returns the priority of the current receiving session (-MAXPRIORITY..MAXPRIORITY),
+      ///< or IDLEPRIORITY if no receiver is currently active.
   virtual bool OpenDvr(void);
       ///< Opens the DVR of this device and prepares it to deliver a Transport
RCS file: ./RCS/dvbdevice.c
retrieving revision 2.63
diff -u -b -r2.63 ./dvbdevice.c
--- ./dvbdevice.c	2012/02/20 12:45:49	2.63
+++ ./dvbdevice.c	2012/02/25 12:10:12
@@ -1453,13 +1453,11 @@
                        needsDetachReceivers = true;
-                 else if (!IsPrimaryDevice())
-                    result = true;
-                    result = Priority >= Setup.PrimaryLimit;
+                    result = true;
-                 result = !IsPrimaryDevice() || Priority >= Setup.PrimaryLimit;
+                 result = true;
               needsDetachReceivers = Receiving(true);
RCS file: ./RCS/menu.c
retrieving revision 2.37
diff -u -b -r2.37 ./menu.c
--- ./menu.c	2012/02/19 11:37:55	2.37
+++ ./menu.c	2012/02/25 13:50:49
@@ -3093,7 +3093,6 @@
   Add(new cMenuEditIntItem( tr("Setup.Recording$Margin at start (min)"),     &data.MarginStart));
   Add(new cMenuEditIntItem( tr("Setup.Recording$Margin at stop (min)"),      &data.MarginStop));
-  Add(new cMenuEditIntItem( tr("Setup.Recording$Primary limit"),             &data.PrimaryLimit, 0, MAXPRIORITY));
   Add(new cMenuEditIntItem( tr("Setup.Recording$Default priority"),          &data.DefaultPriority, 0, MAXPRIORITY));
   Add(new cMenuEditIntItem( tr("Setup.Recording$Default lifetime (d)"),      &data.DefaultLifetime, 0, MAXLIFETIME));
   Add(new cMenuEditStraItem(tr("Setup.Recording$Pause key handling"),        &data.PauseKeyHandling, 3, pauseKeyHandlingTexts));
@@ -3654,7 +3653,7 @@
            Channel = Direction > 0 ? Channels.Next(Channel) : Channels.Prev(Channel);
            if (!Channel && Setup.ChannelsWrap)
               Channel = Direction > 0 ? Channels.First() : Channels.Last();
-           if (Channel && !Channel->GroupSep() && cDevice::GetDevice(Channel, 0, true))
+           if (Channel && !Channel->GroupSep() && cDevice::GetDevice(Channel, LIVEPRIORITY, true))
               return Channel;
@@ -4294,7 +4293,7 @@
-     else if (!Timer || (Timer->Priority() >= Setup.PrimaryLimit && !Timer->Pending())) {
+     else if (!Timer || !Timer->Pending()) {
         isyslog("no free DVB device to record channel %d!", ch);
         Skins.Message(mtError, tr("No free DVB device to record!"));
RCS file: ./RCS/receiver.h
retrieving revision 2.3
diff -u -b -r2.3 ./receiver.h
--- ./receiver.h	2012/02/25 11:19:53	2.3
+++ ./receiver.h	2012/02/25 12:49:31
@@ -49,7 +49,7 @@
                ///< Otherwise pids can be added to the receiver by separate calls to the AddPid[s]
                ///< functions.
                ///< The total number of PIDs added to a receiver must not exceed MAXRECEIVEPIDS.
-               ///< Priority may be any value in the range -99..99. Negative values indicate
+               ///< Priority may be any value in the range +/-MAXPRIORITY. Negative values indicate
                ///< that this cReceiver may be detached at any time (without blocking the
                ///< cDevice it is attached to).
   virtual ~cReceiver();
vdr mailing list

Reply via email to