summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDudemanguy <random342@airmail.cc>2024-03-02 15:27:19 -0600
committerDudemanguy <random342@airmail.cc>2024-03-03 16:27:59 -0600
commit9ac791c329aa967d6034da1543e03c777b09f4ef (patch)
tree6fb7042ac7062e4a103822f9ab2c4f63128bd681
parentd10cebec1317d1fd9006f3bd3bdc6d75e399ebaa (diff)
downloadmpv-9ac791c329aa967d6034da1543e03c777b09f4ef.tar.bz2
mpv-9ac791c329aa967d6034da1543e03c777b09f4ef.tar.xz
Revert "player: reset av state on speed changes"
Ended up being too flawed and caused trouble in other areas. There's other approaches to trying to solve the issue this meant to address in the works that should be better, so let's wait on that. Fixes #13613 and fixes #13622. This reverts commit e3af545421322e357eb9355395923710ea93f83b.
-rw-r--r--player/command.c1
-rw-r--r--player/core.h1
-rw-r--r--player/video.c22
3 files changed, 2 insertions, 22 deletions
diff --git a/player/command.c b/player/command.c
index e1de32be25..5b61ae3498 100644
--- a/player/command.c
+++ b/player/command.c
@@ -7246,7 +7246,6 @@ void mp_option_change_callback(void *ctx, struct m_config_option *co, int flags,
if (opt_ptr == &opts->playback_speed) {
update_playback_speed(mpctx);
- reset_av_state(mpctx);
mp_wakeup_core(mpctx);
}
diff --git a/player/core.h b/player/core.h
index fc5e2e3937..5e97b6d868 100644
--- a/player/core.h
+++ b/player/core.h
@@ -637,7 +637,6 @@ void update_osd_msg(struct MPContext *mpctx);
bool update_subtitles(struct MPContext *mpctx, double video_pts);
// video.c
-void reset_av_state(struct MPContext *mpctx);
void reset_video_state(struct MPContext *mpctx);
int init_video_decoder(struct MPContext *mpctx, struct track *track);
void reinit_video_chain(struct MPContext *mpctx);
diff --git a/player/video.c b/player/video.c
index c33f947659..908299baa1 100644
--- a/player/video.c
+++ b/player/video.c
@@ -45,8 +45,6 @@
#include "command.h"
#include "screenshot.h"
-#define MIN_PAST_FRAMES 10
-
enum {
// update_video() - code also uses: <0 error, 0 eof, >0 progress
VD_ERROR = -1,
@@ -97,17 +95,6 @@ static void vo_chain_reset_state(struct vo_chain *vo_c)
vo_c->underrun_signaled = false;
}
-void reset_av_state(struct MPContext *mpctx)
-{
- mpctx->delay = 0;
- mpctx->display_sync_drift_dir = 0;
- mpctx->display_sync_error = 0;
- mpctx->last_av_difference = 0;
- mpctx->logged_async_diff = -1;
- mpctx->num_past_frames = 0;
- mpctx->total_avsync_change = 0;
-}
-
void reset_video_state(struct MPContext *mpctx)
{
if (mpctx->vo_chain) {
@@ -606,9 +593,7 @@ static void update_avsync_before_frame(struct MPContext *mpctx)
if (mpctx->video_status < STATUS_READY) {
mpctx->time_frame = 0;
- } else if (mpctx->display_sync_active || vo->opts->video_sync == VS_NONE ||
- mpctx->num_past_frames <= MIN_PAST_FRAMES)
- {
+ } else if (mpctx->display_sync_active || vo->opts->video_sync == VS_NONE) {
// don't touch the timing
} else if (mpctx->audio_status == STATUS_PLAYING &&
mpctx->video_status == STATUS_PLAYING &&
@@ -742,7 +727,7 @@ static double compute_audio_drift(struct MPContext *mpctx, double vsync)
// audio desync for y. Assume speed didn't change for the frames we're
// looking at for simplicity. This also should actually use the realtime
// (minus paused time) for x, but use vsync scheduling points instead.
- if (mpctx->num_past_frames <= MIN_PAST_FRAMES)
+ if (mpctx->num_past_frames <= 10)
return NAN;
int num = mpctx->num_past_frames - 1;
double sum_x = 0, sum_y = 0, sum_xy = 0, sum_xx = 0;
@@ -847,9 +832,6 @@ static void handle_display_sync_frame(struct MPContext *mpctx,
if (resample && using_spdif_passthrough(mpctx))
return;
- if (mpctx->num_past_frames <= MIN_PAST_FRAMES)
- return;
-
double vsync = vo_get_vsync_interval(vo) / 1e9;
if (vsync <= 0)
return;