From 74b7001500c0901b095986fafe7dca3e5c23c7f2 Mon Sep 17 00:00:00 2001 From: wm4 Date: Fri, 7 Mar 2014 15:23:03 +0100 Subject: encode: don't access ao->pts This field will be moved out of the ao struct. The encoding code was basically using an invalid way of accessing this field. Since the AO will be moved into its own thread too and will do its own buffering, the AO and the playback core might not even agree which sample a PTS timestamp belongs to. Add some extrapolation code to handle this case. --- player/audio.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'player') diff --git a/player/audio.c b/player/audio.c index ed4d0f5f2a..984243b639 100644 --- a/player/audio.c +++ b/player/audio.c @@ -26,6 +26,7 @@ #include "talloc.h" #include "common/msg.h" +#include "common/encode.h" #include "options/options.h" #include "common/common.h" @@ -252,6 +253,9 @@ static int write_to_ao(struct MPContext *mpctx, struct mp_audio *data, int flags return 0; struct ao *ao = mpctx->ao; ao->pts = pts; +#if HAVE_ENCODING + encode_lavc_set_audio_pts(mpctx->encode_lavc_ctx, ao->pts); +#endif double real_samplerate = ao->samplerate / mpctx->opts->playback_speed; int played = ao_play(mpctx->ao, data->planes, data->samples, flags); assert(played <= data->samples); -- cgit v1.2.3