aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar wm4 <wm4@nowhere>2015-05-24 20:57:31 +0200
committerGravatar wm4 <wm4@nowhere>2015-05-24 23:27:23 +0200
commitf3dcd85150e1403433b75b42834c626b0719d6ca (patch)
tree0f0100f97214ae20325fc2b98a313e25b42601b9
parent58e7d0a30be40efbdce93d9a79b6a7def4d36451 (diff)
video: do not use MP_NOPTS_VALUE for A/V difference
There's no need for this, it just creates more corner cases. Also always reset it on seeks etc..
-rw-r--r--player/command.c2
-rw-r--r--player/osd.c5
-rw-r--r--player/video.c3
3 files changed, 3 insertions, 7 deletions
diff --git a/player/command.c b/player/command.c
index 3e6a4da9f1..ad04969eb3 100644
--- a/player/command.c
+++ b/player/command.c
@@ -505,8 +505,6 @@ static int mp_property_avsync(void *ctx, struct m_property *prop,
MPContext *mpctx = ctx;
if (!mpctx->d_audio || !mpctx->d_video)
return M_PROPERTY_UNAVAILABLE;
- if (mpctx->last_av_difference == MP_NOPTS_VALUE)
- return M_PROPERTY_UNAVAILABLE;
if (action == M_PROPERTY_PRINT) {
*(char **)arg = talloc_asprintf(NULL, "%7.3f", mpctx->last_av_difference);
return M_PROPERTY_OK;
diff --git a/player/osd.c b/player/osd.c
index 1f482e2a14..c775197276 100644
--- a/player/osd.c
+++ b/player/osd.c
@@ -207,10 +207,7 @@ static void print_status(struct MPContext *mpctx)
// A-V sync
if (mpctx->d_audio && mpctx->d_video && mpctx->sync_audio_to_video) {
- if (mpctx->last_av_difference != MP_NOPTS_VALUE)
- saddf(&line, " A-V:%7.3f", mpctx->last_av_difference);
- else
- saddf(&line, " A-V: ???");
+ saddf(&line, " A-V:%7.3f", mpctx->last_av_difference);
if (fabs(mpctx->total_avsync_change) > 0.05)
saddf(&line, " ct:%7.3f", mpctx->total_avsync_change);
}
diff --git a/player/video.c b/player/video.c
index 4e89416db7..bd9c82e788 100644
--- a/player/video.c
+++ b/player/video.c
@@ -215,6 +215,7 @@ void reset_video_state(struct MPContext *mpctx)
mpctx->video_pts = MP_NOPTS_VALUE;
mpctx->video_next_pts = MP_NOPTS_VALUE;
mpctx->total_avsync_change = 0;
+ mpctx->last_av_difference = 0;
mpctx->dropped_frames_total = 0;
mpctx->dropped_frames = 0;
mpctx->drop_message_shown = 0;
@@ -737,7 +738,7 @@ static void update_avsync_after_frame(struct MPContext *mpctx)
if (mpctx->time_frame > 0)
mpctx->last_av_difference += mpctx->time_frame * opts->playback_speed;
if (a_pos == MP_NOPTS_VALUE || mpctx->video_pts == MP_NOPTS_VALUE) {
- mpctx->last_av_difference = MP_NOPTS_VALUE;
+ mpctx->last_av_difference = 0;
} else if (fabs(mpctx->last_av_difference) > 0.5 && !mpctx->drop_message_shown) {
MP_WARN(mpctx, "%s", av_desync_help_text);
mpctx->drop_message_shown = true;