[vlc-commits] [Git][videolan/vlc][master] 3 commits: input_clock: rework update arguments
Felix Paul Kühne (@fkuehne)
gitlab at videolan.org
Mon Aug 12 09:31:41 UTC 2024
Felix Paul Kühne pushed to branch master at VideoLAN / VLC
Commits:
583a6b8f by Thomas Guillem at 2024-08-12T09:07:26+00:00
input_clock: rework update arguments
Add a b_buffering argument (not to be confused with
extra_buffering_allowd).
- - - - -
88258ec1 by Thomas Guillem at 2024-08-12T09:07:26+00:00
input_clock: move origin_changed check
This fix the unlikely case where a backward discontinuity is not
detected just after the origin is changed.
- - - - -
f159466c by Thomas Guillem at 2024-08-12T09:07:26+00:00
input_clock: don't check for discontinuites while buffering
- - - - -
3 changed files:
- src/clock/input_clock.c
- src/clock/input_clock.h
- src/input/es_out.c
Changes:
=====================================
src/clock/input_clock.c
=====================================
@@ -220,12 +220,15 @@ void input_clock_AttachListener(input_clock_t *cl,
* i_ck_system: date in system clock
*****************************************************************************/
vlc_tick_t input_clock_Update( input_clock_t *cl, vlc_object_t *p_log,
- bool b_can_pace_control, bool b_buffering_allowed,
+ bool b_can_pace_control, bool b_buffering,
+ bool b_extra_buffering_allowed,
vlc_tick_t i_ck_stream, vlc_tick_t i_ck_system )
{
bool b_reset_reference = false;
bool discontinuity = false;
+ b_can_pace_control |= b_buffering;
+
assert( i_ck_stream != VLC_TICK_INVALID && i_ck_system != VLC_TICK_INVALID );
if( !cl->b_has_reference )
@@ -233,8 +236,7 @@ vlc_tick_t input_clock_Update( input_clock_t *cl, vlc_object_t *p_log,
/* */
b_reset_reference= true;
}
- /* Don't check discontinuities if the origin has just been changed */
- else if (cl->last.stream != VLC_TICK_INVALID && !cl->b_origin_changed)
+ else if (!b_buffering && cl->last.stream != VLC_TICK_INVALID)
{
assert(cl->last.system != VLC_TICK_INVALID);
@@ -245,8 +247,9 @@ vlc_tick_t input_clock_Update( input_clock_t *cl, vlc_object_t *p_log,
vlc_tick_t diff = stream_diff - system_diff;
/* A discontinuity happen if stream timings increase much more than
- * system timings or if the stream is going backward. */
- if (diff > CR_MAX_GAP || stream_diff < 0)
+ * system timings or if the stream is going backward.
+ * Don't compare system timings if the origin has just been changed */
+ if ((!cl->b_origin_changed && diff > CR_MAX_GAP) || stream_diff < 0)
{
/* Stream discontinuity, for which we haven't received a
* warning from the stream control facilities (dd-edited
@@ -292,7 +295,7 @@ vlc_tick_t input_clock_Update( input_clock_t *cl, vlc_object_t *p_log,
{
cl->i_buffering_duration = 0;
}
- else if( b_buffering_allowed )
+ else if( b_extra_buffering_allowed )
{
/* Try to bufferize more than necessary by reading
* CR_BUFFERING_RATE/256 faster until we have CR_BUFFERING_TARGET.
@@ -303,7 +306,7 @@ vlc_tick_t input_clock_Update( input_clock_t *cl, vlc_object_t *p_log,
if( cl->i_buffering_duration > CR_BUFFERING_TARGET )
cl->i_buffering_duration = CR_BUFFERING_TARGET;
}
- //fprintf( stderr, "input_clock_Update: %d :: %lld\n", b_buffering_allowed, cl->i_buffering_duration/1000 );
+ //fprintf( stderr, "input_clock_Update: %d :: %lld\n", b_extra_buffering_allowed, cl->i_buffering_duration/1000 );
/* */
cl->last = clock_point_Create( i_ck_system, i_ck_stream );
=====================================
src/clock/input_clock.h
=====================================
@@ -100,15 +100,17 @@ void input_clock_Delete(input_clock_t *);
* \param clock the input clock object to update with the new point
* \param p_log the logger object to use
* \param b_can_pace_control whether the input can control the speed of playback
- * \param b_buffering_allowed tells if we are allowed to bufferize more data in
- advanced (if possible).
+ * \param b_buffering whether the input is buffering
+ * \param b_extra_buffering_allowed tells if we are allowed to bufferize more
+ * data in advance (if possible).
* \param i_clock the new clock reference value
* \param i_system the timestmap at which the new reference has been reported
*
* \return clock update delay
*/
vlc_tick_t input_clock_Update( input_clock_t *clock, vlc_object_t *p_log,
- bool b_can_pace_control, bool b_buffering_allowed,
+ bool b_can_pace_control, bool b_buffering,
+ bool b_extra_buffering_allowed,
vlc_tick_t i_clock, vlc_tick_t i_system );
/**
=====================================
src/input/es_out.c
=====================================
@@ -3365,7 +3365,7 @@ static int EsOutVaControlLocked(es_out_sys_t *p_sys, input_source_t *source,
bool b_extra_buffering_allowed = !b_low_delay && EsOutIsExtraBufferingAllowed(p_sys);
vlc_tick_t i_late = input_clock_Update(
p_pgrm->p_input_clock, VLC_OBJECT(p_sys->p_input),
- input_CanPaceControl(p_sys->p_input) || p_sys->b_buffering,
+ input_CanPaceControl(p_sys->p_input), p_sys->b_buffering,
b_extra_buffering_allowed,
i_pcr, vlc_tick_now() );
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/4c13e01089d324421562695c82444cb70c8aab1d...f159466cfd9158bba271da751b2ea70d41325713
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/4c13e01089d324421562695c82444cb70c8aab1d...f159466cfd9158bba271da751b2ea70d41325713
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