diff --git a/mythtv/libs/libmythtv/mythplayer.cpp b/mythtv/libs/libmythtv/mythplayer.cpp
index 5a6777a..871d778 100644
a
|
b
|
MythPlayer::MythPlayer(PlayerFlags flags) |
154 | 154 | fftime(0), |
155 | 155 | // Playback misc. |
156 | 156 | videobuf_retries(0), framesPlayed(0), |
| 157 | prebufferFramesPlayed(0), |
157 | 158 | framesPlayedExtra(0), |
158 | 159 | totalFrames(0), totalLength(0), |
159 | 160 | totalDuration(0), |
… |
… |
bool MythPlayer::PrebufferEnoughFrames(int min_buffers) |
2208 | 2209 | videoOutput->EnoughDecodedFrames()))) |
2209 | 2210 | { |
2210 | 2211 | SetBuffering(true); |
| 2212 | // This pece of code is to address the problem when starting |
| 2213 | // Live TV of jerking and stuttering. Without this code |
| 2214 | // that could go on forever, but is ured by a pause and play. |
| 2215 | // This code inserts a bried pause and play when the potential |
| 2216 | // for the jerking is detected. |
| 2217 | if (prebufferFramesPlayed != framesPlayed) |
| 2218 | { |
| 2219 | float current = ComputeSecs(framesPlayed, true); |
| 2220 | float length = ComputeSecs(totalFrames, true); |
| 2221 | if (prebufferFramesPlayed != framesPlayed |
| 2222 | && length > current && length - current < 1.5) |
| 2223 | { |
| 2224 | LOG(VB_PLAYBACK, LOG_NOTICE, LOC + |
| 2225 | QString("Pause to allow live tv catch up. Position in sec. Current: %2, Total: %3") |
| 2226 | .arg(current).arg(length)); |
| 2227 | if (!audio.IsPaused()) |
| 2228 | { |
| 2229 | audio.Pause(true); |
| 2230 | avsync_audiopaused = true; |
| 2231 | } |
| 2232 | prebufferFramesPlayed = framesPlayed; |
| 2233 | } |
| 2234 | } |
2211 | 2235 | usleep(frame_interval >> 3); |
2212 | 2236 | int waited_for = buffering_start.msecsTo(QTime::currentTime()); |
2213 | 2237 | int last_msg = buffering_last_msg.msecsTo(QTime::currentTime()); |
diff --git a/mythtv/libs/libmythtv/mythplayer.h b/mythtv/libs/libmythtv/mythplayer.h
index 6581ca6..8b55108 100644
a
|
b
|
class MTV_PUBLIC MythPlayer |
695 | 695 | /// How often we have tried to wait for a video output buffer and failed |
696 | 696 | int videobuf_retries; |
697 | 697 | uint64_t framesPlayed; |
| 698 | uint64_t prebufferFramesPlayed; |
698 | 699 | // "Fake" frame counter for when the container frame rate doesn't |
699 | 700 | // match the stream frame rate. |
700 | 701 | uint64_t framesPlayedExtra; |