[mythtv] [PATCH] Changing channels in the background
Jack Porter
jack at porter.net.au
Wed Mar 2 04:22:16 UTC 2005
Hi,
While waiting for the external program to exit is one source of the
delay in channel changing, the rest of the delay involves pausing the
ringbuffer, asking the backend to change the channel (potentially over a
network), etc.
IMO the actual channel changing should be asynchronous to the user
interface (key presses/OSD update). At the moment the backend decides
what the "next" and "previous" channels are when you press the up and
down channel buttons. Instead, the frontend should do as much as
possible locally, and update the OSD immediately. A background thread
should then look to see if the currently requested channel is different
from the actual channel and perform the actual channel change there.
My digital cable box takes more than a second to change channels but
it's still a pleasure to channel surf because the OSD instantly shows
the program title and the channel change occurs in the background as
soon as you stop pressing the channel up or down button. If you
overshoot, your desired channel, just go back and it never gets caught.
In Myth if you overshoot, it buffers your button presses and you sit
there for 10-15 seconds as it does unnecessary channel changes to catch
up to your old commands.
I've been planning on implement something like this for a while, but
haven't had the chance yet.
- Jack
Chris Bagwell wrote:
> Hi all,
>
> I've just set up my first mythtv box using Mythtv 0.71 and getting
> confortable with it. My only complaint so far is that changing channels
> takes to long (I'm a channel surfer I guess). Changing channels takes
> between 5-8 seconds, usually closer to 8 seconds. For reference, I've
> got an EPIA-M(tvout)+IVTV+256Mram setup.
>
> So I'm researching things that could speed up changing channels. The
> first thing I noticed was that running my external changer script takes
> ~3 seconds. I've got a dish network receiver and so I have to use an IR
> blaster and have around 0.3 pauses between button pushes. This adds up
> to seconds fast. Example log:
>
> 2005-02-28 18:59:13.991 External channel change:
> /home/mythtv/changechannel.sh 21
> 2005-02-28 18:59:14.005 Waiting for External Tuning program to exit
> 2005-02-28 18:59:15.236 ret_pid(0) child(6508) status(0x0)
> 2005-02-28 18:59:16.476 ret_pid(0) child(6508) status(0x0)
> 2005-02-28 18:59:17.519 ret_pid(6508) child(6508) status(0x0)
> 2005-02-28 18:59:17.522 External Tuning program no longer running
> 2005-02-28 18:59:17.525 External Tuning program exited with no error
>
> Mythtv is currently waiting for the external script to complete before
> doing more work. It would seem that running the script in the
> background would be a better approach so that mythtv can be doing some
> concurrent work while the script does its "sleep 0.3".
>
> So I've coded up a quick proof of concept to do this. It does shave a
> second or two off change changes in my tests. I've included the patch
> below.
>
> I'd like to get some feedback on if there are reasons that this isn't
> the current behaviour and other things like any issues with using
> VERBOSE() from a forked process. If its of interested, I'd be glad to
> clean it up some and resend (for example, kinda overkill to do the
> timeout check on the first fork now).
>
> Next up, I'm hoping some recent cvs commits to ivtvdecoder.cpp will help
> speed up channel changes as well. I'll be testing that out next.
>
> Gist of patch: Do a double fork() and immediately exit from first
> fork(). This will deamon-ize the external channel changer. Had to do a
> third fork() to allow the timeout cleanup code to keep working.
>
> Chris
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> mythtv-dev mailing list
> mythtv-dev at mythtv.org
> http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-dev
More information about the mythtv-dev
mailing list