mirror of
https://github.com/mpv-player/mpv
synced 2025-02-03 13:41:49 +00:00
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:
parent
3c21694ff0
commit
c23c9e22ae
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user