mirror of
https://github.com/mpv-player/mpv
synced 2025-02-17 13:17:13 +00:00
Fix audio delay inversion
This commit is contained in:
parent
936a204e27
commit
cd53de958d
@ -591,8 +591,8 @@ OPTIONS
|
||||
``--cursor-autohide``.
|
||||
|
||||
``--audio-delay=<sec>``
|
||||
Audio delay in seconds (positive or negative float value). Negative values
|
||||
delay the audio, and positive values delay the video.
|
||||
Audio delay in seconds (positive or negative float value). Positive values
|
||||
delay the audio, and negative values delay the video.
|
||||
|
||||
``--deinterlace=<yes|no|auto>``
|
||||
Enable or disable interlacing (default: auto, which usually means no).
|
||||
|
@ -306,7 +306,7 @@ static int audio_start_sync(struct MPContext *mpctx, int playsize)
|
||||
ptsdiff = written_pts - mpctx->hrseek_pts;
|
||||
else
|
||||
ptsdiff = written_pts - mpctx->video_next_pts - mpctx->delay
|
||||
- mpctx->audio_delay;
|
||||
+ mpctx->audio_delay;
|
||||
samples = ptsdiff * real_samplerate;
|
||||
|
||||
// ogg demuxers give packets without timing
|
||||
@ -410,7 +410,7 @@ int fill_audio_out_buffers(struct MPContext *mpctx, double endpts)
|
||||
}
|
||||
|
||||
if (endpts != MP_NOPTS_VALUE) {
|
||||
double samples = (endpts - written_audio_pts(mpctx) + mpctx->audio_delay)
|
||||
double samples = (endpts - written_audio_pts(mpctx) - mpctx->audio_delay)
|
||||
* ao->samplerate / opts->playback_speed;
|
||||
if (playsize > samples) {
|
||||
playsize = MPMAX(samples, 0);
|
||||
|
@ -595,7 +595,7 @@ static void update_avsync(struct MPContext *mpctx)
|
||||
|
||||
double a_pos = playing_audio_pts(mpctx);
|
||||
|
||||
mpctx->last_av_difference = a_pos - mpctx->video_pts - mpctx->audio_delay;
|
||||
mpctx->last_av_difference = a_pos - mpctx->video_pts + mpctx->audio_delay;
|
||||
if (mpctx->time_frame > 0)
|
||||
mpctx->last_av_difference +=
|
||||
mpctx->time_frame * mpctx->opts->playback_speed;
|
||||
@ -629,7 +629,7 @@ static void adjust_sync(struct MPContext *mpctx, double frame_time)
|
||||
double av_delay = a_pts - v_pts;
|
||||
// Try to sync vo_flip() so it will *finish* at given time
|
||||
av_delay += mpctx->last_vo_flip_duration;
|
||||
av_delay -= mpctx->audio_delay; // This much pts difference is desired
|
||||
av_delay += mpctx->audio_delay; // This much pts difference is desired
|
||||
|
||||
double change = av_delay * 0.1;
|
||||
double max_change = opts->default_max_pts_correction >= 0 ?
|
||||
|
Loading…
Reference in New Issue
Block a user