mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-18 07:47:17 +00:00
adaptivedemux2: Fix for period switching in live streams
When playing live, it's possible that one stream reaches the end of the available playback window and goes to sleep waiting for a manifest update, and the manifest update introduces a new period. In that case, the sleeping stream needs to wake up and go 'properly' EOS before we can advance the input to the new period. Accordingly, make sure that a stream's last_ret value is not marked as EOS if it's just sleeping waiting for a live manifest update. Also fix the output loop to go back and re-check if it's time to switch to the next period after dequeuing and discarding an EOS event. https://livesim.dashif.org/livesim/periods_20/testpic_2s/Manifest.mpd Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2895>
This commit is contained in:
parent
dbc8a7ab18
commit
f4f1819416
2 changed files with 11 additions and 0 deletions
|
@ -1639,6 +1639,9 @@ gst_adaptive_demux2_stream_handle_playlist_eos (GstAdaptiveDemux2Stream *
|
|||
GST_DEBUG_OBJECT (stream,
|
||||
"Live playlist EOS - waiting for manifest update");
|
||||
stream->state = GST_ADAPTIVE_DEMUX2_STREAM_STATE_WAITING_MANIFEST_UPDATE;
|
||||
/* Clear the stream last_ret EOS state, since we're not actually EOS */
|
||||
if (stream->last_ret == GST_FLOW_EOS)
|
||||
stream->last_ret = GST_FLOW_OK;
|
||||
gst_adaptive_demux2_stream_wants_manifest_update (demux);
|
||||
return;
|
||||
}
|
||||
|
@ -1733,6 +1736,7 @@ gst_adaptive_demux2_stream_load_a_fragment (GstAdaptiveDemux2Stream * stream)
|
|||
break; /* all is good, let's go */
|
||||
case GST_FLOW_EOS:
|
||||
GST_DEBUG_OBJECT (stream, "EOS, checking to stop download loop");
|
||||
stream->last_ret = ret;
|
||||
gst_adaptive_demux2_stream_handle_playlist_eos (stream);
|
||||
return FALSE;
|
||||
case GST_ADAPTIVE_DEMUX_FLOW_LOST_SYNC:
|
||||
|
|
|
@ -3647,6 +3647,8 @@ restart:
|
|||
* * Pop next pending data from track and update pending position
|
||||
*
|
||||
*/
|
||||
gboolean need_restart = FALSE;
|
||||
|
||||
for (tmp = demux->priv->outputs; tmp; tmp = tmp->next) {
|
||||
OutputSlot *slot = (OutputSlot *) tmp->data;
|
||||
GstAdaptiveDemuxTrack *track = slot->track;
|
||||
|
@ -3708,6 +3710,8 @@ restart:
|
|||
gst_event_store_mark_delivered (&track->sticky_events, event);
|
||||
gst_event_unref (event);
|
||||
event = NULL;
|
||||
/* We'll need to re-check if all tracks are empty again above */
|
||||
need_restart = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3756,6 +3760,9 @@ restart:
|
|||
if (global_output_position != GST_CLOCK_STIME_NONE)
|
||||
demux->priv->global_output_position = global_output_position;
|
||||
|
||||
if (need_restart)
|
||||
goto restart;
|
||||
|
||||
if (global_output_position == GST_CLOCK_STIME_NONE) {
|
||||
if (!demux->priv->flushing) {
|
||||
GST_DEBUG_OBJECT (demux,
|
||||
|
|
Loading…
Reference in a new issue