f_decoder_wrapper: fully reset timestamp fixup logic on seeks

This could lead to nonsense when backward playback is involved. Better
reduce the possible interactions. Besides, it's better to fully reset
things on seeks in general.

The only exception is has_broken_packet_pts, which enables hr-seek if
everything looks good. It's intended to trigger at the second hr-seek or
so if the file is normal, and to disable it if the file is broken. It
tries to avoid enabling the hr-seek logic before it can know about
whether things are "good", so resetting it on seeks would obviously
never enable it. Document it as explicit exception.
This commit is contained in:
wm4
2019-05-31 17:51:46 +02:00
parent e86a0df52e
commit ea5c15874a

View File

@@ -72,6 +72,8 @@ struct priv {
double first_packet_pdts;
// There was at least one packet with nonsense timestamps.
// Intentionally not reset on seeks; its whole purpose is to enable faster
// future seeks.
int has_broken_packet_pts; // <0: uninitialized, 0: no problems, 1: broken
int has_broken_decoded_pts;
@@ -107,6 +109,8 @@ static void reset_decoder(struct priv *p)
p->pts = MP_NOPTS_VALUE;
p->codec_pts = MP_NOPTS_VALUE;
p->codec_dts = MP_NOPTS_VALUE;
p->num_codec_pts_problems = 0;
p->num_codec_dts_problems = 0;
p->has_broken_decoded_pts = 0;
p->last_format = p->fixed_format = (struct mp_image_params){0};
p->public.dropped_frames = 0;