Priority of transfer-mode should not be -1

Message ID 42C1F492.3050303@gmail.com
State New
Headers

Commit Message

Anssi Hannula June 29, 2005, 1:08 a.m. UTC
  Hi!

The transfer-mode uses always priority -1.

That presents a problem: If I connect to that vdr using streamdev, it 
switches the first budget device off from the multiplex transfered to 
the FF card, although there is a second identical budget device available.

Also, if I had DVB-S FF and only one DVB-T budget and had a DVB-T 
recording with priority 10 and Primary Limit at 20, live DVB-T video 
would (wouldn't it?) be severed.

Klaus, shouldn't transfer-mode be also using the Primary Limit value, so 
that recordings with priority less than Primary Limit couldn't distract 
the output of primary device?

Patch attached.
  

Comments

Anssi Hannula Aug. 15, 2005, 4:59 p.m. UTC | #1
Anssi Hannula wrote:
> The transfer-mode uses always priority -1.
> 
> That presents a problem: If I connect to that vdr using streamdev, it 
> switches the first budget device off from the multiplex transfered to 
> the FF card, although there is a second identical budget device available.
> 
> Also, if I had DVB-S FF and only one DVB-T budget and had a DVB-T 
> recording with priority 10 and Primary Limit at 20, live DVB-T video 
> would (wouldn't it?) be severed.
> 
> Klaus, shouldn't transfer-mode be also using the Primary Limit value, so 
> that recordings with priority less than Primary Limit couldn't distract 
> the output of primary device?
> 
> Patch attached.

This bug is still present in 1.3.29.
Klaus, I know that your day is only 24 hours long and that I'm bringing 
this patch up the third time, but could this be either applied or replied?
  
Klaus Schmidinger Aug. 15, 2005, 5:14 p.m. UTC | #2
Anssi Hannula wrote:
> Anssi Hannula wrote:
> 
>> The transfer-mode uses always priority -1.
>>
>> That presents a problem: If I connect to that vdr using streamdev, it 
>> switches the first budget device off from the multiplex transfered to 
>> the FF card, although there is a second identical budget device 
>> available.
>>
>> Also, if I had DVB-S FF and only one DVB-T budget and had a DVB-T 
>> recording with priority 10 and Primary Limit at 20, live DVB-T video 
>> would (wouldn't it?) be severed.
>>
>> Klaus, shouldn't transfer-mode be also using the Primary Limit value, 
>> so that recordings with priority less than Primary Limit couldn't 
>> distract the output of primary device?
>>
>> Patch attached.
> 
> 
> This bug is still present in 1.3.29.
> Klaus, I know that your day is only 24 hours long and that I'm bringing 
> this patch up the third time, but could this be either applied or replied?

Sorry, your original posting was during my vacation, so I must
have overlooked it.

I guess you're right with this and will make it so in the next version.

Klaus
  
Anssi Hannula Aug. 15, 2005, 5:19 p.m. UTC | #3
Klaus Schmidinger wrote:
> 
> Sorry, your original posting was during my vacation, so I must
> have overlooked it.
> 
> I guess you're right with this and will make it so in the next version.
> 

Okay :)
  
Thomas Bergwinkl Aug. 15, 2005, 7:07 p.m. UTC | #4
Hi,

Anssi Hannula wrote:

> The transfer-mode uses always priority -1.
>
> That presents a problem: If I connect to that vdr using streamdev, it
> switches the first budget device off from the multiplex transfered to
> the FF card, although there is a second identical budget
> device available.
>
> Also, if I had DVB-S FF and only one DVB-T budget and had a DVB-T
> recording with priority 10 and Primary Limit at 20, live DVB-T video
> would (wouldn't it?) be severed.
>
> Klaus, shouldn't transfer-mode be also using the Primary
> Limit value, so
> that recordings with priority less than Primary Limit
> couldn't distract
> the output of primary device?
>
> Patch attached.

I think there is a problem with your patch. There is a reason for the
priority -1. Imagine you have a channel which can only be received by
one card and this card is used for transfer-mode. When you want to
switch to this channel, the transfer-mode has, with your patch, e.g
priority 0. But the new transfer-mode would have the same priority (but
not a higher), so there would be no free device (channel not available).
So when searching for a free device, vdr should consider that the
device, which is used for transfer-mode, could be free, if transfer-mode
for the current channel has ended.


Thomas
  
Anssi Hannula Aug. 18, 2005, 2:13 p.m. UTC | #5
Thomas Bergwinkl wrote:
> Hi,
> 
> Anssi Hannula wrote:
> 
>>The transfer-mode uses always priority -1.
>>
>>That presents a problem: If I connect to that vdr using streamdev, it
>>switches the first budget device off from the multiplex transfered to
>>the FF card, although there is a second identical budget
>>device available.
>>
>>Also, if I had DVB-S FF and only one DVB-T budget and had a DVB-T
>>recording with priority 10 and Primary Limit at 20, live DVB-T video
>>would (wouldn't it?) be severed.
>>
>>Klaus, shouldn't transfer-mode be also using the Primary
>>Limit value, so
>>that recordings with priority less than Primary Limit
>>couldn't distract
>>the output of primary device?
>>
>>Patch attached.
> 
> 
> I think there is a problem with your patch. There is a reason for the
> priority -1. Imagine you have a channel which can only be received by
> one card and this card is used for transfer-mode. When you want to
> switch to this channel, the transfer-mode has, with your patch, e.g
> priority 0. But the new transfer-mode would have the same priority (but
> not a higher), so there would be no free device (channel not available).
> So when searching for a free device, vdr should consider that the
> device, which is used for transfer-mode, could be free, if transfer-mode
> for the current channel has ended.

Oh, I just assumed VDR takes that into account. If not, then of course 
it either has to be implemented or the patch not applied.
I have 3 DVB-T cards in my system, so I can use the patch anyway.
  
Klaus Schmidinger Aug. 20, 2005, 9:30 a.m. UTC | #6
Thomas Bergwinkl wrote:
> Hi,
> 
> Anssi Hannula wrote:
> 
> 
>>The transfer-mode uses always priority -1.
>>
>>That presents a problem: If I connect to that vdr using streamdev, it
>>switches the first budget device off from the multiplex transfered to
>>the FF card, although there is a second identical budget
>>device available.
>>
>>Also, if I had DVB-S FF and only one DVB-T budget and had a DVB-T
>>recording with priority 10 and Primary Limit at 20, live DVB-T video
>>would (wouldn't it?) be severed.
>>
>>Klaus, shouldn't transfer-mode be also using the Primary
>>Limit value, so
>>that recordings with priority less than Primary Limit
>>couldn't distract
>>the output of primary device?
>>
>>Patch attached.
> 
> 
> I think there is a problem with your patch. There is a reason for the
> priority -1. Imagine you have a channel which can only be received by
> one card and this card is used for transfer-mode. When you want to
> switch to this channel, the transfer-mode has, with your patch, e.g
> priority 0. But the new transfer-mode would have the same priority (but
> not a higher), so there would be no free device (channel not available).
> So when searching for a free device, vdr should consider that the
> device, which is used for transfer-mode, could be free, if transfer-mode
> for the current channel has ended.

Thanks, I didn't think of this when I said I would adopt that change.

Actually, the PrimaryLimit was implemented at a time where the FF DVB
cards were unable to record and replay at the same time. In that case,
when a timer needed to use the primary device, it was no longer possible
to switch to a different channel. These times are long gone, so I would
instead tend to remove the PrimaryLimit altogether. It would make things
simpler instead of more complex ;-)

If somebody has programmed so many timers that all of the DVB cards
are needed to record them, so be it.

Comments?

Klaus
  
Anssi Hannula Aug. 28, 2005, 3:13 p.m. UTC | #7
Klaus Schmidinger wrote:

>> Anssi Hannula wrote:
>>
>>> The transfer-mode uses always priority -1.
>>>
>>> That presents a problem: If I connect to that vdr using streamdev, it
>>> switches the first budget device off from the multiplex transfered to
>>> the FF card, although there is a second identical budget
>>> device available.
>>>

> Actually, the PrimaryLimit was implemented at a time where the FF DVB
> cards were unable to record and replay at the same time. In that case,
> when a timer needed to use the primary device, it was no longer possible
> to switch to a different channel. These times are long gone, so I would
> instead tend to remove the PrimaryLimit altogether. It would make things
> simpler instead of more complex ;-)
> 
> If somebody has programmed so many timers that all of the DVB cards
> are needed to record them, so be it.
> 
> Comments?
> 

How exactly would that resolve the situation I described above?
  
Klaus Schmidinger Aug. 28, 2005, 9:29 p.m. UTC | #8
Anssi Hannula wrote:
> Klaus Schmidinger wrote:
> 
>>> Anssi Hannula wrote:
>>>
>>>> The transfer-mode uses always priority -1.
>>>>
>>>> That presents a problem: If I connect to that vdr using streamdev, it
>>>> switches the first budget device off from the multiplex transfered to
>>>> the FF card, although there is a second identical budget
>>>> device available.
>>>>
> 
>> Actually, the PrimaryLimit was implemented at a time where the FF DVB
>> cards were unable to record and replay at the same time. In that case,
>> when a timer needed to use the primary device, it was no longer possible
>> to switch to a different channel. These times are long gone, so I would
>> instead tend to remove the PrimaryLimit altogether. It would make things
>> simpler instead of more complex ;-)
>>
>> If somebody has programmed so many timers that all of the DVB cards
>> are needed to record them, so be it.
>>
>> Comments?
>>
> 
> How exactly would that resolve the situation I described above?

Well, it wouldn't. Apparently I overread that this was a streamdev issue.
But then again, it's of course the same problem if you are in Transfer-Mode
and a recording starts and selects the receiver device, even though an other
device would be free.

I'll think over this again...

Klaus
  
Thomas Bergwinkl Aug. 29, 2005, 7:33 p.m. UTC | #9
Klaus Schmidinger wrote:
> Anssi Hannula wrote:
> > Klaus Schmidinger wrote:
> >
> >>> Anssi Hannula wrote:
> >>>
> >>>> The transfer-mode uses always priority -1.
> >>>>
> >>>> That presents a problem: If I connect to that vdr using
> streamdev, it
> >>>> switches the first budget device off from the multiplex
> transfered to
> >>>> the FF card, although there is a second identical budget
> >>>> device available.
> >>>>
> >
> >> Actually, the PrimaryLimit was implemented at a time where
> the FF DVB
> >> cards were unable to record and replay at the same time.
> In that case,
> >> when a timer needed to use the primary device, it was no
> longer possible
> >> to switch to a different channel. These times are long
> gone, so I would
> >> instead tend to remove the PrimaryLimit altogether. It
> would make things
> >> simpler instead of more complex ;-)
> >>
> >> If somebody has programmed so many timers that all of the DVB cards
> >> are needed to record them, so be it.
> >>
> >> Comments?
> >>
> >
> > How exactly would that resolve the situation I described above?
>
> Well, it wouldn't. Apparently I overread that this was a
> streamdev issue.
> But then again, it's of course the same problem if you are in
> Transfer-Mode
> and a recording starts and selects the receiver device, even
> though an other
> device would be free.
>
> I'll think over this again...

What do you think about the attached patch?

Thomas
  
Klaus Schmidinger Sept. 10, 2005, 1 p.m. UTC | #10
Thomas Bergwinkl wrote:
> Klaus Schmidinger wrote:
> 
>>Anssi Hannula wrote:
>>
>>>Klaus Schmidinger wrote:
>>>
>>>
>>>>>Anssi Hannula wrote:
>>>>>
>>>>>
>>>>>>The transfer-mode uses always priority -1.
>>>>>>
>>>>>>That presents a problem: If I connect to that vdr using
>>
>>streamdev, it
>>
>>>>>>switches the first budget device off from the multiplex
>>
>>transfered to
>>
>>>>>>the FF card, although there is a second identical budget
>>>>>>device available.
>>>>>>
>>>
>>>>Actually, the PrimaryLimit was implemented at a time where
>>
>>the FF DVB
>>
>>>>cards were unable to record and replay at the same time.
>>
>>In that case,
>>
>>>>when a timer needed to use the primary device, it was no
>>
>>longer possible
>>
>>>>to switch to a different channel. These times are long
>>
>>gone, so I would
>>
>>>>instead tend to remove the PrimaryLimit altogether. It
>>
>>would make things
>>
>>>>simpler instead of more complex ;-)
>>>>
>>>>If somebody has programmed so many timers that all of the DVB cards
>>>>are needed to record them, so be it.
>>>>
>>>>Comments?
>>>>
>>>
>>>How exactly would that resolve the situation I described above?
>>
>>Well, it wouldn't. Apparently I overread that this was a
>>streamdev issue.
>>But then again, it's of course the same problem if you are in
>>Transfer-Mode
>>and a recording starts and selects the receiver device, even
>>though an other
>>device would be free.
>>
>>I'll think over this again...
> 
> 
> What do you think about the attached patch?
> 
> Thomas

