1
0
mirror of https://github.com/mpv-player/mpv synced 2025-02-18 13:47:04 +00:00

player: dump audio jitter to stats file

This allows us to plot the difference between video timestamps, and the
adjusted video timestamps due to syncing video to audio speed.
This commit is contained in:
wm4 2015-02-01 18:32:26 +01:00
parent 12dbbcbb15
commit 5af4c81e5b

View File

@ -662,7 +662,11 @@ static void update_avsync_before_frame(struct MPContext *mpctx)
!ao_untimed(mpctx->ao)) !ao_untimed(mpctx->ao))
{ {
double buffered_audio = ao_get_delay(mpctx->ao); double buffered_audio = ao_get_delay(mpctx->ao);
MP_TRACE(mpctx, "audio delay=%f\n", buffered_audio);
double predicted = mpctx->delay / opts->playback_speed +
mpctx->time_frame;
double difference = buffered_audio - predicted;
MP_STATS(mpctx, "value %f audio-diff", difference);
if (opts->autosync) { if (opts->autosync) {
/* Smooth reported playback position from AO by averaging /* Smooth reported playback position from AO by averaging
@ -672,9 +676,6 @@ static void update_avsync_before_frame(struct MPContext *mpctx)
* This is badly implemented; the behavior of the smoothing * This is badly implemented; the behavior of the smoothing
* now undesirably depends on how often this code runs * now undesirably depends on how often this code runs
* (mainly depends on video frame rate). */ * (mainly depends on video frame rate). */
double predicted = mpctx->delay / opts->playback_speed +
mpctx->time_frame;
double difference = buffered_audio - predicted;
buffered_audio = predicted + difference / opts->autosync; buffered_audio = predicted + difference / opts->autosync;
} }