[mythtv] Multiple tuner conflict resolution bug or feature?

Brad Allen Ulmo-Myth-Dev at Usenet.Q.Net
Sun Jan 18 06:52:19 EST 2004

Some related feature requests.

> This is by design.  the current idea is to avoid using the
> conflict-resolution code whenever possible.  This means that if a
> conflict can be avoided by recording a show at a later time, this is
> the choice taken.
> This behaviour should be quite easy to change, however, the default
> should probably remain as is.  The best reason I can give for this
> is that the user may want to watch live-tv during that time, and if
> all the recorders are in use, he won't be able to.

I.  Directly related to above:  Dynamic scheduling.

As a feature request regarding this point, Myth could keep track of
alternate possibilities even after its initial decision on how to
execute its duties, and then be dynamic.

This way, for example, if there are two inputs, there are two shows to
record that those two inputs can record, and there is a later
recording time available for at least one of the shows, then Myth
would record on both tuners.  Then, if the user wants to
record/capture something else too at that time (either watching Live
TV, or seting up another recording that also conflicts with the two
currently recording), then Myth would be able to reschedule that one
of the active recordings which had an available later time to record
to a later time.  If the user is about to do something which would
cause this to happen (such as commit a conflicting recording or go
into Live TV), Myth would tell the user the various options to choose
from (i.e., recording currently recording show Bla Bla Bla on channel
Blap Blap Blap later and do what you just told me right now on that
card, OR cancel your command).

This way, we get the best of all worlds wrt once-recorded shows: we
get the earliest possible recording of the shows for soonest
availability, and that doesn't take away our ability to flexibly
postpone one of those schedulings when possible in order to appease
the user's new current demands.

II.  Temporary resource reservation for non-Myth events