@Anssi: have you had a chance to test this patch yet?

Klaus
  
Thomas Bergwinkl Sept. 10, 2005, 3:40 p.m. UTC | #11
Klaus Schmidinger wrote:
> Thomas Bergwinkl wrote:
> > Klaus Schmidinger wrote:
> >
> >>Anssi Hannula wrote:
> >>
> >>>Klaus Schmidinger wrote:
> >>>
> >>>
> >>>>>Anssi Hannula wrote:
> >>>>>
> >>>>>
> >>>>>>The transfer-mode uses always priority -1.
> >>>>>>
> >>>>>>That presents a problem: If I connect to that vdr using
> >>
> >>streamdev, it
> >>
> >>>>>>switches the first budget device off from the multiplex
> >>
> >>transfered to
> >>
> >>>>>>the FF card, although there is a second identical budget
> >>>>>>device available.
> >>>>>>
> >>>
> >>>>Actually, the PrimaryLimit was implemented at a time where
> >>
> >>the FF DVB
> >>
> >>>>cards were unable to record and replay at the same time.
> >>
> >>In that case,
> >>
> >>>>when a timer needed to use the primary device, it was no
> >>
> >>longer possible
> >>
> >>>>to switch to a different channel. These times are long
> >>
> >>gone, so I would
> >>
> >>>>instead tend to remove the PrimaryLimit altogether. It
> >>
> >>would make things
> >>
> >>>>simpler instead of more complex ;-)
> >>>>
> >>>>If somebody has programmed so many timers that all of the DVB cards
> >>>>are needed to record them, so be it.
> >>>>
> >>>>Comments?
> >>>>
> >>>
> >>>How exactly would that resolve the situation I described above?
> >>
> >>Well, it wouldn't. Apparently I overread that this was a
> >>streamdev issue.
> >>But then again, it's of course the same problem if you are in
> >>Transfer-Mode
> >>and a recording starts and selects the receiver device, even
> >>though an other
> >>device would be free.
> >>
> >>I'll think over this again...
> >
> >
> > What do you think about the attached patch?
> >
> > Thomas
> 
> @Anssi: have you had a chance to test this patch yet?

