diff options
author | Underground78 <underground78@users.sourceforge.net> | 2014-07-24 01:22:56 +0400 |
---|---|---|
committer | Underground78 <underground78@users.sourceforge.net> | 2014-08-03 10:30:26 +0400 |
commit | 0beb0e9d48fb55fe0d5698aeae42ac91410bf513 (patch) | |
tree | 7da01ab015f3facc5855db6d1c46dd8ef408f28f /src/SubPic | |
parent | 8d494fcd586c1bc75f8493d2fa68d5784394aeb3 (diff) |
Subtitle queue: Avoid blinking caused by small rounding error.
Diffstat (limited to 'src/SubPic')
-rw-r--r-- | src/SubPic/SubPicQueueImpl.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/SubPic/SubPicQueueImpl.cpp b/src/SubPic/SubPicQueueImpl.cpp index 0951988c9..75f1b5fac 100644 --- a/src/SubPic/SubPicQueueImpl.cpp +++ b/src/SubPic/SubPicQueueImpl.cpp @@ -579,8 +579,14 @@ DWORD CSubPicQueue::ThreadProc() if (bIsAnimated) {
REFERENCE_TIME rtEndThis = std::min(rtCurrent + rtTimePerSubFrame, rtStopReal);
hr = RenderTo(pStatic, rtCurrent, rtEndThis, fps, bIsAnimated);
+ // Set the segment start and stop timings
pStatic->SetSegmentStart(rtStart);
- pStatic->SetSegmentStop(rtStopReal);
+ // The stop timing can be moved so that the duration from the current start time
+ // of the subpic to the segment end is always at least one video frame long. This
+ // avoids missing subtitle frame due to rounding errors in the timings.
+ // At worst this can cause a segment to be displayed for one more frame than expected
+ // but it's much less annoying than having the subtitle disappearing for one frame
+ pStatic->SetSegmentStop(std::max(rtCurrent + rtTimePerFrame, rtStopReal));
rtCurrent = rtEndThis;
} else {
hr = RenderTo(pStatic, rtStart, rtStopReal, fps, bIsAnimated);
|