Another feature request is temporary resource allocation by other
programs; sometimes the user, or even the computer, wants to use
another program besides Myth to perform some function on a resource
that they sometimes want Myth to have access to too.  It might be
using an alternate program that does the same thing as Myth (play a
DVD, record a super special program using particular settings), or one
that does something differently than Myth (broadcast a stream from an
input to eight other rooms and the neighbor's home network too).
Also, this same feature area of Myth could be used to temporarily
disable otherwise configured resources (inputs, outputs, etc.) if they
are not working for some reason (a lightning bolt hit it, the cable
guy came over and disconnected that particular card, the cat knocked
over a vase of water into the digital cable box from the cable company
and it is temporarily out of service drying out, the '350 driver isn't
working this afternoon, that computer is running an important program
but its kernel is partially damaged so you need to cripple it to
finish the program run, etc.).

III.  Redundancy to improve picture and sound quality, even with
partial recordings and fixing them to be as complete as possible.

Thinking toward future feature of redundancy:

Flexibility should be designed into the design of the above to be
accessed by possible future modules which would perform the following

1.  Redundant recording of shows whenever possible (lower priority than
    primary recording);
2.  When any amount of redundancy has been achieved (even if it's a partial
    redundancy), when resources allow (CPU, memory, disk, etc.), do
    quality interpolation for all frames using all possible sources as
    points of data.

For instance, I have antenna input on my pcHDTV HD-2000 card, and
Hauppauge 990 (WinTV PVR 350) connected to cable.  Sometimes I get a
pretty good recording from antenna, but it has a few drops here and
there.  If the show was on twice on antenna, a redundant recording
pass could be performed to fill in missing parts in both of them for a
new better quality recording.  This would require audiovideo
libraries, and such a feature may or may not exist at this point,
however don't lock us out of logic in the scheduler which would allow

Another possible scenereo is one in which both cards could input the
same program at the same time from two different sources; one from
antenna, and another from cable.  Then, it takes the best of both,
once again.  In another scenereo, two cards have access to the same
cable, but a show may be broadcast from two channels.  Myth would need
to know that it can find sections that are not ads, and compare those,
and do so in a redundant way.

Sometimes the benefit won't be that great, but at other times, it will
be very great.  Antenna, cable, input cards, kernel long blocking
interrupt handlers, slow network writes, system unreliabilities due to
power brown-outs, and even partial recordings could all be fixed as
much as possible using redundancy.

I do not expect Isaac to heed my almighty word and suddenly serve this
to me on a silver platter because I thought of it, but I want people
who are working on scheduling to try not to make any unnecessary
assumtions that will make this more difficult to add as a feature in
the future.

IV.  Finish Partial Recordings

Sometimes something interrupts Myth during recording, but it can
return to it at a later time because the show is displaying later.
Myth can try to record the whole thing, but also should be able to
record missing pieces if that will help even if it cannot record a
whole thing.  It already does this to some degree, but since I
actually don't have my '350 working very well for encoding yet, I
don't know how this works.

There may be some times when just recording the whole thing over again
will not be optimal:

a.  Football ended, and there was another program partially recorded
that is now showing, so Myth can go finish the end of that partial
recording even though Myth never had access to a successful contiguous
time slot to do the whole thing.  (Myth would get as many pieces as
possible, hoping to eventually complete the whole thing.  Myth may
prefer to get whole shows during conflicts if it is not certain
starting from current point would fix the partial ones, but otherwise
it can weight them normally if it thinks it can fix partials as well
as get new whole shows.  I actually don't see the football example
above explaining that scenereo, but it's not the only scenereo anyway
-- half hour shows and hour shows, for instance, conflict in
interesting ways.)

b.  Two half hour shows conflict (cut) different halfs of an hour
show, but Myth could collect the two halfs of the hour long show at
different times and splice them together to make a complete whole.  It
may loose a few minutes in the middle, but that's better than nothing.
Perhaps eventually it could go fix them with a third showing.

c.  A user is watching TV.  He sees a commercial.  He informs Myth
it's a commercial.  Myth could do some redundancy during the
commercials for a minute or so in case there is something else playing
that has some good replacement data for another program not completely
recorded.  While rare, keeping the ability for this in design could
help streamline a smart small cohesive method to route these decisions

d.  Program X starts 1 minute early in the schedule (20:59), but
conflicts with something that ends at 21:00.  Program X also
broadcasts in two more hours.  You get home in two hours (at 23:00),
and have been looking forward to watching Program X all day (perhaps
even all week), and it has just started re-playing.  Myth has recorded
the complete program already since it got most of it in the first
broadcast, and the rest of it (the first minute) in the second
broadcast.  You sit down, see the opening scene, and then when the ads
come you can immediately skip forward, without having to wait for 15
minutes for ads to queue past the current time.

e.  During normal operations, Myth may loose a second here or there
while programs are recording.  When available, Myth could buffer each
end of recordings with another ten seconds (with preference for the
beginning rather than the end), just to make certain opening scenes
are not cut, by using other scheduling times.  At least the main body
of the recording would be available early so a user can watch it as
soon as possible, but if the user does not demand faster service, they
can get a more complete recording just by doing nothing.

Right now I'm thinking of Stargate SG-1 which opens exactly on the
stroke of the hour (and I've run NTP since circa 1987) with an
extremely important new scene, right after, say, some other program
just stopped recording; other programs do this too (not everything is
like the Simpsons or Charmed with big lead ins, but even *then* I want
to see all the opening variations, since often they are as good as or
better than the shows themselves.

f.  Movies.  They don't always start and end at nice delimiters.

g.  I just thought of another thing I've experienced before in a VOD
region: VOD.  Myth could record you a VOD, and try and try and try
again until it actually has a complete recording; many cable companies
give you 24 hour lease on VOD programs, but then fail to deliver
necessary capacity during your entire watching (or a sunspot happens
(a favorite excuse of Customer Service)).  If Myth knew how to order
it, it could bring it up and run it, even seeking forward and
backward, until it has the whole thing.

Oh ... so THAT's why VOD kept crashing --- they must have had a whole
bunch of PVR 350's with IVTV & some Myth lookalike :) (just kidding)


More information about the mythtv-dev mailing list