Permalink
Browse files

MHEG: Fix race condition when restarting the DSMCC after a channel ch…

…ange

When a channel change occurs, the DSMCC file cache must be emptied
so that a consistent filesystem is rebuilt from the new carousel.
MHIContext::Restart, which flushes the cache, is called from TV::ITVRestartv
when the channel or card is changed,  However, the ringbuffer continues
to deliver packets from the old stream for a short period after the
change.  This can produce an invalid file structure which can result
in missing text pages or a failure to start the MHEG app.

This change clears the filesystem cache when a NetBootInfo descriptor
is presented in the PMT, which only occurs after the new stream has started.

Signed-off-by: Lawrence Rust <lvr@softsystem.co.uk>
Signed-off-by: Stuart Morgan <smorgan@mythtv.org>
  • Loading branch information...
Lawrence Rust authored and stuartm committed Feb 28, 2012
1 parent a490607 commit 71af16b7a2ea7b26a21b08a3e316347482d01924
Showing with 5 additions and 1 deletion.
  1. +2 −1 mythtv/libs/libmythtv/dsmcc.cpp
  2. +3 −0 mythtv/libs/libmythtv/mhi.cpp
@@ -558,11 +558,12 @@ void Dsmcc::ProcessSection(const unsigned char *data, int length,
// Reset the object carousel and clear the caches.
void Dsmcc::Reset()
{
LOG(VB_DSMCC, LOG_INFO, "Resetting carousel");
LOG(VB_DSMCC, LOG_INFO, "[dsmcc] Resetting carousel");
QLinkedList<ObjCarousel*>::iterator it = carousels.begin();
for (; it != carousels.end(); ++it)
delete *it;
carousels.clear();
m_startTag = 0;
}
int Dsmcc::GetDSMCCObject(QStringList &objectPath, QByteArray &result)
@@ -311,6 +311,9 @@ void MHIContext::SetNetBootInfo(const unsigned char *data, uint length)
.arg(data[0]).arg(data[1]).arg(length));
QMutexLocker locker(&m_dsmccLock);
// The carousel should be reset now as the stream has changed
m_dsmcc->Reset();
ClearQueue();
// Save the data from the descriptor.
m_nbiData.resize(0);
m_nbiData.reserve(length);

0 comments on commit 71af16b

Please sign in to comment.