Skip to content

Commit

Permalink
Avoid calling RemoveAllPIDFilters() when using Vchan tuning
Browse files Browse the repository at this point in the history
The first step is to improve the error messages. In two places
the "UpdateFilters called in wrong tune mode" message has been
updated to specify the value of the wrong tune mode.

After this update, an example of the error message is:

 mythbackend: mythbackend[779282]: E HDHRStreamHandleri
   hdhrstreamhandler.cpp:242 (UpdateFilters) HDHRSH[4](13249773):i
   UpdateFilters called in wrong tune mode, 4

From this, we know that the tune mode was hdhrTuneModeVChannel.
We know that UpdateFilters was called, but in hdhrstreamhandler.cpp,
the only call to it is avoided for Vchan tuning.

108 void HDHRStreamHandler::run(void)
...
140             UpdateFiltersFromStreamData();
141             if (m_tuneMode != hdhrTuneModeVChannel)
142                 UpdateFilters();

Code examination revealed that the offending invocation of
UpdateFilters() is in RemoveAllPIDFilters().

This routine is called unconditionally in

108 void HDHRStreamHandler::run(void)
...
183     LOG(VB_RECORD, LOG_INFO, LOC + "RunTS(): " + "shutdown");
184
185     RemoveAllPIDFilters();

The solution is to condition the call to RemoveAllPIDFilters()
in the same way the call to UpdateFilters() was previously
conditioned. If we're using Virtual Channel Tuning, then don't
bother removing filters which were never created in the first
place.

Resolves #905
  • Loading branch information
SteveErl authored and kmdewaal committed Jun 1, 2024
1 parent f593133 commit a448cbe
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions mythtv/libs/libmythtv/recorders/hdhrstreamhandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,10 @@ void HDHRStreamHandler::run(void)
}
LOG(VB_RECORD, LOG_INFO, LOC + "RunTS(): " + "shutdown");

RemoveAllPIDFilters();
if (m_tuneMode != hdhrTuneModeVChannel)
{
RemoveAllPIDFilters();
}

{
QMutexLocker locker(&m_hdhrLock);
Expand Down Expand Up @@ -237,7 +240,8 @@ bool HDHRStreamHandler::UpdateFilters(void)
if (m_tuneMode != hdhrTuneModeFrequencyPid)
{
LOG(VB_GENERAL, LOG_ERR, LOC +
"UpdateFilters called in wrong tune mode");
QString("UpdateFilters called in wrong tune mode, %1")
.arg(m_tuneMode));
return false;
}

Expand Down Expand Up @@ -529,7 +533,9 @@ bool HDHRStreamHandler::TuneProgram(uint mpeg_prog_num)

if (m_tuneMode != hdhrTuneModeFrequencyProgram)
{
LOG(VB_GENERAL, LOG_ERR, LOC + "TuneProgram called in wrong tune mode");
LOG(VB_GENERAL, LOG_ERR, LOC +
QString("TuneProgram called in wrong tune mode, %1")
.arg(m_tuneMode));
return false;
}

Expand Down

0 comments on commit a448cbe

Please sign in to comment.