summaryrefslogtreecommitdiffstats
path: root/video/decode
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2016-08-19 14:19:46 +0200
committerwm4 <wm4@nowhere>2016-08-19 14:59:30 +0200
commit05e4df3f0c7679e8ac3b32a1a414be751b6b6b37 (patch)
tree82341aaaf7d4e82800d0555b3e39dfd2ddb6a77f /video/decode
parent4aaa83339ca9515113e936af79bc3d860d67cb4b (diff)
downloadmpv-05e4df3f0c7679e8ac3b32a1a414be751b6b6b37.tar.bz2
mpv-05e4df3f0c7679e8ac3b32a1a414be751b6b6b37.tar.xz
video/audio: always provide "proper" timestamps to libavcodec
Instead of passing through double float timestamps opaquely, pass real timestamps. Do so by always setting a valid timebase on the AVCodecContext for audio and video decoding. Specifically try not to round timestamps to a too coarse timebase, which could round off small adjustments to timestamps (such as for start time rebasing or demux_timeline). If the timebase is considered too coarse, make it finer. This gets rid of the need to do this specifically for some hardware decoding wrapper. The old method of passing through double timestamps was also a bit questionable. While libavcodec is not supposed to interpret timestamps at all if no timebase is provided, it was needlessly tricky. Also, it actually does compare them with AV_NOPTS_VALUE. This change will probably also reduce confusion in the future.
Diffstat (limited to 'video/decode')
-rw-r--r--video/decode/vd_lavc.c5
1 files changed, 1 insertions, 4 deletions
diff --git a/video/decode/vd_lavc.c b/video/decode/vd_lavc.c
index eb63e58e92..804bf1112d 100644
--- a/video/decode/vd_lavc.c
+++ b/video/decode/vd_lavc.c
@@ -449,10 +449,7 @@ static void init_avctx(struct dec_video *vd, const char *decoder,
if (!lavc_codec)
return;
- ctx->codec_timebase = (AVRational){0};
- if (strstr(decoder, "_mmal") || strstr(decoder, "_mediacodec"))
- ctx->codec_timebase = (AVRational){1, 1000000};
-
+ ctx->codec_timebase = mp_get_codec_timebase(vd->codec);
ctx->pix_fmt = AV_PIX_FMT_NONE;
ctx->hwdec = hwdec;
ctx->hwdec_fmt = 0;