summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMark Kendall <mkendall@mythtv.org>2011-04-07 03:09:02 (GMT)
committer Mark Kendall <mkendall@mythtv.org>2011-04-07 03:09:02 (GMT)
commitafe5669be72c3c452dfb626d362ed9166ac916cd (patch)
tree7c501ea4f03318d4a540cffb5eb666534d94dcb9
parenta41a2adb506f26ecfe237d71acfb0834dc3e60d1 (diff)
MythPlayer: Pause the audio when the video is lagging.
When using software decoding and the decoder is struggling to keep up, audio sync may take a long time to recover after startup or following a skip. Under certain conditions, playback never recovers and because we are constantly skipping frames, the user sees no screen updates - and hence playback looks entirely broken. By pausing the audio when skipping frames, we allow video playback to catch up.
-rw-r--r--mythtv/libs/libmythtv/mythplayer.cpp13
-rw-r--r--mythtv/libs/libmythtv/mythplayer.h1
2 files changed, 13 insertions, 1 deletions
diff --git a/mythtv/libs/libmythtv/mythplayer.cpp b/mythtv/libs/libmythtv/mythplayer.cpp
index f3c6968..ed0c0a9 100644
--- a/mythtv/libs/libmythtv/mythplayer.cpp
+++ b/mythtv/libs/libmythtv/mythplayer.cpp
@@ -201,7 +201,7 @@ MythPlayer::MythPlayer(bool muted)
avsync_predictor(0), avsync_predictor_enabled(false),
refreshrate(0),
lastsync(false), repeat_delay(0),
- disp_timecode(0),
+ disp_timecode(0), avsync_audiopaused(false),
// Time Code stuff
prevtc(0), prevrp(0),
// LiveTVChain stuff
@@ -1717,12 +1717,23 @@ void MythPlayer::AVSync(VideoFrame *buffer, bool limit_delay)
.arg(-diverge);
}
+ if (!dropframe && avsync_audiopaused)
+ {
+ avsync_audiopaused = false;
+ audio.Pause(false);
+ }
+
if (dropframe)
{
// Reset A/V Sync
lastsync = true;
currentaudiotime = AVSyncGetAudiotime();
VERBOSE(VB_PLAYBACK, LOC + dbg + "dropping frame to catch up.");
+ if (!audio.IsPaused())
+ {
+ audio.Pause(true);
+ avsync_audiopaused = true;
+ }
}
else if (!using_null_videoout)
{
diff --git a/mythtv/libs/libmythtv/mythplayer.h b/mythtv/libs/libmythtv/mythplayer.h
index c60494e..e7e35f6 100644
--- a/mythtv/libs/libmythtv/mythplayer.h
+++ b/mythtv/libs/libmythtv/mythplayer.h
@@ -712,6 +712,7 @@ class MTV_PUBLIC MythPlayer
bool decode_extra_audio;
int repeat_delay;
int64_t disp_timecode;
+ bool avsync_audiopaused;
// Time Code stuff
int prevtc; ///< 32 bit timecode if last VideoFrame shown