From 7c181e5b9b3e429d3202a6d28264a36cbd7d9699 Mon Sep 17 00:00:00 2001 From: wm4 Date: Mon, 22 Feb 2016 20:13:31 +0100 Subject: audio: make mp_audio_skip_samples() adjust the PTS Slight simplification/cleanup. --- audio/audio.c | 4 +++- audio/decode/ad_lavc.c | 2 -- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'audio') diff --git a/audio/audio.c b/audio/audio.c index 6f5e1e2df6..ae85a4bf08 100644 --- a/audio/audio.c +++ b/audio/audio.c @@ -252,6 +252,9 @@ void mp_audio_skip_samples(struct mp_audio *data, int samples) data->planes[n] = (uint8_t *)data->planes[n] + samples * data->sstride; data->samples -= samples; + + if (data->pts != MP_NOPTS_VALUE) + data->pts += samples / (double)data->rate; } // Clip the given frame to the given timestamp range. Adjusts the frame size @@ -280,7 +283,6 @@ void mp_audio_clip_timestamps(struct mp_audio *f, double start, double end) int skip = (start - f->pts) * f->rate; skip = MPCLAMP(skip, 0, f->samples); mp_audio_skip_samples(f, skip); - f->pts += skip / (double)f->rate; } } } diff --git a/audio/decode/ad_lavc.c b/audio/decode/ad_lavc.c index 64095b0018..c30aff7fd5 100644 --- a/audio/decode/ad_lavc.c +++ b/audio/decode/ad_lavc.c @@ -254,8 +254,6 @@ static int decode_packet(struct dec_audio *da, struct demux_packet *mpkt, uint32_t skip = MPMIN(priv->skip_samples, mpframe->samples); if (skip) { mp_audio_skip_samples(mpframe, skip); - if (mpframe->pts != MP_NOPTS_VALUE) - mpframe->pts += skip / (double)mpframe->rate; priv->skip_samples -= skip; } uint32_t trim = MPMIN(priv->trim_samples, mpframe->samples); -- cgit v1.2.3