Skip to content

Commit

Permalink
ExternalChannel: When mythbackend is startting up, don't /actually/ t…
Browse files Browse the repository at this point in the history
…une a channel.

Tinning with an External Recorder can take a long time. As long as the
External Recorder can be executed, assume tinning a channel will succeed.
  • Loading branch information
jpoet committed Apr 3, 2020
1 parent 356dd5e commit 7c0b142
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 9 deletions.
37 changes: 28 additions & 9 deletions mythtv/libs/libmythtv/recorders/ExternalChannel.cpp
Expand Up @@ -98,18 +98,37 @@ bool ExternalChannel::Tune(const QString &channum)
return true;

QString result;

LOG(VB_CHANNEL, LOG_INFO, LOC + "Tuning to " + channum);

if (!m_streamHandler->ProcessCommand("TuneChannel:" + channum, result,
20000))
if (m_tuneTimeout < 0)
{
LOG(VB_CHANNEL, LOG_ERR, LOC + QString
("Failed to Tune %1: %2").arg(channum).arg(result));
return false;
// When mythbackend first starts up, just retrive the
// tuneTimeout for subsequent tune requests.

if (!m_streamHandler->ProcessCommand("LockTimeout?", result))
{
LOG(VB_CHANNEL, LOG_ERR, LOC + QString
("Failed to retrieve LockTimeout: %1").arg(result));
m_tuneTimeout = 60000;
}
else
m_tuneTimeout = result.split(":")[1].toInt();

LOG(VB_CHANNEL, LOG_INFO, LOC + QString("Using Tune timeout of %1ms")
.arg(m_tuneTimeout));
}
else
{
LOG(VB_CHANNEL, LOG_INFO, LOC + "Tuning to " + channum);

if (!m_streamHandler->ProcessCommand("TuneChannel:" + channum, result,
m_tuneTimeout))
{
LOG(VB_CHANNEL, LOG_ERR, LOC + QString
("Failed to Tune %1: %2").arg(channum).arg(result));
return false;
}

UpdateDescription();
UpdateDescription();
}

return true;
}
Expand Down
1 change: 1 addition & 0 deletions mythtv/libs/libmythtv/recorders/ExternalChannel.h
Expand Up @@ -52,6 +52,7 @@ class ExternalChannel : public DTVChannel
{ return true; }

private:
int m_tuneTimeout { -1 };
QString m_device;
QStringList m_args;
ExternalStreamHandler *m_streamHandler {nullptr};
Expand Down

0 comments on commit 7c0b142

Please sign in to comment.