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.
This commit is contained in:
Dudemanguy 2024-05-25 14:46:54 -05:00
parent d93f53b324
commit 5988473b76
2 changed files with 2 additions and 2 deletions

View File

@ -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); queue_seek(mpctx, MPSEEK_ABSOLUTE, *(double *)arg, MPSEEK_DEFAULT, 0);
return M_PROPERTY_OK; 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) /// Current audio pts in seconds (R)

View File

@ -335,7 +335,7 @@ void mp_write_watch_later_conf(struct MPContext *mpctx)
write_filename(mpctx, file, path); write_filename(mpctx, file, path);
bool write_start = true; bool write_start = true;
double pos = get_current_time(mpctx); double pos = get_playback_time(mpctx);
if ((demux && (!demux->seekable || demux->partially_seekable)) || if ((demux && (!demux->seekable || demux->partially_seekable)) ||
pos == MP_NOPTS_VALUE) pos == MP_NOPTS_VALUE)