<html><head></head><body>Hi,<br><br>Seems fine. We should use unsigned in input_stats_t but that's a separate issue.<br><br><div class="gmail_quote">Le 10 août 2020 08:48:47 GMT+03:00, Steve Lhomme <robux4@ycbcr.xyz> a écrit :<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<pre class="k9mail">We already count the number of displayed frames, the number of dropped frames<br>(called lost). We should also count the frames that are actually displayed but<br>not in the desired time. It usually indicates the decoder is too slow or the<br>rendering to the display is too slow even though it may not be directly<br>visible (movements not smooth).<hr> include/vlc_input_item.h | 1 +<br> src/input/decoder.c | 5 +++--<br> src/input/decoder.h | 2 +-<br> src/input/es_out.c | 4 +++-<br> src/input/input_internal.h | 1 +<br> src/input/stats.c | 3 +++<br> src/video_output/statistic.h | 11 ++++++++++-<br> src/video_output/video_output.c | 5 +++--<br> src/video_output/vout_internal.h | 2 +-<br> 9 files changed, 26 insertions(+), 8 deletions(-)<br><br>diff --git a/include/vlc_input_item.h b/include/vlc_input_item.h<br>index 1c99f6c0122..8e5ffc98eca 100644<br>--- a/include/vlc_input_item.h<br>+++ b/include/vlc_input_item.h<br>@@ -520,6 +520,7 @@ struct input_stats_t<br> <br> /* Vout */<br> int64_t i_displayed_pictures;<br>+ int64_t i_late_pictures;<br> int64_t i_lost_pictures;<br> <br> /* Aout */<br>diff --git a/src/input/decoder.c b/src/input/decoder.c<br>index 99c5f12e12f..5aa8ead4baa 100644<br>--- a/src/input/decoder.c<br>+++ b/src/input/decoder.c<br>@@ -1080,13 +1080,14 @@ static void ModuleThread_UpdateStatVideo( vlc_input_decoder_t *p_owner,<br> {<br> unsigned displayed = 0;<br> unsigned vout_lost = 0;<br>+ unsigned vout_late = 0;<br> if( p_owner->p_vout != NULL )<br> {<br>- vout_GetResetStatistic( p_owner->p_vout, &displayed, &vout_lost );<br>+ vout_GetResetStatistic( p_owner->p_vout, &displayed, &vout_lost, &vout_late );<br> }<br> if (lost) vout_lost++;<br> <br>- decoder_Notify(p_owner, on_new_video_stats, 1, vout_lost, displayed);<br>+ decoder_Notify(p_owner, on_new_video_stats, 1, vout_lost, displayed, vout_late);<br> }<br> <br> static void ModuleThread_QueueVideo( decoder_t *p_dec, picture_t *p_pic )<br>diff --git a/src/input/decoder.h b/src/input/decoder.h<br>index b5a05e232e5..f8dede84179 100644<br>--- a/src/input/decoder.h<br>+++ b/src/input/decoder.h<br>@@ -39,7 +39,7 @@ struct vlc_input_decoder_callbacks {<br> void *userdata);<br> <br> void (*on_new_video_stats)(vlc_input_decoder_t *decoder, unsigned decoded,<br>- unsigned lost, unsigned displayed,<br>+ unsigned lost, unsigned displayed, unsigned late,<br> void *userdata);<br> void (*on_new_audio_stats)(vlc_input_decoder_t *decoder, unsigned decoded,<br> unsigned lost, unsigned played, void *userdata);<br>diff --git a/src/input/es_out.c b/src/input/es_out.c<br>index 2ad863021c6..89d819b4c5b 100644<br>--- a/src/input/es_out.c<br>+++ b/src/input/es_out.c<br>@@ -344,7 +344,7 @@ decoder_on_thumbnail_ready(vlc_input_decoder_t *decoder, picture_t *pic, void *u<br> <br> static void<br> decoder_on_new_video_stats(vlc_input_decoder_t *decoder, unsigned decoded, unsigned lost,<br>- unsigned displayed, void *userdata)<br>+ unsigned displayed, unsigned late, void *userdata)<br> {<br> (void) decoder;<br> <br>@@ -365,6 +365,8 @@ decoder_on_new_video_stats(vlc_input_decoder_t *decoder, unsigned decoded, unsig<br> memory_order_relaxed);<br> atomic_fetch_add_explicit(&stats->displayed_pictures, displayed,<br> memory_order_relaxed);<br>+ atomic_fetch_add_explicit(&stats->late_pictures, late,<br>+ memory_order_relaxed);<br> }<br> <br> static void<br>diff --git a/src/input/input_internal.h b/src/input/input_internal.h<br>index 1391571eeaa..f99e6805eb7 100644<br>--- a/src/input/input_internal.h<br>+++ b/src/input/input_internal.h<br>@@ -729,6 +729,7 @@ struct input_stats {<br> atomic_uintmax_t played_abuffers;<br> atomic_uintmax_t lost_abuffers;<br> atomic_uintmax_t displayed_pictures;<br>+ atomic_uintmax_t late_pictures;<br> atomic_uintmax_t lost_pictures;<br> };<br> <br>diff --git a/src/input/stats.c b/src/input/stats.c<br>index b294a59e98e..bd41a34d755 100644<br>--- a/src/input/stats.c<br>+++ b/src/input/stats.c<br>@@ -66,6 +66,7 @@ struct input_stats *input_stats_Create(void)<br> atomic_init(&stats->played_abuffers, 0);<br> atomic_init(&stats->lost_abuffers, 0);<br> atomic_init(&stats->displayed_pictures, 0);<br>+ atomic_init(&stats->late_pictures, 0);<br> atomic_init(&stats->lost_pictures, 0);<br> return stats;<br> }<br>@@ -106,6 +107,8 @@ void input_stats_Compute(struct input_stats *stats, input_stats_t *st)<br> memory_order_relaxed);<br> st->i_displayed_pictures = atomic_load_explicit(&stats->displayed_pictures,<br> memory_order_relaxed);<br>+ st->i_late_pictures = atomic_load_explicit(&stats->late_pictures,<br>+ memory_order_relaxed);<br> st->i_lost_pictures = atomic_load_explicit(&stats->lost_pictures,<br> memory_order_relaxed);<br> }<br>diff --git a/src/video_output/statistic.h b/src/video_output/statistic.h<br>index a3fc6ed2c7d..54ee775cf05 100644<br>--- a/src/video_output/statistic.h<br>+++ b/src/video_output/statistic.h<br>@@ -30,12 +30,14 @@<br> typedef struct {<br> atomic_uint displayed;<br> atomic_uint lost;<br>+ atomic_uint late;<br> } vout_statistic_t;<br> <br> static inline void vout_statistic_Init(vout_statistic_t *stat)<br> {<br> atomic_init(&stat->displayed, 0);<br> atomic_init(&stat->lost, 0);<br>+ atomic_init(&stat->late, 0);<br> }<br> <br> static inline void vout_statistic_Clean(vout_statistic_t *stat)<br>@@ -45,11 +47,13 @@ static inline void vout_statistic_Clean(vout_statistic_t *stat)<br> <br> static inline void vout_statistic_GetReset(vout_statistic_t *stat,<br> unsigned *restrict displayed,<br>- unsigned *restrict lost)<br>+ unsigned *restrict lost,<br>+ unsigned *restrict late)<br> {<br> *displayed = atomic_exchange_explicit(&stat->displayed, 0,<br> memory_order_relaxed);<br> *lost = atomic_exchange_explicit(&stat->lost, 0, memory_order_relaxed);<br>+ *late = atomic_exchange_explicit(&stat->late, 0, memory_order_relaxed);<br> }<br> <br> static inline void vout_statistic_AddDisplayed(vout_statistic_t *stat,<br>@@ -64,4 +68,9 @@ static inline void vout_statistic_AddLost(vout_statistic_t *stat, int lost)<br> atomic_fetch_add_explicit(&stat->lost, lost, memory_order_relaxed);<br> }<br> <br>+static inline void vout_statistic_AddLate(vout_statistic_t *stat, int late)<br>+{<br>+ atomic_fetch_add_explicit(&stat->late, late, memory_order_relaxed);<br>+}<br>+<br> #endif<br>diff --git a/src/video_output/video_output.c b/src/video_output/video_output.c<br>index ea24ad6a15a..6cf7a426673 100644<br>--- a/src/video_output/video_output.c<br>+++ b/src/video_output/video_output.c<br>@@ -347,11 +347,11 @@ static void vout_UpdateWindowSizeLocked(vout_thread_sys_t *vout)<br> <br> /* */<br> void vout_GetResetStatistic(vout_thread_t *vout, unsigned *restrict displayed,<br>- unsigned *restrict lost)<br>+ unsigned *restrict lost, unsigned *restrict late)<br> {<br> vout_thread_sys_t *sys = VOUT_THREAD_TO_SYS(vout);<br> assert(!sys->dummy);<br>- vout_statistic_GetReset( &sys->statistic, displayed, lost );<br>+ vout_statistic_GetReset( &sys->statistic, displayed, lost, late );<br> }<br> <br> bool vout_IsEmpty(vout_thread_t *vout)<br>@@ -1083,6 +1083,7 @@ static int ThreadDisplayPreparePicture(vout_thread_sys_t *vout, bool reuse,<br> continue;<br> } else if (late > 0) {<br> msg_Dbg(&vout->obj, "picture might be displayed late (missing %"PRId64" ms)", MS_FROM_VLC_TICK(late));<br>+ vout_statistic_AddLate(&sys->statistic, 1);<br> }<br> }<br> vlc_video_context *pic_vctx = picture_GetVideoContext(decoded);<br>diff --git a/src/video_output/vout_internal.h b/src/video_output/vout_internal.h<br>index 9dbed097093..3f5a81c98eb 100644<br>--- a/src/video_output/vout_internal.h<br>+++ b/src/video_output/vout_internal.h<br>@@ -176,7 +176,7 @@ void vout_MouseState(vout_thread_t *, const vlc_mouse_t *);<br> * This function will return and reset internal statistics.<br> */<br> void vout_GetResetStatistic( vout_thread_t *p_vout, unsigned *pi_displayed,<br>- unsigned *pi_lost );<br>+ unsigned *pi_lost, unsigned *pi_late );<br> <br> /**<br> * This function will force to display the next picture while paused</pre></blockquote></div><br>-- <br>Envoyé de mon appareil Android avec Courriel K-9 Mail. Veuillez excuser ma brièveté.</body></html>