From 5af4c81e5be9d245c3780f3cca5515d09b0f5fbf Mon Sep 17 00:00:00 2001 From: wm4 Date: Sun, 1 Feb 2015 18:32:26 +0100 Subject: [PATCH] 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. --- player/video.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/player/video.c b/player/video.c index 0485ba70ec..17530ab279 100644 --- a/player/video.c +++ b/player/video.c @@ -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; }