mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-23 02:01:12 +00:00
adaptivedemux2: Handle loss of synchronization
Add a new custom GstFlowReturn so that subclasses can notify that they have lost live synchronization. When that happens, do a flushing seek back to the live position Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2679>
This commit is contained in:
parent
37b17ba0eb
commit
d88d7d5b55
4 changed files with 27 additions and 0 deletions
|
@ -196,6 +196,8 @@ void gst_adaptive_demux_advance_period (GstAdaptiveDemux * demux);
|
|||
|
||||
void gst_adaptive_demux2_stream_stop (GstAdaptiveDemux2Stream * stream);
|
||||
|
||||
gboolean gst_adaptive_demux_handle_lost_sync (GstAdaptiveDemux * demux);
|
||||
|
||||
typedef struct
|
||||
{
|
||||
GstMiniObject *item;
|
||||
|
|
|
@ -1715,6 +1715,12 @@ gst_adaptive_demux2_stream_load_a_fragment (GstAdaptiveDemux2Stream * stream)
|
|||
GST_DEBUG_OBJECT (stream, "EOS, checking to stop download loop");
|
||||
gst_adaptive_demux2_stream_handle_playlist_eos (stream);
|
||||
return FALSE;
|
||||
case GST_ADAPTIVE_DEMUX_FLOW_LOST_SYNC:
|
||||
GST_DEBUG_OBJECT (stream, "Lost sync, asking reset to current position");
|
||||
stream->state = GST_ADAPTIVE_DEMUX2_STREAM_STATE_STOPPED;
|
||||
gst_adaptive_demux_loop_call (demux->priv->scheduler_task,
|
||||
(GSourceFunc) gst_adaptive_demux_handle_lost_sync, demux, NULL);
|
||||
return FALSE;
|
||||
case GST_FLOW_NOT_LINKED:
|
||||
{
|
||||
stream->state = GST_ADAPTIVE_DEMUX2_STREAM_STATE_EOS;
|
||||
|
|
|
@ -2788,6 +2788,22 @@ gst_adaptive_demux_src_query (GstPad * pad, GstObject * parent,
|
|||
return ret;
|
||||
}
|
||||
|
||||
gboolean
|
||||
gst_adaptive_demux_handle_lost_sync (GstAdaptiveDemux * demux)
|
||||
{
|
||||
GstEvent *seek;
|
||||
|
||||
GST_WARNING_OBJECT (demux, "Lost synchronization, seeking back to live head");
|
||||
|
||||
seek =
|
||||
gst_event_new_seek (1.0, GST_FORMAT_TIME,
|
||||
GST_SEEK_FLAG_FLUSH | GST_SEEK_FLAG_KEY_UNIT, GST_SEEK_TYPE_END, 0,
|
||||
GST_SEEK_TYPE_NONE, 0);
|
||||
gst_adaptive_demux_handle_seek_event (demux, seek);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
/* Called when the scheduler starts, to kick off manifest updates
|
||||
* and stream downloads */
|
||||
static gboolean
|
||||
|
|
|
@ -105,6 +105,9 @@ typedef GstObjectClass GstAdaptiveDemux2StreamClass;
|
|||
*/
|
||||
#define GST_ADAPTIVE_DEMUX_FLOW_RESTART_FRAGMENT GST_FLOW_CUSTOM_SUCCESS_2
|
||||
|
||||
/* The live stream has lost synchronization and the demuxer needs to be resetted */
|
||||
#define GST_ADAPTIVE_DEMUX_FLOW_LOST_SYNC GST_FLOW_CUSTOM_ERROR_1
|
||||
|
||||
typedef enum _GstAdaptiveDemux2StreamState GstAdaptiveDemux2StreamState;
|
||||
|
||||
typedef struct _GstAdaptiveDemux2StreamFragment GstAdaptiveDemux2StreamFragment;
|
||||
|
|
Loading…
Reference in a new issue