[mythtv] possible error in auto-shutdown routine

Christian Hoenig me at christianhoenig.de
Thu Mar 4 12:58:59 EST 2004

Hi Marc,

> Maybe Christian Hoenig (the author of this code, if I am not mistaking) can
> comment on this.

I try to :)

> I found a problem in the auto-shutdown routine. If my pc wakes up to
> perform a recording, it will never sleep again after that recording. If I
> wake it up myself (no recording within the time the pc is on) then it will
> sleep after I disconnect the client.

I  have problems with auto-shutdown lately, too, but I did not have time to 
debug it yet.

> With some debugging I found that the most likely cause of this problem is
> in the code listed below (taken from
> mythtv/programs/mythbackend/scheduler.cpp)
> 919			if ((recIter = reclist.begin()) !=
> 920				reclist.end())
> 921 			{
> 922				if (curtime.secsTo((*recIter)->startts) -
> 923					prerollseconds > idleWaitForRecordingTime * 60)
> 924				{
> 925					idleSince = curtime;
> 926				}
> 927			}
> 928              else
> 929				idleSince = curtime;
> 930		}
> line 919 and 920 contain the error if I am not mistaking: I suppose the
> assignment should be a compare (==) because now recIter contains the first

Here  the = is perfectly correct there, because I only reset the recIter to 
the first Item and when this is != .end(), there is data in the list.

> recording in the list, and not the first recording to still be recorded.
> Therefor the time towards the next recording calculated in 922-923 becomes
> negative.

The reclist *should* be sorted, so the first item in reclist should be the 
first recording. 
But I do not get the point here, sorry. Could you reelaborate? :)

> Some lines above this part the time to the next scheduled recording is
> already calculated,  but it is not used in this part. 

I'll have a look for that double calculation.

> Also I do not 
> understand why (when using my propsed compare) the recIter==reclist.begin()
> should be taken as a special case.

How do you mean a 'special case' ?

As said above, I have problems with it, too. 
Probably it is due to a change in handling the lists containing the players 

But I'll have a look at the code, thanks.

take care, have fun

More information about the mythtv-dev mailing list