diff --git a/mythtv/libs/libmythtv/mythplayer.cpp b/mythtv/libs/libmythtv/mythplayer.cpp
index 5b80c452a3..acf1d16193 100644
|
a
|
b
|
void wait_for_time(int64_t framedue)
|
| 2170 | 2170 | QThread::usleep(delay); |
| 2171 | 2171 | } |
| 2172 | 2172 | |
| 2173 | | #define AVSYNC_MAX_LATE 1000000 |
| | 2173 | #define AVSYNC_MAX_LATE 10000000 |
| 2174 | 2174 | void MythPlayer::AVSync2(VideoFrame *buffer) |
| 2175 | 2175 | { |
| 2176 | 2176 | if (videoOutput->IsErrored()) |
| … |
… |
void MythPlayer::AVSync2(VideoFrame *buffer)
|
| 2249 | 2249 | // Get video in sync with audio |
| 2250 | 2250 | audio_adjustment = audiotimecode - videotimecode; |
| 2251 | 2251 | int sign = audio_adjustment < 0 ? -1 : 1; |
| | 2252 | int64_t fix_amount = avsync2adjustms; |
| | 2253 | // Faster catch-up when off by more than 200 ms |
| | 2254 | if (audio_adjustment * sign > 200) |
| | 2255 | { |
| | 2256 | fix_amount = audio_adjustment * sign - 200; |
| | 2257 | if (fix_amount < avsync2adjustms) |
| | 2258 | fix_amount = avsync2adjustms; |
| | 2259 | } |
| | 2260 | // If there is excess audio - throw it away. |
| | 2261 | // if (audio_adjustment < -300) |
| | 2262 | // audio.Reset(); |
| 2252 | 2263 | if (audio_adjustment * sign > 40) |
| 2253 | 2264 | { |
| 2254 | 2265 | // adjust by AVSyncIncrementMS milliseconds at a time (range 1-40) |
| 2255 | | rtcbase -= (int64_t)1000000 * avsync2adjustms * sign / playspeed1000; |
| | 2266 | int64_t speedup1000 = (float)1000 * play_speed; |
| | 2267 | rtcbase -= (int64_t)1000000 * fix_amount * sign / speedup1000; |
| 2256 | 2268 | LOG(VB_PLAYBACK, LOG_INFO, LOC + |
| 2257 | 2269 | QString("AV Sync, audio ahead by %1 ms").arg(audio_adjustment)); |
| 2258 | 2270 | } |