[vlc-devel] [PATCH 2/3] player: timer: fix never left pause state

Francois Cartegnie fcvlcdev at free.fr
Mon Dec 14 18:51:43 CET 2020


---
 src/player/input.c |  3 +++
 src/player/timer.c | 10 ++++++----
 2 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/src/player/input.c b/src/player/input.c
index cf83337dc8..535df00e6c 100644
--- a/src/player/input.c
+++ b/src/player/input.c
@@ -205,6 +205,9 @@ vlc_player_input_HandleState(struct vlc_player_input *input,
             break;
         case VLC_PLAYER_STATE_PLAYING:
             input->pause_date = VLC_TICK_INVALID;
+            vlc_player_UpdateTimerState(player, NULL,
+                                        VLC_PLAYER_TIMER_STATE_PLAYING,
+                                        input->pause_date);
             /* fallthrough */
         case VLC_PLAYER_STATE_STARTED:
             if (player->started &&
diff --git a/src/player/timer.c b/src/player/timer.c
index f6db96a0ed..c6242212cc 100644
--- a/src/player/timer.c
+++ b/src/player/timer.c
@@ -201,21 +201,23 @@ vlc_player_UpdateTimerState(vlc_player_t *player, vlc_es_id_t *es_source,
             break;
 
         case VLC_PLAYER_TIMER_STATE_PAUSED:
-        default:
-            assert(state == VLC_PLAYER_TIMER_STATE_PAUSED);
             notify = true;
             assert(system_date != VLC_TICK_INVALID);
             break;
+
+        default:
+        case VLC_PLAYER_TIMER_STATE_PLAYING:
+            break;
     }
 
+    player->timer.state = state;
+
     if( !notify )
     {
         vlc_mutex_unlock(&player->timer.lock);
         return;
     }
 
-    player->timer.state = state;
-
     vlc_player_timer_id *timer;
     vlc_list_foreach(timer, &bestsource->listeners, node)
     {
-- 
2.26.2



More information about the vlc-devel mailing list