Skip to content

Commit

Permalink
clapper: Wait with flush after streams are selected
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Rafostar committed Jan 10, 2025
1 parent 6534fb1 commit b542aa1
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/lib/clapper/clapper-playbin-bus.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions src/lib/clapper/clapper-player-private.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down
1 change: 1 addition & 0 deletions src/lib/clapper/clapper-player.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit b542aa1

Please sign in to comment.