[vlc-commits] [Git][videolan/vlc][master] 4 commits: input: decoder: trace decoder wait
Steve Lhomme (@robUx4)
gitlab at videolan.org
Sat Feb 1 10:13:15 UTC 2025
Steve Lhomme pushed to branch master at VideoLAN / VLC
Commits:
6115dab8 by Alexandre Janniaux at 2025-02-01T09:57:21+00:00
input: decoder: trace decoder wait
The events are tracing when decoders are ready for the input to start,
providing details on why the playback startup is being delayed.
Co-authored-by: Thomas Guillem <thomas at gllm.fr>
- - - - -
79b30239 by Alexandre Janniaux at 2025-02-01T09:57:21+00:00
input_clock: report buffering to es_out
This reports the buffering level (in ms) from the input clock in the
es_out, so that the core can track the buffering level in the current
playback.
The es_out is currently only using the value if positive to trigger a
rebuffering. Previous <= 0 values were discarded.
- - - - -
0296836c by Alexandre Janniaux at 2025-02-01T09:57:21+00:00
es_out: report buffering in traces
This reports the buffering level (in ms) from the input clock in the
traces, which is useful to analyze artifacts generated by the access or
the input mainloop, as well as the startup condition.
- - - - -
c9acd8a0 by Alexandre Janniaux at 2025-02-01T09:57:21+00:00
clock: dump more metrics in traces
This adds the clock context id metric which allows tracking some of the
lipsync issues by checking every contexts are switching to the new
context reliably. In this patch, clock->context can be null, but in
future work it will never be NULL.
This also setup a new tag on traces exposed by TraceRender to separate
the metrics where ts is the current time and metrics where ts is a time
provided by the tracer user. The rationale is that some systems cannot
render non-monotonic metrics and the time at which the event appear is
more important than the value of the timestamp, which should be traced
separately.
- - - - -
4 changed files:
- src/clock/clock.c
- src/clock/input_clock.c
- src/input/decoder.c
- src/input/es_out.c
Changes:
=====================================
src/clock/clock.c
=====================================
@@ -172,13 +172,15 @@ vlc_clock_RemoveListener(vlc_clock_t *clock, vlc_clock_listener_id *listener_id)
static inline void TraceRender(struct vlc_tracer *tracer, const char *type,
const char *id, vlc_tick_t now, vlc_tick_t pts,
- vlc_tick_t drift)
+ vlc_tick_t drift, uint32_t clock_id)
{
if (now != VLC_TICK_MAX && now != VLC_TICK_INVALID)
{
vlc_tracer_TraceWithTs(tracer, vlc_tick_now(),
VLC_TRACE("type", type),
VLC_TRACE("id", id),
+ VLC_TRACE("mode", "realtime"),
+ VLC_TRACE("clock_id", (int64_t)clock_id),
VLC_TRACE_TICK_NS("pts", pts),
VLC_TRACE_TICK_NS("render_ts", now),
VLC_TRACE_TICK_NS("drift", drift),
@@ -186,6 +188,7 @@ static inline void TraceRender(struct vlc_tracer *tracer, const char *type,
vlc_tracer_TraceWithTs(tracer, now,
VLC_TRACE("type", type),
VLC_TRACE("id", id),
+ VLC_TRACE("mode", "representative"),
VLC_TRACE_TICK_NS("render_pts", pts),
VLC_TRACE_TICK_NS("drift", drift),
VLC_TRACE_END);
@@ -367,7 +370,7 @@ static inline void vlc_clock_on_update(vlc_clock_t *clock,
if (main_clock->tracer != NULL && clock->track_str_id != NULL &&
system_now != VLC_TICK_INVALID && system_now != VLC_TICK_MAX)
TraceRender(main_clock->tracer, "RENDER", clock->track_str_id,
- system_now, ts, drift);
+ system_now, ts, drift, clock->context ? clock->context->clock_id : 0);
}
=====================================
src/clock/input_clock.c
=====================================
@@ -314,7 +314,7 @@ vlc_tick_t input_clock_Update( input_clock_t *cl, vlc_object_t *p_log,
/* It does not take the decoder latency into account but it is not really
* the goal of the clock here */
const vlc_tick_t i_system_expected = ClockStreamToSystem( cl, i_ck_stream + AvgGet( &cl->drift ) );
- const vlc_tick_t i_late = __MAX(0, ( i_ck_system - cl->i_pts_delay ) - i_system_expected);
+ const vlc_tick_t i_late = (i_ck_system - cl->i_pts_delay ) - i_system_expected;
if( i_late > 0 )
{
cl->late.pi_value[cl->late.i_index] = i_late;
=====================================
src/input/decoder.c
=====================================
@@ -1038,16 +1038,27 @@ static void RequestReload( vlc_input_decoder_t *p_owner )
static int DecoderWaitUnblock( vlc_input_decoder_t *p_owner )
{
+ struct vlc_tracer *tracer = vlc_object_get_tracer(VLC_OBJECT(&p_owner->dec));
vlc_fifo_Assert(p_owner->p_fifo);
if( p_owner->b_waiting )
{
+ if (tracer != NULL)
+ vlc_tracer_TraceEvent(tracer, "DEC", p_owner->psz_id, "start wait");
p_owner->b_has_data = true;
vlc_cond_signal( &p_owner->wait_acknowledge );
}
+ bool did_wait = false;
while (p_owner->b_waiting && p_owner->b_has_data && !p_owner->flushing)
+ {
vlc_fifo_WaitCond(p_owner->p_fifo, &p_owner->wait_request);
+ /* We should not start the clock if we ended up flushing. */
+ did_wait = !p_owner->flushing;
+ }
+
+ if (tracer != NULL && did_wait)
+ vlc_tracer_TraceEvent(tracer, "DEC", p_owner->psz_id, "stop wait");
if (p_owner->flushing)
{
=====================================
src/input/es_out.c
=====================================
@@ -3391,6 +3391,15 @@ static int EsOutVaControlLocked(es_out_sys_t *p_sys, input_source_t *source,
b_extra_buffering_allowed,
i_pcr, vlc_tick_now() );
+ if (tracer != NULL)
+ {
+ vlc_tracer_Trace(tracer,
+ VLC_TRACE("type", "DEMUX"),
+ VLC_TRACE("id", "input"),
+ VLC_TRACE_TICK_NS("buffering", -i_late),
+ VLC_TRACE_END);
+ }
+
if( !p_sys->p_pgrm )
return VLC_SUCCESS;
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/fdb0a9811090e5f16f18259529f38bc3bcb4e8fe...c9acd8a0d4ce94102e7ec9154001763683ce8bf1
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/fdb0a9811090e5f16f18259529f38bc3bcb4e8fe...c9acd8a0d4ce94102e7ec9154001763683ce8bf1
You're receiving this email because of your account on code.videolan.org.
VideoLAN code repository instance
More information about the vlc-commits
mailing list