adaptivedemux2: wake waiting streams upon completed manifest downlaod

Fixes race when a live stream finishes playing all segments from a
dynamic manifest and waits for its update. If the manifest meanwhile
changes from dynamic to static and this update is received
asynchronously, periodic calls of gst_adaptive_demux_manifest_update_cb
will stop. As a result the blocked stream won't get notified about the
updated manifest and will remain stuck indefinitely.

Also removed the wake-up code from gst_adaptive_demux_manifest_update_cb
where it remained as a relic from previous implementation when manifest
updates were synchronous.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/8587>
This commit is contained in:
Jakub Adam 2025-02-28 15:41:23 +01:00 committed by GStreamer Marge Bot
parent f37b820060
commit 1248e4c462

View file

@ -3061,17 +3061,6 @@ gst_adaptive_demux_manifest_update_cb (GstAdaptiveDemux * demux)
if (ret == GST_FLOW_OK) { if (ret == GST_FLOW_OK) {
GST_DEBUG_OBJECT (demux, "Updated playlist successfully"); GST_DEBUG_OBJECT (demux, "Updated playlist successfully");
demux->priv->update_failed_count = 0; demux->priv->update_failed_count = 0;
/* Wake up download tasks */
if (demux->priv->stream_waiting_for_manifest) {
GList *iter;
for (iter = demux->input_period->streams; iter; iter = g_list_next (iter)) {
GstAdaptiveDemux2Stream *stream = iter->data;
gst_adaptive_demux2_stream_on_manifest_update (stream);
}
demux->priv->stream_waiting_for_manifest = FALSE;
}
} else if (ret == GST_ADAPTIVE_DEMUX_FLOW_LOST_SYNC) { } else if (ret == GST_ADAPTIVE_DEMUX_FLOW_LOST_SYNC) {
schedule_again = FALSE; schedule_again = FALSE;
gst_adaptive_demux_handle_lost_sync (demux); gst_adaptive_demux_handle_lost_sync (demux);
@ -3795,6 +3784,17 @@ handle_manifest_download_complete (DownloadRequest * request,
"Duration unknown, can not send the duration message"); "Duration unknown, can not send the duration message");
} }
/* Wake up download tasks */
if (demux->priv->stream_waiting_for_manifest) {
GList *iter;
for (iter = demux->input_period->streams; iter; iter = g_list_next (iter)) {
GstAdaptiveDemux2Stream *stream = iter->data;
gst_adaptive_demux2_stream_on_manifest_update (stream);
}
demux->priv->stream_waiting_for_manifest = FALSE;
}
/* If a manifest changes it's liveness or periodic updateness, we need /* If a manifest changes it's liveness or periodic updateness, we need
* to start/stop the manifest update task appropriately */ * to start/stop the manifest update task appropriately */
/* Keep this condition in sync with the one in /* Keep this condition in sync with the one in