mirror of https://github.com/mpv-player/mpv
command: add mistimed-frame-count property
Does what the manpage says. This is a replacement incrementing the dropped frame counter (see previous commit).
This commit is contained in:
parent
acd5816a6d
commit
7aba3a5d96
|
@ -913,6 +913,14 @@ Property list
|
||||||
``vo-drop-frame-count``
|
``vo-drop-frame-count``
|
||||||
Frames dropped by VO (when using ``--framedrop=vo``).
|
Frames dropped by VO (when using ``--framedrop=vo``).
|
||||||
|
|
||||||
|
``mistimed-frame-count``
|
||||||
|
Number of video frames that were not timed correctly in display-sync mode
|
||||||
|
for the sake of keeping A/V sync. This does not include external
|
||||||
|
circumstances, such as video rendering being too slow or the graphics
|
||||||
|
driver somehow skipping a vsync. It does not include rounding errors either
|
||||||
|
(which can happen especially with bad source timestamps). For example,
|
||||||
|
using the ``display-desync`` mode should never change this value from 0.
|
||||||
|
|
||||||
``percent-pos`` (RW)
|
``percent-pos`` (RW)
|
||||||
Position in current file (0-100). The advantage over using this instead of
|
Position in current file (0-100). The advantage over using this instead of
|
||||||
calculating it out of other properties is that it properly falls back to
|
calculating it out of other properties is that it properly falls back to
|
||||||
|
|
|
@ -553,8 +553,6 @@ static int mp_property_total_avsync_change(void *ctx, struct m_property *prop,
|
||||||
return m_property_double_ro(action, arg, mpctx->total_avsync_change);
|
return m_property_double_ro(action, arg, mpctx->total_avsync_change);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/// Late frames
|
|
||||||
static int mp_property_drop_frame_cnt(void *ctx, struct m_property *prop,
|
static int mp_property_drop_frame_cnt(void *ctx, struct m_property *prop,
|
||||||
int action, void *arg)
|
int action, void *arg)
|
||||||
{
|
{
|
||||||
|
@ -565,6 +563,16 @@ static int mp_property_drop_frame_cnt(void *ctx, struct m_property *prop,
|
||||||
return m_property_int_ro(action, arg, mpctx->dropped_frames_total);
|
return m_property_int_ro(action, arg, mpctx->dropped_frames_total);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int mp_property_mistimed_frame_count(void *ctx, struct m_property *prop,
|
||||||
|
int action, void *arg)
|
||||||
|
{
|
||||||
|
MPContext *mpctx = ctx;
|
||||||
|
if (!mpctx->d_video || !mpctx->display_sync_active)
|
||||||
|
return M_PROPERTY_UNAVAILABLE;
|
||||||
|
|
||||||
|
return m_property_int_ro(action, arg, mpctx->mistimed_frames_total);
|
||||||
|
}
|
||||||
|
|
||||||
static int mp_property_vo_drop_frame_count(void *ctx, struct m_property *prop,
|
static int mp_property_vo_drop_frame_count(void *ctx, struct m_property *prop,
|
||||||
int action, void *arg)
|
int action, void *arg)
|
||||||
{
|
{
|
||||||
|
@ -3383,6 +3391,7 @@ static const struct m_property mp_properties[] = {
|
||||||
{"avsync", mp_property_avsync},
|
{"avsync", mp_property_avsync},
|
||||||
{"total-avsync-change", mp_property_total_avsync_change},
|
{"total-avsync-change", mp_property_total_avsync_change},
|
||||||
{"drop-frame-count", mp_property_drop_frame_cnt},
|
{"drop-frame-count", mp_property_drop_frame_cnt},
|
||||||
|
{"mistimed-frame-count", mp_property_mistimed_frame_count},
|
||||||
{"vo-drop-frame-count", mp_property_vo_drop_frame_count},
|
{"vo-drop-frame-count", mp_property_vo_drop_frame_count},
|
||||||
{"vo-missed-frame-count", mp_property_vo_missed_frame_count},
|
{"vo-missed-frame-count", mp_property_vo_missed_frame_count},
|
||||||
{"percent-pos", mp_property_percent_pos},
|
{"percent-pos", mp_property_percent_pos},
|
||||||
|
@ -3601,7 +3610,7 @@ static const char *const *const mp_event_property_change[] = {
|
||||||
"percent-pos", "time-remaining", "playtime-remaining", "playback-time",
|
"percent-pos", "time-remaining", "playtime-remaining", "playback-time",
|
||||||
"estimated-vf-fps", "drop-frame-count", "vo-drop-frame-count",
|
"estimated-vf-fps", "drop-frame-count", "vo-drop-frame-count",
|
||||||
"total-avsync-change", "audio-speed-correction", "video-speed-correction",
|
"total-avsync-change", "audio-speed-correction", "video-speed-correction",
|
||||||
"vo-missed-frame-count"),
|
"vo-missed-frame-count", "mistimed-frame-count"),
|
||||||
E(MPV_EVENT_VIDEO_RECONFIG, "video-out-params", "video-params",
|
E(MPV_EVENT_VIDEO_RECONFIG, "video-out-params", "video-params",
|
||||||
"video-format", "video-codec", "video-bitrate", "dwidth", "dheight",
|
"video-format", "video-codec", "video-bitrate", "dwidth", "dheight",
|
||||||
"width", "height", "fps", "aspect", "vo-configured", "current-vo",
|
"width", "height", "fps", "aspect", "vo-configured", "current-vo",
|
||||||
|
|
|
@ -269,6 +269,8 @@ typedef struct MPContext {
|
||||||
// Timing error (in seconds) due to rounding on vsync boundaries
|
// Timing error (in seconds) due to rounding on vsync boundaries
|
||||||
double display_sync_error;
|
double display_sync_error;
|
||||||
int display_sync_disable_counter;
|
int display_sync_disable_counter;
|
||||||
|
// Number of mistimed frames.
|
||||||
|
int mistimed_frames_total;
|
||||||
/* Set if audio should be timed to start with video frame after seeking,
|
/* Set if audio should be timed to start with video frame after seeking,
|
||||||
* not set when e.g. playing cover art */
|
* not set when e.g. playing cover art */
|
||||||
bool sync_audio_to_video;
|
bool sync_audio_to_video;
|
||||||
|
|
|
@ -211,6 +211,7 @@ void reset_video_state(struct MPContext *mpctx)
|
||||||
mpctx->display_sync_disable_counter = 0;
|
mpctx->display_sync_disable_counter = 0;
|
||||||
mpctx->dropped_frames_total = 0;
|
mpctx->dropped_frames_total = 0;
|
||||||
mpctx->dropped_frames = 0;
|
mpctx->dropped_frames = 0;
|
||||||
|
mpctx->mistimed_frames_total = 0;
|
||||||
mpctx->drop_message_shown = 0;
|
mpctx->drop_message_shown = 0;
|
||||||
mpctx->display_sync_drift_dir = 0;
|
mpctx->display_sync_drift_dir = 0;
|
||||||
|
|
||||||
|
@ -1034,6 +1035,9 @@ static void handle_display_sync_frame(struct MPContext *mpctx,
|
||||||
// Likewise, we know sync is off, but is going to be compensated.
|
// Likewise, we know sync is off, but is going to be compensated.
|
||||||
time_left += drop_repeat * vsync;
|
time_left += drop_repeat * vsync;
|
||||||
|
|
||||||
|
if (drop_repeat)
|
||||||
|
mpctx->mistimed_frames_total += 1;
|
||||||
|
|
||||||
mpctx->total_avsync_change = 0;
|
mpctx->total_avsync_change = 0;
|
||||||
update_av_diff(mpctx, time_left);
|
update_av_diff(mpctx, time_left);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue