summaryrefslogtreecommitdiffstats
path: root/player
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2014-08-25 21:28:56 +0200
committerwm4 <wm4@nowhere>2014-08-25 21:39:24 +0200
commitf104ef12827278c5620b57a34d066b333bbdfa32 (patch)
treecbdffdf6c6a265b49c18130546f34578f06e471f /player
parentf4ccf22e1695e89fb6fcf97f92fc492a2bdc5b97 (diff)
downloadmpv-f104ef12827278c5620b57a34d066b333bbdfa32.tar.bz2
mpv-f104ef12827278c5620b57a34d066b333bbdfa32.tar.xz
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.
Diffstat (limited to 'player')
-rw-r--r--player/audio.c6
-rw-r--r--player/core.h5
-rw-r--r--player/video.c11
3 files changed, 6 insertions, 16 deletions
diff --git a/player/audio.c b/player/audio.c
index a044a422cc..cc5629a6e6 100644
--- a/player/audio.c
+++ b/player/audio.c
@@ -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.
diff --git a/player/core.h b/player/core.h
index 800b9bf90a..fb335851d9 100644
--- a/player/core.h
+++ b/player/core.h
@@ -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;
diff --git a/player/video.c b/player/video.c
index 391d2c02bd..7aaef07f4f 100644
--- a/player/video.c
+++ b/player/video.c
@@ -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 ?