Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

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 e45da57
  • Loading branch information...
commit 316718a140ed5c498b8b84d1c6d0c11fc2838580 1 parent ad1543a
Mark Kendall authored

Showing 1 changed file with 13 additions and 20 deletions. Show diff stats Hide diff stats

  1. +13 20 mythtv/libs/libmythtv/RingBuffer.cpp
33 mythtv/libs/libmythtv/RingBuffer.cpp
@@ -1405,6 +1405,14 @@ bool RingBuffer::WaitForAvail(int count)
1405 1405 int avail = ReadBufAvail();
1406 1406 count = (ateof && avail < count) ? avail : count;
1407 1407
  1408 + if (livetvchain && setswitchtonext && avail < count)
  1409 + {
  1410 + VERBOSE(VB_IMPORTANT, LOC + "Checking to see if there's a "
  1411 + "new livetv program to switch to..");
  1412 + livetvchain->ReloadAll();
  1413 + return false;
  1414 + }
  1415 +
1408 1416 MythTimer t;
1409 1417 t.start();
1410 1418 while ((avail < count) && !stopreads &&
@@ -1414,7 +1422,7 @@ bool RingBuffer::WaitForAvail(int count)
1414 1422 generalWait.wait(&rwlock, 250);
1415 1423 avail = ReadBufAvail();
1416 1424
1417   - if ((ateof || setswitchtonext) && avail < count)
  1425 + if (ateof && avail < count)
1418 1426 count = avail;
1419 1427
1420 1428 if (avail < count)
@@ -1433,28 +1441,13 @@ bool RingBuffer::WaitForAvail(int count)
1433 1441 " seconds for data \n\t\t\tto become available..." +
1434 1442 QString(" %2 < %3")
1435 1443 .arg(avail).arg(count));
1436   - if (livetvchain)
1437   - {
1438   - VERBOSE(VB_IMPORTANT, "Checking to see if there's a "
1439   - "new livetv program to switch to..");
1440   - livetvchain->ReloadAll();
1441   - }
1442 1444 }
1443 1445
1444   - bool quit = livetvchain && (livetvchain->NeedsToSwitch() ||
1445   - livetvchain->NeedsToJump() ||
1446   - setswitchtonext);
1447   -
1448   - if (elapsed > 16000 || quit)
  1446 + if (elapsed > 16000)
1449 1447 {
1450   - if (!quit)
1451   - VERBOSE(VB_IMPORTANT, LOC_ERR + "Waited " +
1452   - QString("%1").arg(elapsed/1000) +
1453   - " seconds for data, aborting.");
1454   - else
1455   - VERBOSE(VB_IMPORTANT, LOC + "Timing out wait due to "
1456   - "impending livetv switch.");
1457   -
  1448 + VERBOSE(VB_IMPORTANT, LOC_ERR + "Waited " +
  1449 + QString("%1").arg(elapsed/1000) +
  1450 + " seconds for data, aborting.");
1458 1451 return false;
1459 1452 }
1460 1453 }

0 comments on commit 316718a

Please sign in to comment.
Something went wrong with that request. Please try again.