summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAman Gupta <aman@tmm1.net>2016-10-20 11:11:56 -0700
committerwm4 <wm4@nowhere>2016-10-21 17:11:26 +0200
commit7cd32ec29e9641362f4a14e4e1284040f9af9930 (patch)
tree0c5755bbb4abf4a8b852944a1e11f7183d06b929
parent183af9d72eac25efc4b6a6a92249963cec5793f0 (diff)
downloadmpv-7cd32ec29e9641362f4a14e4e1284040f9af9930.tar.bz2
mpv-7cd32ec29e9641362f4a14e4e1284040f9af9930.tar.xz
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.
-rw-r--r--player/audio.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/player/audio.c b/player/audio.c
index 3f173f140d..5c393f3d3a 100644
--- a/player/audio.c
+++ b/player/audio.c
@@ -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)