mirror of
https://github.com/mpv-player/mpv
synced 2025-04-07 10:02:50 +00:00
video: trust demuxer framerate on invalid timestamps
If the PTS goes backwards (whether it's a timestamp reset or some other problem) would just use 0 as frame duration. (At least until the logic for detecting divergence with the timestamps gets active.) Trust the demuxer framerate in these cases instead, if it's available. I think this improves behavior slightly with some broken files.
This commit is contained in:
parent
e6dedbcc23
commit
dd339b200b
@ -1288,7 +1288,7 @@ static void calculate_frame_duration(struct MPContext *mpctx)
|
|||||||
|
|
||||||
double demux_duration = mpctx->vo_chain->container_fps > 0
|
double demux_duration = mpctx->vo_chain->container_fps > 0
|
||||||
? 1.0 / mpctx->vo_chain->container_fps : -1;
|
? 1.0 / mpctx->vo_chain->container_fps : -1;
|
||||||
double duration = -1;
|
double duration = demux_duration;
|
||||||
|
|
||||||
if (mpctx->num_next_frames >= 2) {
|
if (mpctx->num_next_frames >= 2) {
|
||||||
double pts0 = mpctx->next_frames[0]->pts;
|
double pts0 = mpctx->next_frames[0]->pts;
|
||||||
|
Loading…
Reference in New Issue
Block a user