summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2013-02-03 19:27:52 +0100
committerwm4 <wm4@nowhere>2013-02-03 21:08:26 +0100
commitd302ac285f9c5ada104c23ba5c31ddc24f5ab560 (patch)
tree26f7958d2becd434cdbffe05988c6b530c1cbcbd /core
parentcc5cf98348a2f3675565be65480278ba401ba98a (diff)
downloadmpv-d302ac285f9c5ada104c23ba5c31ddc24f5ab560.tar.bz2
mpv-d302ac285f9c5ada104c23ba5c31ddc24f5ab560.tar.xz
mplayer: reset audio/video delay if there's no next video frame
mpctx->delay is used to control audio/video sync. If more audio than video has been played, it grows larger, meaning A/V desync is happening. This logic is a bit broken when video has ended, and audio is still playing. In that case, it tries to read additional video frames from the video decoder (because even if you don't feed new packets to the decoder, it could still return delayed frames). For that, the code to determine whether frames should be dropped is invoked (check_framedrop()). This function detects that video is behind audio (mpctx- >delay growing big), and attempts to issue a framedrop. Reset mpctx->delay if there's no more video. This fixes the the frame drop display "counting up" on each playloop iteration when playing audio files with cover art. These files are basically audio+video files with a single video frame. When playing these files the the corner case of having run out of video while audio is still playing is the normal case. Also reset mpctx->last_av_difference. This is not updated anymore if video ends (since update_avsync() sets it, but it's not called if video_left is false). This removes the "stuck" A/V sync value when video ends. With audio files containing cover art we would display a meaningless value over the duration of the whole file otherwise.
Diffstat (limited to 'core')
-rw-r--r--core/mplayer.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/core/mplayer.c b/core/mplayer.c
index a7761b4da5..6d0405620b 100644
--- a/core/mplayer.c
+++ b/core/mplayer.c
@@ -3264,6 +3264,10 @@ static void run_playloop(struct MPContext *mpctx)
mpctx->time_frame += frame_time / opts->playback_speed;
adjust_sync(mpctx, frame_time);
}
+ if (!video_left) {
+ mpctx->delay = 0;
+ mpctx->last_av_difference = 0;
+ }
}
if (endpts != MP_NOPTS_VALUE)