audio: force pts_reset only when pts jumps forward more than 5s

i've seen several mpegts samples where pts jumps backwards and repeats
itself. this usually happens on live tv streams from cable providers,
particularly when the stream switches from one advertisement to another.
This commit is contained in:
Aman Gupta 2016-10-20 11:11:56 -07:00 committed by wm4
parent 183af9d72e
commit 7cd32ec29e
1 changed files with 2 additions and 2 deletions

View File

@ -840,8 +840,8 @@ static int filter_audio(struct MPContext *mpctx, struct mp_audio_buffer *outbuf,
// Attempt to detect jumps in PTS. Even for the lowest sample rates
// and with worst container rounded timestamp, this should be a
// margin more than enough.
double desync = fabs(mpa->pts - ao_c->pts);
if (ao_c->pts != MP_NOPTS_VALUE && desync > 0.1) {
double desync = mpa->pts - ao_c->pts;
if (ao_c->pts != MP_NOPTS_VALUE && fabs(desync) > 0.1) {
MP_WARN(ao_c, "Invalid audio PTS: %f -> %f\n",
ao_c->pts, mpa->pts);
if (desync >= 5)