diff options
Diffstat (limited to 'player/audio.c')
-rw-r--r-- | player/audio.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/player/audio.c b/player/audio.c index da91dd4340..4fe78953db 100644 --- a/player/audio.c +++ b/player/audio.c @@ -176,7 +176,7 @@ void audio_update_volume(struct MPContext *mpctx) gain = pow(gain, 3); gain *= compute_replaygain(mpctx); gain *= db_gain(opts->softvol_gain); - if (opts->softvol_mute == 1) + if (opts->softvol_mute) gain = 0.0; ao_set_gain(ao_c->ao, gain); @@ -612,13 +612,14 @@ double written_audio_pts(struct MPContext *mpctx) return mpctx->ao_chain ? mpctx->ao_chain->last_out_pts : MP_NOPTS_VALUE; } -// Return pts value corresponding to currently playing audio. +// Return pts value corresponding to currently playing audio adjusted for AO delay +// and playback speed. double playing_audio_pts(struct MPContext *mpctx) { double pts = written_audio_pts(mpctx); if (pts == MP_NOPTS_VALUE || !mpctx->ao) return pts; - return pts - ao_get_delay(mpctx->ao); + return pts - mpctx->audio_speed * ao_get_delay(mpctx->ao); } // This garbage is needed for untimed AOs. These consume audio infinitely fast, @@ -829,8 +830,7 @@ void audio_start_ao(struct MPContext *mpctx) double pts = MP_NOPTS_VALUE; if (!get_sync_pts(mpctx, &pts)) return; - double apts = written_audio_pts(mpctx); - apts -= apts != MP_NOPTS_VALUE ? mpctx->audio_speed * ao_get_delay(mpctx->ao) : 0; + double apts = playing_audio_pts(mpctx); if (pts != MP_NOPTS_VALUE && apts != MP_NOPTS_VALUE && pts < apts && mpctx->video_status != STATUS_EOF) { @@ -967,8 +967,7 @@ void fill_audio_out_buffers(struct MPContext *mpctx) if (mpctx->audio_status == STATUS_DRAINING) { // Wait until the AO has played all queued data. In the gapless case, // we trigger EOF immediately, and let it play asynchronously. - if (!ao_c->ao || (!ao_is_playing(ao_c->ao) || - (opts->gapless_audio && !ao_untimed(ao_c->ao)))) + if (!ao_c->ao || (!ao_is_playing(ao_c->ao) || opts->gapless_audio)) { MP_VERBOSE(mpctx, "audio EOF reached\n"); mpctx->audio_status = STATUS_EOF; |