diff options
author | wm4 <wm4@nowhere> | 2016-02-22 20:13:31 +0100 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2016-02-22 20:13:31 +0100 |
commit | 7c181e5b9b3e429d3202a6d28264a36cbd7d9699 (patch) | |
tree | db259604f6c0c1c8e0a2debadde9443159c0368d /audio | |
parent | 9ee340c3af5c23c2ac877b6559e11bd70c3052ac (diff) | |
download | mpv-7c181e5b9b3e429d3202a6d28264a36cbd7d9699.tar.bz2 mpv-7c181e5b9b3e429d3202a6d28264a36cbd7d9699.tar.xz |
audio: make mp_audio_skip_samples() adjust the PTS
Slight simplification/cleanup.
Diffstat (limited to 'audio')
-rw-r--r-- | audio/audio.c | 4 | ||||
-rw-r--r-- | audio/decode/ad_lavc.c | 2 |
2 files changed, 3 insertions, 3 deletions
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); |