dashdemux: simplify seek to eos handling

Remove redundant flush stop pushing and remove a goto to make
the code flow simpler
This commit is contained in:
Thiago Santos 2014-11-07 19:09:15 -03:00
parent 5ae991095d
commit e60bdc553c

View file

@ -476,6 +476,7 @@ gst_dash_demux_src_event (GstPad * pad, GstObject * parent, GstEvent * event)
GstStreamPeriod *period; GstStreamPeriod *period;
GSList *iter; GSList *iter;
gboolean update; gboolean update;
gboolean seek_to_eos = FALSE;
GST_INFO_OBJECT (demux, "Received seek event"); GST_INFO_OBJECT (demux, "Received seek event");
@ -539,18 +540,10 @@ gst_dash_demux_src_event (GstPad * pad, GstObject * parent, GstEvent * event)
if (list == NULL) { if (list == NULL) {
GST_WARNING_OBJECT (demux, "Could not find seeked Period"); GST_WARNING_OBJECT (demux, "Could not find seeked Period");
if (flags & GST_SEEK_FLAG_FLUSH) { seek_to_eos = TRUE;
GST_DEBUG_OBJECT (demux, "Sending flush stop and eos on all pad"); }
for (iter = demux->streams; iter; iter = g_slist_next (iter)) {
GstDashDemuxStream *stream;
stream = iter->data; if (!seek_to_eos) {
stream->stream_eos = TRUE;
gst_pad_push_event (stream->pad, gst_event_new_flush_stop (TRUE));
}
}
goto restart;
}
if (current_period != gst_mpd_client_get_period_index (demux->client)) { if (current_period != gst_mpd_client_get_period_index (demux->client)) {
GSList *streams = NULL; GSList *streams = NULL;
@ -580,6 +573,7 @@ gst_dash_demux_src_event (GstPad * pad, GstObject * parent, GstEvent * event)
gst_event_replace (&stream->pending_segment, seg_evt); gst_event_replace (&stream->pending_segment, seg_evt);
} }
gst_event_unref (seg_evt); gst_event_unref (seg_evt);
}
if (flags & GST_SEEK_FLAG_FLUSH) { if (flags & GST_SEEK_FLAG_FLUSH) {
GST_DEBUG_OBJECT (demux, "Sending flush stop on all pad"); GST_DEBUG_OBJECT (demux, "Sending flush stop on all pad");
@ -588,13 +582,19 @@ gst_dash_demux_src_event (GstPad * pad, GstObject * parent, GstEvent * event)
stream = iter->data; stream = iter->data;
stream->need_header = TRUE; stream->need_header = TRUE;
stream->stream_eos = FALSE; stream->stream_eos = seek_to_eos;
gst_pad_push_event (stream->pad, gst_event_new_flush_stop (TRUE)); gst_pad_push_event (stream->pad, gst_event_new_flush_stop (TRUE));
} }
} else if (seek_to_eos) {
for (iter = demux->streams; iter; iter = g_slist_next (iter)) {
GstDashDemuxStream *stream;
stream = iter->data;
stream->stream_eos = TRUE;
}
} }
/* Restart the demux */ /* Restart the demux */
restart:
GST_DASH_DEMUX_CLIENT_LOCK (demux); GST_DASH_DEMUX_CLIENT_LOCK (demux);
demux->cancelled = FALSE; demux->cancelled = FALSE;
demux->end_of_manifest = FALSE; demux->end_of_manifest = FALSE;