Skip to content

Commit

Permalink
Refs #10490. Fix for LiveTV abort on empty recordings.
Browse files Browse the repository at this point in the history
[c3eaf78] avoids creating empty recordings in some cases when it isn't necessary. But it is still possible for these to be created legitamitely when you start livetv near a program transition so this change makes the frontend skip those empty recordings in a LiveTV chain.
  • Loading branch information
daniel-kristjansson committed Apr 5, 2012
1 parent 54595a9 commit d0fcdc9
Showing 1 changed file with 22 additions and 19 deletions.
41 changes: 22 additions & 19 deletions mythtv/libs/libmythtv/livetvchain.cpp
Expand Up @@ -252,6 +252,7 @@ void LiveTVChain::ReloadAll(void)
if (prev_size!=m_chain.size())
{
LOG(VB_PLAYBACK, LOG_INFO, LOC + "ReloadAll(): Added new recording");
LOG(VB_PLAYBACK, LOG_INFO, LOC + toString());
}
}

Expand Down Expand Up @@ -396,6 +397,7 @@ void LiveTVChain::ClearSwitch(void)
ProgramInfo *LiveTVChain::GetSwitchProgram(bool &discont, bool &newtype,
int &newid)
{
ReloadAll();
QMutexLocker lock(&m_lock);

if (m_switchid < 0 || m_curpos == m_switchid)
Expand All @@ -411,7 +413,26 @@ ProgramInfo *LiveTVChain::GetSwitchProgram(bool &discont, bool &newtype,
while (!pginfo && m_switchid < (int)m_chain.count() && m_switchid >= 0)
{
GetEntryAt(m_switchid, entry);
pginfo = EntryToProgram(entry);

bool at_last_entry =
((m_switchid > m_curpos) &&
(m_switchid == (int)(m_chain.count()-1))) ||
((m_switchid <= m_curpos) && (m_switchid == 0));

// Skip dummy recordings, if possible.
if (at_last_entry || (entry.cardtype != "DUMMY"))
pginfo = EntryToProgram(entry);

// Skip empty recordings, if possible
if (pginfo && (0 == pginfo->GetFilesize()) &&
m_switchid < (int)(m_chain.count()-1))
{
LOG(VB_GENERAL, LOG_WARNING,
QString("Skipping empty program %1")
.arg(pginfo->MakeUniqueKey()));
delete pginfo;
pginfo = NULL;
}

if (!pginfo)
{
Expand All @@ -428,24 +449,6 @@ ProgramInfo *LiveTVChain::GetSwitchProgram(bool &discont, bool &newtype,
return NULL;
}

// Skip dummy recordings, if possible.
if (entry.cardtype == "DUMMY")
{
if (m_switchid > m_curpos && m_switchid + 1 < (int)m_chain.count())
m_switchid++;
else if (m_switchid < m_curpos && m_switchid > 0)
m_switchid--;

GetEntryAt(m_switchid, entry);
delete pginfo;
pginfo = EntryToProgram(entry);
if (!pginfo)
{
ClearSwitch();
return NULL;
}
}

discont = true;
if (m_curpos == m_switchid - 1)
discont = entry.discontinuity;
Expand Down

0 comments on commit d0fcdc9

Please sign in to comment.