clapper: Wait with flush after streams are selected

Instead flushing right after select streams request, wait until
they are selected before doing a flush.

This fixes a hang when changing audio language with hlsdemux2.
This commit is contained in:
Rafał Dzięgiel
2025-01-10 23:54:19 +01:00
parent 6534fb1e22
commit b542aa1e76
3 changed files with 10 additions and 1 deletions

View File

@@ -755,7 +755,7 @@ _handle_stream_change_msg (GstMessage *msg,
&& player->current_state >= GST_STATE_PAUSED) {
/* XXX: I am not sure if we "officially" need to flush seek after select
* streams, but as of GStreamer 1.22 it doesn't work otherwise. */
_perform_flush_seek (player);
player->pending_flush = TRUE;
}
g_list_free (list);
}
@@ -1021,6 +1021,13 @@ _handle_streams_selected_msg (GstMessage *msg, ClapperPlayer *player)
* we iterate in search for all active ones */
clapper_player_playbin_update_current_decoders (player);
}
if (player->pending_flush) {
player->pending_flush = FALSE;
if (player->current_state >= GST_STATE_PAUSED)
_perform_flush_seek (player);
}
}
static inline void

View File

@@ -85,6 +85,7 @@ struct _ClapperPlayer
gboolean seeking; // during seek operation
gboolean speed_changing; // during rate change operation
gboolean pending_eos; // when pausing due to EOS
gboolean pending_flush; // after another stream selection
gint eos; // atomic integer
/* Set adaptive props immediately */

View File

@@ -751,6 +751,7 @@ clapper_player_reset (ClapperPlayer *self, gboolean pending_dispose)
GST_DEBUG_OBJECT (self, "Reset");
self->had_error = FALSE;
self->pending_flush = FALSE;
gst_clear_object (&self->played_item);
if (pending_dispose) {