Meanwhile I realised that in cDevice::SetChannel GetDevice is called with
priority 0. So the 'Priority >= 0' in the patch is always true (and
therefore could be replaced be 'true') . This will lead to a 'sideeffect' if
more than one device is able to provide this channel: When zapping through
the channels always the other device will be choosen. Another effect with
this patch is, that when a recording on the same transponder starts, which
currently is received via transfermode, then the receiving device will be
prefered for the recording be GetDevice().
So I am not really happy with this patch anymore and think a better solution
is neccessary.

Thomas
  
Anssi Hannula Sept. 11, 2005, 2:48 p.m. UTC | #12
Thomas Bergwinkl wrote:
> Klaus Schmidinger wrote:
> 
>>Thomas Bergwinkl wrote:
>>
>>>Klaus Schmidinger wrote:
>>>
>>>>Well, it wouldn't. Apparently I overread that this was a
>>>>streamdev issue.
>>>>But then again, it's of course the same problem if you are in
>>>>Transfer-Mode
>>>>and a recording starts and selects the receiver device, even
>>>>though an other
>>>>device would be free.
>>>>
>>>>I'll think over this again...
>>>
>>>
>>>What do you think about the attached patch?
>>>
>>>Thomas
>>
>>@Anssi: have you had a chance to test this patch yet?

