[vlc-commits] player: timer: fix spurious wakeups from pause

Francois Cartegnie git at videolan.org
Tue Dec 15 15:32:10 UTC 2020


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Wed Dec  9 17:01:48 2020 +0100| [fa1c2fce8a530a2d5322dac3e8e7624b16dc57bb] | committer: Francois Cartegnie

player: timer: fix spurious wakeups from pause

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=fa1c2fce8a530a2d5322dac3e8e7624b16dc57bb
---

 src/player/timer.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/src/player/timer.c b/src/player/timer.c
index b5f5e38214..5afa4aa520 100644
--- a/src/player/timer.c
+++ b/src/player/timer.c
@@ -299,6 +299,10 @@ vlc_player_UpdateTimer(vlc_player_t *player, vlc_es_id_t *es_source,
 
     assert(point->ts != VLC_TICK_INVALID);
 
+    vlc_tick_t system_date = point->system_date;
+    if (player->timer.state == VLC_PLAYER_TIMER_STATE_PAUSED)
+        system_date = INT64_MAX;
+
     /* An update after a discontinuity means that the playback is resumed */
     if (player->timer.state == VLC_PLAYER_TIMER_STATE_DISCONTINUITY)
         player->timer.state = VLC_PLAYER_TIMER_STATE_PLAYING;
@@ -328,11 +332,11 @@ vlc_player_UpdateTimer(vlc_player_t *player, vlc_es_id_t *es_source,
         /* When paused (INT64_MAX), the same ts can be send more than one time
          * from the video source, only send it if different in that case. */
         if (point->ts != player->timer.last_ts
-          || source->point.system_date != point->system_date
-          || point->system_date != INT64_MAX)
+          || source->point.system_date != system_date
+          || system_date != INT64_MAX)
         {
             vlc_player_UpdateTimerSource(player, source, point->rate, point->ts,
-                                         point->system_date);
+                                         system_date);
 
             if (!vlc_list_is_empty(&source->listeners))
                 vlc_player_SendTimerSourceUpdates(player, source, force_update,
@@ -361,7 +365,7 @@ vlc_player_UpdateTimer(vlc_player_t *player, vlc_es_id_t *es_source,
         if (point->ts != player->timer.last_ts && source->smpte.frame_rate != 0)
         {
             vlc_player_UpdateTimerSource(player, source, point->rate, point->ts,
-                                         point->system_date);
+                                         system_date);
 
             if (!vlc_list_is_empty(&source->listeners))
                 vlc_player_SendSmpteTimerSourceUpdates(player, source,



More information about the vlc-commits mailing list