Ticket #4931 (closed defect: invalid)
Opened 5 years ago
Last modified 4 years ago
When avoiding conflicts with LiveTV, HandleGetNextFreeRecorder iterates through encoders in wrong order
|Reported by:||Nick Morrott <knowledgejunkie(at)gmail(dot)com>||Owned by:||danielk|
|Severity:||medium||Keywords:||avoid conflicts live tv|
When "Avoid conflicts between live TV and scheduled shows" is enabled, MainServer::HandleGetNextFreeRecorder? seemingly iterates through the available encoders in the wrong order.
If the iterator reaches the end of the encoder list, the function resets the iterator to the beginning of the list (mythtv/programs/mythbackend/mainserver.cpp, lines 2755-8), which surely results in returning the *best* encoder available (and therefore most likely to be used for recordings), rather than the next least-worst encoder (which is the next least likely to conflict with scheduled recordings).
Because the behaviour does not change whether "Avoid conflicts between live TV and scheduled shows" is enabled or not, the only benefit currently seems to be that the *first* card chosen for LiveTV is unlikely to conflict with LiveTV, as MainServer::HandleGetFreeRecorder? takes LastFreeCard? into account, whereas MainServer::HandleGetNextFreeRecorder? does not.
As an example, on my system I have 4 currently configured cards. I have 'avoid conflicts' enabled, and if I fire up Live TV I get the last encoder (#4) as expected. If I then choose the next tuner, I would expect to get the next least-worse (#3) but it cycles back to #1 (the best encoder, if available), and then iterates forwards until the end of the list is reached again.