lavc_conv: clamp timestamps to positive, fixes idiotic ffmpeg issue

In some cases, demux_mkv will detect a start time slightly above 0, but
there might still be a subtitle starting at exactly 0. When the player
rebases the timestamps to assumed start time, the subtitle will have a
slightly negative timestamp in the end. libavcodec's subtitle converter
turns this into a larger number due to underflow. Fix by clamping
subtitles always to 0, which may or may not be what you want.

At least it fixes #5047.
This commit is contained in:
wm4 2017-10-27 18:40:33 +02:00
parent 3c21694ff0
commit c23c9e22ae
1 changed files with 2 additions and 0 deletions

View File

@ -237,6 +237,8 @@ char **lavc_conv_decode(struct lavc_conv *priv, struct demux_packet *packet)
avsubtitle_free(&priv->cur);
mp_set_av_packet(&pkt, packet, &avctx->time_base);
if (pkt.pts < 0)
pkt.pts = 0;
if (strcmp(priv->codec, "webvtt-webm") == 0) {
if (parse_webvtt(&pkt, &parsed_pkt) < 0) {