From 5988473b7624d82cb6c523463eaf66b2a5aa0c5d Mon Sep 17 00:00:00 2001 From: Dudemanguy Date: Sat, 25 May 2024 14:46:54 -0500 Subject: [PATCH] player: replace get_current_time with get_playback_time in some spots The problem with using get_current_time is that it can return negative values. Interally in mpv, we need this but for some spots negative values are not great. Since the previous commit enforced nonnegative returns for get_playback_time, we can use that instead. The two areas changed here are watch later configfile writing (clearly should always be a positive number) and the time-pos property (negative numbers are nonsense for users). This fully fixes #10346. --- player/command.c | 2 +- player/configfiles.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/player/command.c b/player/command.c index 0d4c0ce9ca..a60e918f3b 100644 --- a/player/command.c +++ b/player/command.c @@ -820,7 +820,7 @@ static int mp_property_time_pos(void *ctx, struct m_property *prop, queue_seek(mpctx, MPSEEK_ABSOLUTE, *(double *)arg, MPSEEK_DEFAULT, 0); return M_PROPERTY_OK; } - return property_time(action, arg, get_current_time(mpctx)); + return property_time(action, arg, get_playback_time(mpctx)); } /// Current audio pts in seconds (R) diff --git a/player/configfiles.c b/player/configfiles.c index 5eaf5b197e..3ecb5a19c8 100644 --- a/player/configfiles.c +++ b/player/configfiles.c @@ -335,7 +335,7 @@ void mp_write_watch_later_conf(struct MPContext *mpctx) write_filename(mpctx, file, path); bool write_start = true; - double pos = get_current_time(mpctx); + double pos = get_playback_time(mpctx); if ((demux && (!demux->seekable || demux->partially_seekable)) || pos == MP_NOPTS_VALUE)