summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMark Kendall <mkendall@mythtv.org>2011-02-15 02:03:22 (GMT)
committer Mark Kendall <mkendall@mythtv.org>2011-02-15 02:03:22 (GMT)
commit316718a140ed5c498b8b84d1c6d0c11fc2838580 (patch)
tree3376fce4d73fd017dceee05df39dcd2e2c85f6b9
parentad1543aefe287de8706c2e8365208b973427f5dd (diff)
Faster pausing when switching programs in live tv.
See http://code.mythtv.org/trac/ticket/9511 and http://code.mythtv.org/trac/ticket/9546 for details. In summary, if we are near the end of the buffer when in live tv, force the reload of the tv chain and return immediately from RingBuffer::WaitFroAvail - before we hit the 'generalWait' condition. Manually cherry-picked from e45da57be5cee702fe9d
-rw-r--r--mythtv/libs/libmythtv/RingBuffer.cpp33
1 files changed, 13 insertions, 20 deletions
diff --git a/mythtv/libs/libmythtv/RingBuffer.cpp b/mythtv/libs/libmythtv/RingBuffer.cpp
index be29124..8b59616 100644
--- a/mythtv/libs/libmythtv/RingBuffer.cpp
+++ b/mythtv/libs/libmythtv/RingBuffer.cpp
@@ -1405,6 +1405,14 @@ bool RingBuffer::WaitForAvail(int count)
int avail = ReadBufAvail();
count = (ateof && avail < count) ? avail : count;
+ if (livetvchain && setswitchtonext && avail < count)
+ {
+ VERBOSE(VB_IMPORTANT, LOC + "Checking to see if there's a "
+ "new livetv program to switch to..");
+ livetvchain->ReloadAll();
+ return false;
+ }
+
MythTimer t;
t.start();
while ((avail < count) && !stopreads &&
@@ -1414,7 +1422,7 @@ bool RingBuffer::WaitForAvail(int count)
generalWait.wait(&rwlock, 250);
avail = ReadBufAvail();
- if ((ateof || setswitchtonext) && avail < count)
+ if (ateof && avail < count)
count = avail;
if (avail < count)
@@ -1433,28 +1441,13 @@ bool RingBuffer::WaitForAvail(int count)
" seconds for data \n\t\t\tto become available..." +
QString(" %2 < %3")
.arg(avail).arg(count));
- if (livetvchain)
- {
- VERBOSE(VB_IMPORTANT, "Checking to see if there's a "
- "new livetv program to switch to..");
- livetvchain->ReloadAll();
- }
}
- bool quit = livetvchain && (livetvchain->NeedsToSwitch() ||
- livetvchain->NeedsToJump() ||
- setswitchtonext);
-
- if (elapsed > 16000 || quit)
+ if (elapsed > 16000)
{
- if (!quit)
- VERBOSE(VB_IMPORTANT, LOC_ERR + "Waited " +
- QString("%1").arg(elapsed/1000) +
- " seconds for data, aborting.");
- else
- VERBOSE(VB_IMPORTANT, LOC + "Timing out wait due to "
- "impending livetv switch.");
-
+ VERBOSE(VB_IMPORTANT, LOC_ERR + "Waited " +
+ QString("%1").arg(elapsed/1000) +
+ " seconds for data, aborting.");
return false;
}
}