mirror of
https://github.com/mpv-player/mpv
synced 2024-12-25 08:12:17 +00:00
player: minor changes
This shouldn't change anything functionally. Change the A/V desync message. --framedrop is enabled by default now, so the text must be changed a little. I've never heard of audio outputs messing up A/V sync recently, so remove that part. Remove the unused ao_pts field. Reorder 2 A/V sync related expressions so that they look the same.
This commit is contained in:
parent
f4ccf22e16
commit
f104ef1282
@ -276,7 +276,6 @@ static int write_to_ao(struct MPContext *mpctx, struct mp_audio *data, int flags
|
||||
struct ao *ao = mpctx->ao;
|
||||
struct mp_audio out_format;
|
||||
ao_get_format(ao, &out_format);
|
||||
mpctx->ao_pts = pts;
|
||||
#if HAVE_ENCODING
|
||||
encode_lavc_set_audio_pts(mpctx->encode_lavc_ctx, playing_audio_pts(mpctx));
|
||||
#endif
|
||||
@ -288,9 +287,6 @@ static int write_to_ao(struct MPContext *mpctx, struct mp_audio *data, int flags
|
||||
if (played > 0) {
|
||||
mpctx->shown_aframes += played;
|
||||
mpctx->delay += played / real_samplerate;
|
||||
// Keep correct pts for remaining data - could be used to flush
|
||||
// remaining buffer when closing ao.
|
||||
mpctx->ao_pts += played / real_samplerate;
|
||||
return played;
|
||||
}
|
||||
return 0;
|
||||
@ -343,7 +339,7 @@ static bool get_sync_samples(struct MPContext *mpctx, int *skip)
|
||||
}
|
||||
|
||||
if (sync_to_video)
|
||||
sync_pts += mpctx->delay - mpctx->audio_delay;
|
||||
sync_pts -= mpctx->audio_delay - mpctx->delay;
|
||||
|
||||
double ptsdiff = written_pts - sync_pts;
|
||||
// Missing timestamp, or PTS reset, or just broken.
|
||||
|
@ -235,7 +235,6 @@ typedef struct MPContext {
|
||||
|
||||
struct mixer *mixer;
|
||||
struct ao *ao;
|
||||
double ao_pts;
|
||||
struct mp_audio *ao_decoder_fmt; // for weak gapless audio check
|
||||
struct mp_audio_buffer *ao_buffer; // queued audio; passed to ao_play() later
|
||||
|
||||
@ -253,9 +252,9 @@ typedef struct MPContext {
|
||||
double hrseek_pts;
|
||||
// AV sync: the next frame should be shown when the audio out has this
|
||||
// much (in seconds) buffered data left. Increased when more data is
|
||||
// written to the ao, decreased when moving to the next frame.
|
||||
// written to the ao, decreased when moving to the next video frame.
|
||||
double delay;
|
||||
// AV sync: time until next frame should be shown
|
||||
// AV sync: time in seconds until next frame should be shown
|
||||
double time_frame;
|
||||
// Optional/additional AV sync compensation if video is too slow.
|
||||
double insert_silence;
|
||||
|
@ -66,13 +66,9 @@ static const char av_desync_help_text[] =
|
||||
"Possible reasons, problems, workarounds:\n"
|
||||
"- Your system is simply too slow for this file.\n"
|
||||
" Transcode it to a lower bitrate file with tools like HandBrake.\n"
|
||||
"- Broken/buggy _audio_ driver.\n"
|
||||
" Experiment with different values for --autosync, 30 is a good start.\n"
|
||||
" If you have PulseAudio, try --ao=alsa .\n"
|
||||
"- Slow video output.\n"
|
||||
" Try a different --vo driver (--vo=help for a list) or try --framedrop!\n"
|
||||
"- Playing a video file with --vo=opengl with higher FPS than the monitor.\n"
|
||||
" This is due to vsync limiting the framerate.\n"
|
||||
" Try a different --vo driver (--vo=help for a list). Make sure framedrop\n"
|
||||
" is not disabled, or experiment with different values for --framedrop.\n"
|
||||
"- Playing from a slow network source.\n"
|
||||
" Download the file instead.\n"
|
||||
"- Try to find out whether audio/video/subs are causing this by experimenting\n"
|
||||
@ -473,9 +469,8 @@ static void adjust_sync(struct MPContext *mpctx, double v_pts, double frame_time
|
||||
if (mpctx->audio_status != STATUS_PLAYING)
|
||||
return;
|
||||
|
||||
double a_pts = written_audio_pts(mpctx) - mpctx->delay;
|
||||
double a_pts = written_audio_pts(mpctx) + mpctx->audio_delay - mpctx->delay;
|
||||
double av_delay = a_pts - v_pts;
|
||||
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