player: timer: don't update BestSource when stopping

This will prevent to send updates after the last discontinuity (when the output
is deleted) from other ES sources.

This could happen with a high CPU load:

timer: update: source: audio/0, ts: 197001 npt: 1
timer: update: source: audio/0, ts: 198001 npt: 1
timer: update: source: audio/0, ts: 199001 npt: 1
timer: discontinuity: source: input
timer: discontinuity: source: audio/0
timer: update: source: video/0, ts: 191660 npt: 1
timer: discontinuity: source: video/0

Refs #26609
This commit is contained in:
Thomas Guillem 2024-04-10 17:19:35 +02:00 committed by Steve Lhomme
parent 1c5d699800
commit acf833a655
3 changed files with 14 additions and 4 deletions

View File

@ -276,6 +276,10 @@ vlc_player_input_HandleState(struct vlc_player_input *input,
VLC_PLAYER_TIMER_STATE_DISCONTINUITY,
VLC_TICK_INVALID);
vlc_player_UpdateTimerState(player, NULL,
VLC_PLAYER_TIMER_STATE_STOPPING,
VLC_TICK_INVALID);
if (input == player->input)
player->input = NULL;

View File

@ -208,6 +208,7 @@ enum vlc_player_timer_state
VLC_PLAYER_TIMER_STATE_PLAYING,
VLC_PLAYER_TIMER_STATE_PAUSED,
VLC_PLAYER_TIMER_STATE_DISCONTINUITY,
VLC_PLAYER_TIMER_STATE_STOPPING,
};
struct vlc_player_timer

View File

@ -240,11 +240,15 @@ vlc_player_UpdateTimerState(vlc_player_t *player, vlc_es_id_t *es_source,
case VLC_PLAYER_TIMER_STATE_PLAYING:
break;
case VLC_PLAYER_TIMER_STATE_STOPPING:
break;
default:
vlc_assert_unreachable();
}
player->timer.state = state;
if (player->timer.state != VLC_PLAYER_TIMER_STATE_STOPPING)
player->timer.state = state;
if (!notify)
{
@ -475,9 +479,10 @@ vlc_player_UpdateTimer(vlc_player_t *player, vlc_es_id_t *es_source,
if (player->timer.state == VLC_PLAYER_TIMER_STATE_DISCONTINUITY)
player->timer.state = VLC_PLAYER_TIMER_STATE_PLAYING;
vlc_player_UpdateTimerBestSource(player, es_source,
es_source_is_master, point, system_date,
force_update);
if (player->timer.state != VLC_PLAYER_TIMER_STATE_STOPPING)
vlc_player_UpdateTimerBestSource(player, es_source,
es_source_is_master, point, system_date,
force_update);
vlc_player_UpdateTimerSmpteSource(player, es_source, point, system_date,
frame_rate, frame_rate_base);