summaryrefslogtreecommitdiffstats
path: root/player
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2014-03-07 15:23:03 +0100
committerwm4 <wm4@nowhere>2014-03-07 15:23:03 +0100
commit74b7001500c0901b095986fafe7dca3e5c23c7f2 (patch)
treedaee66eb3955ff8bff726b916171a81a4bf0e451 /player
parent4579d9ca58ee50dba6cb45e4f27e85f2ebbb8269 (diff)
downloadmpv-74b7001500c0901b095986fafe7dca3e5c23c7f2.tar.bz2
mpv-74b7001500c0901b095986fafe7dca3e5c23c7f2.tar.xz
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.
Diffstat (limited to 'player')
-rw-r--r--player/audio.c4
1 files changed, 4 insertions, 0 deletions
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);