diff options
Diffstat (limited to 'player/audio.c')
-rw-r--r-- | player/audio.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/player/audio.c b/player/audio.c index 7a29b110ae..d1e4c83a9a 100644 --- a/player/audio.c +++ b/player/audio.c @@ -800,8 +800,11 @@ static bool copy_output(struct MPContext *mpctx, struct mp_audio_buffer *outbuf, if (endpts != MP_NOPTS_VALUE) { double rate = afs->output.rate / mpctx->audio_speed; double curpts = written_audio_pts(mpctx); - if (curpts != MP_NOPTS_VALUE) - maxsamples = (endpts - curpts - mpctx->opts->audio_delay) * rate; + if (curpts != MP_NOPTS_VALUE) { + double remaining = + (endpts - curpts - mpctx->opts->audio_delay) * rate; + maxsamples = MPCLAMP(remaining, 0, INT_MAX); + } } struct mp_audio *mpa = af_read_output_frame(afs); |