[mythtv] possible error in auto-shutdown routine

Marc Kessels kessels at rijnh.nl
Thu Mar 4 07:40:44 EST 2004


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.
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)

915 if (!(m_mainServer->isClientConnected()) && !recording)
916 {
917		if (!idleSince.isValid())
918		{
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 
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.
I am a bit hesitating to send a patch to convert this assignment to a 
compare, because I don't understand why this part listed above is included. 
Some lines above this part the time to the next scheduled recording is 
already calculated,  but it is not used in this part. Also I do not 
understand why (when using my propsed compare) the recIter==reclist.begin() 
should be taken as a special case.
Maybe Christian Hoenig (the author of this code, if I am not mistaking) can 
comment on this.

thanks for all the good work!,
Marc Kessels



More information about the mythtv-dev mailing list