[mythtv] [mythtv-commits] Ticket #5870: Channel Change Script Timeout Patch

Michael T. Dean mtdean at thirdcontact.com
Sun Nov 2 14:22:03 UTC 2008


On 11/02/2008 07:41 AM, Doug Haber wrote:

>  From: Michael T. Dean
>
> > On 10/31/2008 07:41 PM, MythTV wrote:
> >
> >> #5870: Channel Change Script Timeout Patch
> >>
> >> I was having a problem where my channel change script was
> >> sometimes taking longer than 30 seconds (firewire resync issues)
> >> and so some recordings would get missed. This could have been
> >> avoided if I had a way to increase the channel change timeout to
> >> something greater than 30 seconds.
> >
> > You can also background the channel-change script.  It looks like
> > you should be able to just add " &" to the end of the "External
> > channel change command" value, but worst-case scenario, you can
> > have Myth call a script that calls and backgrounds the real script.
> > Then Myth thinks the channel changed "instantly."
>
>  Thanks for the quick feedback! I did some testing and this seemed to
>  mostly work (thanks!), although I got this error once:
>  http://cvs.mythtv.org/trac/ticket/5278. I'm nervous that returning
>  from the channel change script before the firewire connection has
>  stabilized means that myth may not get a lock on the connection and
>  consequently may give up on the recording before the connection has
>  stabilized. Is that possible? I'll watch the logs over the next week
>  or so to see if regular (non-testing) tv viewing is affected.


In that case, it may be more stable to have the MythTV-specified channel 
change script called in the foreground (without the &) and have it call 
and background another script to actually change the channel (i.e. 
"real_channel_change.sh "$@" &) and then sleep for some time just under 
30 seconds (maybe 25 seconds to leave some "wiggle room") before 
returning (exit 0).

You may also (or instead?) need to increase the channel tuning timeout:

Tuning Timeout (msec)
Maximum time MythTV waits for a channel lock when scanning for channels. 
Or, for issuing a warning in LiveTV mode.

(which seems to default to 9 seconds for Firewire) but, then again, I 
don't know anything about firewire, so it may not help.


> >> Attached is a simple patch to move this timeout from the code to
> >> the  database.  It still defaults to 30 seconds so users won't
> >> notice a difference but makes it easier to increase (or decrease)
> >> the timeout if necessary. I wasn't sure how to add the default
> >> value to the db so I added it to the end of dbcheck.cpp.
> >
> > There's no reason to put the setting in the DB as the line:
> >
> > uint timeout = gContext->GetNumSetting("ChannelChangeTimeout", 30);
> >
> > specifies a default value of 30, which will be used if there's no
> > value in the DB.
>
>  The reason I suggested adding it to the db was so that a user could
>  stumble upon it in the db settings table without having to dig
>  through the code to find it.  I've found a few settings this way, but
>  I wasn't sure if this was a common practice. Do new settings not
>  typically get default values in the db?
>

Well, since the users shouldn't be poking around in the DB and should be 
using the GUI to set settings, we shouldn't encourage them to edit the 
DB.  :)

If the devs decide they want to add this setting, it's not difficult to 
add it to the settings wizard, or they may choose to make it an 
"undocumented" setting (i.e. explained only in posts to the lists (such 
as the initial commit and any posts you may send that explain how to use 
it) and/or the wiki).

Mike


More information about the mythtv-dev mailing list