summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMark Kendall <mkendall@mythtv.org>2011-02-12 09:08:31 (GMT)
committer Mark Kendall <mkendall@mythtv.org>2011-02-12 09:08:31 (GMT)
commite45da57be5cee702fe9d8bb4ba700bcc3f310848 (patch)
tree00a858986391dd7e3b5b59ba3fb39eb853cb6096
parente3b63db691422f3116c10bb0bff61b5d89c833a1 (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. Closes #9546
-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 e58d320..3923a34 100644
--- a/mythtv/libs/libmythtv/ringbuffer.cpp
+++ b/mythtv/libs/libmythtv/ringbuffer.cpp
@@ -932,6 +932,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 &&
@@ -941,7 +949,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)
@@ -960,28 +968,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;
}
}