libs/gst/base/gstbasesrc.c: Unify error handling, don't post an error message when a push() returns EOS but perform o...

Original commit message from CVS:
* libs/gst/base/gstbasesrc.c: (gst_base_src_loop):
Unify error handling, don't post an error message
when a push() returns EOS but perform our normal EOS
handling code. Fixes #340772.
This commit is contained in:
Wim Taymans 2006-05-08 11:35:29 +00:00
parent b9dbb55105
commit c2371ecece
2 changed files with 35 additions and 33 deletions

View file

@ -1,3 +1,10 @@
2006-05-08 Wim Taymans <wim@fluendo.com>
* libs/gst/base/gstbasesrc.c: (gst_base_src_loop):
Unify error handling, don't post an error message
when a push() returns EOS but perform our normal EOS
handling code. Fixes #340772.
2006-05-08 Wim Taymans <wim@fluendo.com> 2006-05-08 Wim Taymans <wim@fluendo.com>
* docs/design/part-overview.txt: * docs/design/part-overview.txt:

View file

@ -1400,16 +1400,11 @@ gst_base_src_loop (GstPad * pad)
ret = gst_base_src_get_range (src, position, src->blocksize, &buf); ret = gst_base_src_get_range (src, position, src->blocksize, &buf);
if (G_UNLIKELY (ret != GST_FLOW_OK)) { if (G_UNLIKELY (ret != GST_FLOW_OK)) {
if (ret == GST_FLOW_UNEXPECTED) GST_INFO_OBJECT (src, "pausing after gst_base_src_get_range() = %d", ret);
goto eos; goto pause;
else {
GST_INFO_OBJECT (src, "pausing after gst_base_src_get_range() = %d",
ret);
goto pause;
}
} }
if (G_UNLIKELY (buf == NULL)) if (G_UNLIKELY (buf == NULL))
goto error; goto null_buffer;
/* figure out the new position */ /* figure out the new position */
switch (src->segment.format) { switch (src->segment.format) {
@ -1461,47 +1456,47 @@ gst_base_src_loop (GstPad * pad)
goto pause; goto pause;
} }
if (eos) if (eos) {
goto eos; GST_INFO_OBJECT (src, "pausing after EOS");
ret = GST_FLOW_UNEXPECTED;
goto pause;
}
done: done:
gst_object_unref (src); gst_object_unref (src);
return; return;
/* special cases */ /* special cases */
eos:
{
GST_DEBUG_OBJECT (src, "going to EOS, getrange returned UNEXPECTED");
/* we finished the segment */
src->data.ABI.running = FALSE;
gst_pad_pause_task (pad);
if (src->segment.flags & GST_SEEK_FLAG_SEGMENT) {
gst_element_post_message (GST_ELEMENT (src),
gst_message_new_segment_done (GST_OBJECT (src),
src->segment.format, src->segment.last_stop));
} else {
gst_pad_push_event (pad, gst_event_new_eos ());
src->priv->last_sent_eos = TRUE;
}
goto done;
}
pause: pause:
{ {
const gchar *reason = gst_flow_get_name (ret); const gchar *reason = gst_flow_get_name (ret);
GST_DEBUG_OBJECT (src, "pausing task, reason %s", reason); GST_DEBUG_OBJECT (src, "pausing task, reason %s", reason);
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 (GST_FLOW_IS_FATAL (ret) || ret == GST_FLOW_NOT_LINKED) {
/* for fatal errors we post an error message */ if (ret == GST_FLOW_UNEXPECTED) {
GST_ELEMENT_ERROR (src, STREAM, FAILED, /* perform EOS logic */
(_("Internal data flow error.")), if (src->segment.flags & GST_SEEK_FLAG_SEGMENT) {
("streaming task paused, reason %s", reason)); gst_element_post_message (GST_ELEMENT (src),
gst_pad_push_event (pad, gst_event_new_eos ()); gst_message_new_segment_done (GST_OBJECT (src),
src->priv->last_sent_eos = TRUE; src->segment.format, src->segment.last_stop));
} else {
gst_pad_push_event (pad, gst_event_new_eos ());
src->priv->last_sent_eos = TRUE;
}
} else {
/* for fatal errors we post an error message */
GST_ELEMENT_ERROR (src, STREAM, FAILED,
(_("Internal data flow error.")),
("streaming task paused, reason %s", reason));
gst_pad_push_event (pad, gst_event_new_eos ());
src->priv->last_sent_eos = TRUE;
}
} }
goto done; goto done;
} }
error: null_buffer:
{ {
GST_ELEMENT_ERROR (src, STREAM, FAILED, GST_ELEMENT_ERROR (src, STREAM, FAILED,
(_("Internal data flow error.")), ("element returned NULL buffer")); (_("Internal data flow error.")), ("element returned NULL buffer"));