mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-23 08:46:40 +00:00
base: Stop using GST_FLOW_IS_FATAL()
And document the special handling of WRONG_STATE.
This commit is contained in:
parent
d7f59ca0c4
commit
2dfb0d2772
2 changed files with 45 additions and 42 deletions
|
@ -3933,25 +3933,26 @@ paused:
|
||||||
GST_LOG_OBJECT (basesink, "pausing task, reason %s",
|
GST_LOG_OBJECT (basesink, "pausing task, reason %s",
|
||||||
gst_flow_get_name (result));
|
gst_flow_get_name (result));
|
||||||
gst_pad_pause_task (pad);
|
gst_pad_pause_task (pad);
|
||||||
/* fatal errors and NOT_LINKED cause EOS */
|
if (result == GST_FLOW_UNEXPECTED) {
|
||||||
if (GST_FLOW_IS_FATAL (result) || result == GST_FLOW_NOT_LINKED) {
|
/* perform EOS logic */
|
||||||
if (result == GST_FLOW_UNEXPECTED) {
|
if (basesink->segment.flags & GST_SEEK_FLAG_SEGMENT) {
|
||||||
/* perform EOS logic */
|
gst_element_post_message (GST_ELEMENT_CAST (basesink),
|
||||||
if (basesink->segment.flags & GST_SEEK_FLAG_SEGMENT) {
|
gst_message_new_segment_done (GST_OBJECT_CAST (basesink),
|
||||||
gst_element_post_message (GST_ELEMENT_CAST (basesink),
|
basesink->segment.format, basesink->segment.last_stop));
|
||||||
gst_message_new_segment_done (GST_OBJECT_CAST (basesink),
|
|
||||||
basesink->segment.format, basesink->segment.last_stop));
|
|
||||||
} else {
|
|
||||||
gst_base_sink_event (pad, gst_event_new_eos ());
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
/* for fatal errors we post an error message, post the error
|
|
||||||
* first so the app knows about the error first. */
|
|
||||||
GST_ELEMENT_ERROR (basesink, STREAM, FAILED,
|
|
||||||
(_("Internal data stream error.")),
|
|
||||||
("stream stopped, reason %s", gst_flow_get_name (result)));
|
|
||||||
gst_base_sink_event (pad, gst_event_new_eos ());
|
gst_base_sink_event (pad, gst_event_new_eos ());
|
||||||
}
|
}
|
||||||
|
} else if (result == GST_FLOW_NOT_LINKED || result <= GST_FLOW_UNEXPECTED) {
|
||||||
|
/* for fatal errors we post an error message, post the error
|
||||||
|
* first so the app knows about the error first.
|
||||||
|
* wrong-state is not a fatal error because it happens due to
|
||||||
|
* flushing and posting an error message in that case is the
|
||||||
|
* wrong thing to do, e.g. when basesrc is doing a flushing
|
||||||
|
* seek. */
|
||||||
|
GST_ELEMENT_ERROR (basesink, STREAM, FAILED,
|
||||||
|
(_("Internal data stream error.")),
|
||||||
|
("stream stopped, reason %s", gst_flow_get_name (result)));
|
||||||
|
gst_base_sink_event (pad, gst_event_new_eos ());
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2525,41 +2525,43 @@ pause:
|
||||||
GST_DEBUG_OBJECT (src, "pausing task, reason %s", reason);
|
GST_DEBUG_OBJECT (src, "pausing task, reason %s", reason);
|
||||||
src->data.ABI.running = FALSE;
|
src->data.ABI.running = FALSE;
|
||||||
gst_pad_pause_task (pad);
|
gst_pad_pause_task (pad);
|
||||||
if (GST_FLOW_IS_FATAL (ret) || ret == GST_FLOW_NOT_LINKED) {
|
if (ret == GST_FLOW_UNEXPECTED) {
|
||||||
if (ret == GST_FLOW_UNEXPECTED) {
|
gboolean flag_segment;
|
||||||
gboolean flag_segment;
|
GstFormat format;
|
||||||
GstFormat format;
|
gint64 last_stop;
|
||||||
gint64 last_stop;
|
|
||||||
|
|
||||||
/* perform EOS logic */
|
/* perform EOS logic */
|
||||||
flag_segment = (src->segment.flags & GST_SEEK_FLAG_SEGMENT) != 0;
|
flag_segment = (src->segment.flags & GST_SEEK_FLAG_SEGMENT) != 0;
|
||||||
format = src->segment.format;
|
format = src->segment.format;
|
||||||
last_stop = src->segment.last_stop;
|
last_stop = src->segment.last_stop;
|
||||||
|
|
||||||
if (flag_segment) {
|
if (flag_segment) {
|
||||||
GstMessage *message;
|
GstMessage *message;
|
||||||
|
|
||||||
message = gst_message_new_segment_done (GST_OBJECT_CAST (src),
|
message = gst_message_new_segment_done (GST_OBJECT_CAST (src),
|
||||||
format, last_stop);
|
format, last_stop);
|
||||||
gst_message_set_seqnum (message, src->priv->seqnum);
|
gst_message_set_seqnum (message, src->priv->seqnum);
|
||||||
gst_element_post_message (GST_ELEMENT_CAST (src), message);
|
gst_element_post_message (GST_ELEMENT_CAST (src), message);
|
||||||
} else {
|
|
||||||
event = gst_event_new_eos ();
|
|
||||||
gst_event_set_seqnum (event, src->priv->seqnum);
|
|
||||||
gst_pad_push_event (pad, event);
|
|
||||||
src->priv->last_sent_eos = TRUE;
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
event = gst_event_new_eos ();
|
event = gst_event_new_eos ();
|
||||||
gst_event_set_seqnum (event, src->priv->seqnum);
|
gst_event_set_seqnum (event, src->priv->seqnum);
|
||||||
/* for fatal errors we post an error message, post the error
|
|
||||||
* first so the app knows about the error first. */
|
|
||||||
GST_ELEMENT_ERROR (src, STREAM, FAILED,
|
|
||||||
(_("Internal data flow error.")),
|
|
||||||
("streaming task paused, reason %s (%d)", reason, ret));
|
|
||||||
gst_pad_push_event (pad, event);
|
gst_pad_push_event (pad, event);
|
||||||
src->priv->last_sent_eos = TRUE;
|
src->priv->last_sent_eos = TRUE;
|
||||||
}
|
}
|
||||||
|
} else if (ret == GST_FLOW_NOT_LINKED || ret <= GST_FLOW_UNEXPECTED) {
|
||||||
|
event = gst_event_new_eos ();
|
||||||
|
gst_event_set_seqnum (event, src->priv->seqnum);
|
||||||
|
/* for fatal errors we post an error message, post the error
|
||||||
|
* first so the app knows about the error first.
|
||||||
|
* Also don't do this for WRONG_STATE because it happens
|
||||||
|
* due to flushing and posting an error message because of
|
||||||
|
* that is the wrong thing to do, e.g. when we're doing
|
||||||
|
* a flushing seek. */
|
||||||
|
GST_ELEMENT_ERROR (src, STREAM, FAILED,
|
||||||
|
(_("Internal data flow error.")),
|
||||||
|
("streaming task paused, reason %s (%d)", reason, ret));
|
||||||
|
gst_pad_push_event (pad, event);
|
||||||
|
src->priv->last_sent_eos = TRUE;
|
||||||
}
|
}
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue