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
1 changed files with 5 additions and 4 deletions

View File

@ -662,7 +662,11 @@ static void update_avsync_before_frame(struct MPContext *mpctx)
!ao_untimed(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) {
/* 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
* now undesirably depends on how often this code runs
* (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;
}