Oops, sorry I didn't notice this new patch at all. Is this meant to be 
used with or without my initial patch?

> Meanwhile I realised that in cDevice::SetChannel GetDevice is called with
> priority 0. So the 'Priority >= 0' in the patch is always true (and
> therefore could be replaced be 'true') . This will lead to a 'sideeffect' if
> more than one device is able to provide this channel: When zapping through
> the channels always the other device will be choosen. Another effect with
> this patch is, that when a recording on the same transponder starts, which
> currently is received via transfermode, then the receiving device will be
> prefered for the recording be GetDevice().
> So I am not really happy with this patch anymore and think a better solution
> is neccessary.
> 

Hmm, too complicated for me to understand right now...

BTW, with my original patch, the channel switching in DVB-T seems to be 
faster. When switching multiplex, VDR also switches to second device. 
When I switch back to the previous multiplex, I believe the first card 
(which VDR changes back to) is still tuned to that and retuning is not 
necessary. However this same thing is the problem also, as Thomas said, 
because you need always an extra free card for multiplex switching 
(which is not a problem for me, because number of multiplexes = number 
of cards).
  

Patch

--- transfer.c.old	2005-06-29 03:50:18.000000000 +0300
+++ transfer.c	2005-06-29 03:59:26.000000000 +0300
@@ -15,7 +15,7 @@ 
 // --- cTransfer -------------------------------------------------------------
 
 cTransfer::cTransfer(int VPid, const int *APids, const int *DPids, const int *SPids)
-:cReceiver(0, -1, VPid, APids, Setup.UseDolbyDigital ? DPids : NULL, SPids)
+:cReceiver(0, Setup.PrimaryLimit, VPid, APids, Setup.UseDolbyDigital ? DPids : NULL, SPids)
 ,cThread("transfer")
 {
   ringBuffer = new cRingBufferLinear(TRANSFERBUFSIZE, TS_SIZE * 2, true, "Transfer");