[vlc-devel] [PATCH v2 5/7] player: remove normal_time handling

Thomas Guillem thomas at gllm.fr
Thu Apr 1 15:30:10 UTC 2021


It's now handled internally between the demux, the es_out and the
input_clock.
---
 src/player/input.c  | 14 ++------------
 src/player/player.h |  3 ---
 src/player/timer.c  | 15 ++-------------
 3 files changed, 4 insertions(+), 28 deletions(-)

diff --git a/src/player/input.c b/src/player/input.c
index 535df00e6c4..49b001dfcb4 100644
--- a/src/player/input.c
+++ b/src/player/input.c
@@ -717,7 +717,6 @@ input_thread_Events(input_thread_t *input_thread,
             };
             vlc_player_UpdateTimer(player, event->output_clock.id,
                                    event->output_clock.master, &point,
-                                   VLC_TICK_INVALID,
                                    event->output_clock.frame_rate,
                                    event->output_clock.frame_rate_base);
         }
@@ -776,24 +775,16 @@ input_thread_Events(input_thread_t *input_thread,
                 changed = true;
             }
 
-            if (input->normal_time != event->times.normal_time)
-            {
-                assert(event->times.normal_time != VLC_TICK_INVALID);
-                input->normal_time = event->times.normal_time;
-                changed = true;
-            }
-
             if (changed)
             {
                 const struct vlc_player_timer_point point = {
                     .position = input->position,
                     .rate = input->rate,
-                    .ts = input->time + input->normal_time,
+                    .ts = input->time,
                     .length = input->length,
                     .system_date = system_date,
                 };
-                vlc_player_UpdateTimer(player, NULL, false, &point,
-                                       input->normal_time, 0, 0);
+                vlc_player_UpdateTimer(player, NULL, false, &point, 0, 0);
             }
             break;
         }
@@ -920,7 +911,6 @@ vlc_player_input_New(vlc_player_t *player, input_item_t *item)
     input->rate = 1.f;
     input->capabilities = 0;
     input->length = input->time = VLC_TICK_INVALID;
-    input->normal_time = VLC_TICK_0;
     input->pause_date = VLC_TICK_INVALID;
     input->position = 0.f;
 
diff --git a/src/player/player.h b/src/player/player.h
index ae5a2770d6b..b62c67849dd 100644
--- a/src/player/player.h
+++ b/src/player/player.h
@@ -67,7 +67,6 @@ struct vlc_player_input
 
     float position;
     vlc_tick_t time;
-    vlc_tick_t normal_time;
 
     vlc_tick_t pause_date;
 
@@ -215,7 +214,6 @@ struct vlc_player_timer
     bool seeking;
 
     vlc_tick_t input_length;
-    vlc_tick_t input_normal_time;
     vlc_tick_t last_ts;
     float input_position;
 
@@ -464,7 +462,6 @@ void
 vlc_player_UpdateTimer(vlc_player_t *player, vlc_es_id_t *es_source,
                        bool es_source_is_master,
                        const struct vlc_player_timer_point *point,
-                       vlc_tick_t normal_time,
                        unsigned frame_rate, unsigned frame_rate_base);
 
 void
diff --git a/src/player/timer.c b/src/player/timer.c
index 48005571494..8299464d4bb 100644
--- a/src/player/timer.c
+++ b/src/player/timer.c
@@ -33,7 +33,6 @@ vlc_player_ResetTimer(vlc_player_t *player)
 
     player->timer.state = VLC_PLAYER_TIMER_STATE_DISCONTINUITY;
     player->timer.input_length = VLC_TICK_INVALID;
-    player->timer.input_normal_time = VLC_TICK_0;
     player->timer.last_ts = VLC_TICK_INVALID;
     player->timer.input_position = 0.f;
     player->timer.smpte_source.smpte.last_framenum = ULONG_MAX;
@@ -234,10 +233,9 @@ vlc_player_UpdateTimerSource(vlc_player_t *player,
                              double rate, vlc_tick_t ts, vlc_tick_t system_date)
 {
     assert(ts >= VLC_TICK_0);
-    assert(player->timer.input_normal_time >= VLC_TICK_0);
 
     source->point.rate = rate;
-    source->point.ts = ts - player->timer.input_normal_time + VLC_TICK_0;
+    source->point.ts = ts;
     source->point.length = player->timer.input_length;
 
     /* Put an invalid date for the first point in order to disable
@@ -249,8 +247,7 @@ vlc_player_UpdateTimerSource(vlc_player_t *player,
         source->point.system_date = system_date;
 
     if (source->point.length != VLC_TICK_INVALID)
-        source->point.position = (ts - player->timer.input_normal_time)
-                               / (double) source->point.length;
+        source->point.position = ts / (double) source->point.length;
     else
         source->point.position = player->timer.input_position;
 }
@@ -259,7 +256,6 @@ void
 vlc_player_UpdateTimer(vlc_player_t *player, vlc_es_id_t *es_source,
                        bool es_source_is_master,
                        const struct vlc_player_timer_point *point,
-                       vlc_tick_t normal_time,
                        unsigned frame_rate, unsigned frame_rate_base)
 {
     struct vlc_player_timer_source *source;
@@ -272,13 +268,6 @@ vlc_player_UpdateTimer(vlc_player_t *player, vlc_es_id_t *es_source,
     bool force_update = false;
     if (!es_source) /* input source */
     {
-        /* Only valid for input sources */
-        if (player->timer.input_normal_time != normal_time)
-        {
-            player->timer.input_normal_time = normal_time;
-            player->timer.last_ts = VLC_TICK_INVALID;
-            force_update = true;
-        }
         if (player->timer.input_length != point->length
          && point->length >= VLC_TICK_0)
         {
-- 
2.30.0



More information about the vlc-devel mailing list