mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-23 16:50:47 +00:00
Revert "adaptivedemux: Allow application to force EOS"
This reverts commit 8a070cf9af
.
This commit is contained in:
parent
0a0bc8ab94
commit
2f8980d70d
1 changed files with 7 additions and 57 deletions
|
@ -210,10 +210,6 @@ struct _GstAdaptiveDemuxPrivate
|
|||
* without needing to stop tasks when they just want to
|
||||
* update the segment boundaries */
|
||||
GMutex segment_lock;
|
||||
|
||||
/* Used to keep application EOS event asynchronous, protected by the
|
||||
* MANIFEST_LOC */
|
||||
gboolean pending_eos;
|
||||
};
|
||||
|
||||
typedef struct _GstAdaptiveDemuxTimer
|
||||
|
@ -233,9 +229,6 @@ static void gst_adaptive_demux_finalize (GObject * object);
|
|||
static GstStateChangeReturn gst_adaptive_demux_change_state (GstElement *
|
||||
element, GstStateChange transition);
|
||||
|
||||
static gboolean gst_adaptive_demux_send_event (GstElement * element,
|
||||
GstEvent * event);
|
||||
|
||||
static void gst_adaptive_demux_handle_message (GstBin * bin, GstMessage * msg);
|
||||
|
||||
static gboolean gst_adaptive_demux_sink_event (GstPad * pad, GstObject * parent,
|
||||
|
@ -253,8 +246,7 @@ gst_adaptive_demux_push_src_event (GstAdaptiveDemux * demux, GstEvent * event);
|
|||
static void gst_adaptive_demux_updates_loop (GstAdaptiveDemux * demux);
|
||||
static void gst_adaptive_demux_stream_download_loop (GstAdaptiveDemuxStream *
|
||||
stream);
|
||||
static void gst_adaptive_demux_reset (GstAdaptiveDemux * demux,
|
||||
GstEvent * event);
|
||||
static void gst_adaptive_demux_reset (GstAdaptiveDemux * demux);
|
||||
static gboolean gst_adaptive_demux_prepare_streams (GstAdaptiveDemux * demux,
|
||||
gboolean first_and_live);
|
||||
static gboolean gst_adaptive_demux_expose_streams (GstAdaptiveDemux * demux);
|
||||
|
@ -430,7 +422,6 @@ gst_adaptive_demux_class_init (GstAdaptiveDemuxClass * klass)
|
|||
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
||||
|
||||
gstelement_class->change_state = gst_adaptive_demux_change_state;
|
||||
gstelement_class->send_event = gst_adaptive_demux_send_event;
|
||||
|
||||
gstbin_class->handle_message = gst_adaptive_demux_handle_message;
|
||||
|
||||
|
@ -461,9 +452,6 @@ gst_adaptive_demux_init (GstAdaptiveDemux * demux,
|
|||
demux->have_group_id = FALSE;
|
||||
demux->group_id = G_MAXUINT;
|
||||
|
||||
/* To receive downstream events, so we can handle EOS */
|
||||
GST_OBJECT_FLAG_SET (demux, GST_ELEMENT_FLAG_SOURCE);
|
||||
|
||||
gst_segment_init (&demux->segment, GST_FORMAT_TIME);
|
||||
|
||||
gst_bin_set_suppressed_flags (GST_BIN_CAST (demux),
|
||||
|
@ -573,12 +561,12 @@ gst_adaptive_demux_change_state (GstElement * element,
|
|||
case GST_STATE_CHANGE_PAUSED_TO_READY:
|
||||
GST_MANIFEST_LOCK (demux);
|
||||
demux->running = FALSE;
|
||||
gst_adaptive_demux_reset (demux, NULL);
|
||||
gst_adaptive_demux_reset (demux);
|
||||
GST_MANIFEST_UNLOCK (demux);
|
||||
break;
|
||||
case GST_STATE_CHANGE_READY_TO_PAUSED:
|
||||
GST_MANIFEST_LOCK (demux);
|
||||
gst_adaptive_demux_reset (demux, NULL);
|
||||
gst_adaptive_demux_reset (demux);
|
||||
/* Clear "cancelled" flag in uridownloader since subclass might want to
|
||||
* use uridownloader to fetch another manifest */
|
||||
gst_uri_downloader_reset (demux->downloader);
|
||||
|
@ -602,40 +590,6 @@ gst_adaptive_demux_change_state (GstElement * element,
|
|||
return result;
|
||||
}
|
||||
|
||||
static void
|
||||
gst_adaptive_demux_force_eos (GstElement * element, gpointer user_data)
|
||||
{
|
||||
GstAdaptiveDemux *demux = GST_ADAPTIVE_DEMUX_CAST (element);
|
||||
GstEvent *event = user_data;
|
||||
|
||||
GST_MANIFEST_LOCK (demux);
|
||||
if (demux->priv->pending_eos) {
|
||||
GST_DEBUG_OBJECT (demux, "Forcing EOS now.");
|
||||
gst_adaptive_demux_reset (demux, event);
|
||||
}
|
||||
GST_MANIFEST_UNLOCK (demux);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gst_adaptive_demux_send_event (GstElement * element, GstEvent * event)
|
||||
{
|
||||
GstAdaptiveDemux *demux = GST_ADAPTIVE_DEMUX_CAST (element);
|
||||
gboolean result = FALSE;
|
||||
|
||||
if (GST_EVENT_TYPE (event) == GST_EVENT_EOS) {
|
||||
GST_MANIFEST_LOCK (demux);
|
||||
demux->priv->pending_eos = TRUE;
|
||||
gst_element_call_async (element, gst_adaptive_demux_force_eos, event,
|
||||
(GDestroyNotify) gst_event_unref);
|
||||
result = TRUE;
|
||||
GST_MANIFEST_UNLOCK (demux);
|
||||
} else {
|
||||
gst_event_unref (event);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gst_adaptive_demux_sink_event (GstPad * pad, GstObject * parent,
|
||||
GstEvent * event)
|
||||
|
@ -648,7 +602,7 @@ gst_adaptive_demux_sink_event (GstPad * pad, GstObject * parent,
|
|||
GST_API_LOCK (demux);
|
||||
GST_MANIFEST_LOCK (demux);
|
||||
|
||||
gst_adaptive_demux_reset (demux, NULL);
|
||||
gst_adaptive_demux_reset (demux);
|
||||
|
||||
ret = gst_pad_event_default (pad, parent, event);
|
||||
|
||||
|
@ -806,11 +760,12 @@ gst_adaptive_demux_sink_chain (GstPad * pad, GstObject * parent,
|
|||
|
||||
/* must be called with manifest_lock taken */
|
||||
static void
|
||||
gst_adaptive_demux_reset (GstAdaptiveDemux * demux, GstEvent * eos)
|
||||
gst_adaptive_demux_reset (GstAdaptiveDemux * demux)
|
||||
{
|
||||
GstAdaptiveDemuxClass *klass = GST_ADAPTIVE_DEMUX_GET_CLASS (demux);
|
||||
GList *iter;
|
||||
GList *old_streams;
|
||||
GstEvent *eos;
|
||||
|
||||
/* take ownership of old_streams before releasing the manifest_lock in
|
||||
* gst_adaptive_demux_stop_tasks
|
||||
|
@ -823,11 +778,7 @@ gst_adaptive_demux_reset (GstAdaptiveDemux * demux, GstEvent * eos)
|
|||
if (klass->reset)
|
||||
klass->reset (demux);
|
||||
|
||||
if (eos)
|
||||
gst_event_ref (eos);
|
||||
else
|
||||
eos = gst_event_new_eos ();
|
||||
|
||||
eos = gst_event_new_eos ();
|
||||
for (iter = demux->streams; iter; iter = g_list_next (iter)) {
|
||||
GstAdaptiveDemuxStream *stream = iter->data;
|
||||
if (stream->pad) {
|
||||
|
@ -839,7 +790,6 @@ gst_adaptive_demux_reset (GstAdaptiveDemux * demux, GstEvent * eos)
|
|||
gst_adaptive_demux_stream_free (stream);
|
||||
}
|
||||
gst_event_unref (eos);
|
||||
demux->priv->pending_eos = FALSE;
|
||||
g_list_free (demux->streams);
|
||||
demux->streams = NULL;
|
||||
if (demux->prepared_streams) {
|
||||
|
|
Loading…
Reference in a new issue