Use the new API to post flow ERROR messages on the bus

https://bugzilla.gnome.org/show_bug.cgi?id=770158
This commit is contained in:
Thibault Saunier 2016-08-19 11:12:10 -07:00 committed by Thibault Saunier
parent 268c18054d
commit 2fb716409c
17 changed files with 24 additions and 54 deletions

View File

@ -353,9 +353,7 @@ gst_gme_play (GstPad * pad)
if (flow_return == GST_FLOW_EOS) { if (flow_return == GST_FLOW_EOS) {
gst_pad_push_event (pad, gst_event_new_eos ()); gst_pad_push_event (pad, gst_event_new_eos ());
} else if (flow_return < GST_FLOW_EOS || flow_return == GST_FLOW_NOT_LINKED) { } else if (flow_return < GST_FLOW_EOS || flow_return == GST_FLOW_NOT_LINKED) {
GST_ELEMENT_ERROR (gme, STREAM, FAILED, ("Internal data stream error."), GST_ELEMENT_FLOW_ERROR (gme, flow_return);
("stream stopped, reason %s", gst_flow_get_name (flow_return)));
gst_pad_push_event (pad, gst_event_new_eos ()); gst_pad_push_event (pad, gst_event_new_eos ());
} }
} }

View File

@ -433,9 +433,7 @@ paused:
if (result == GST_FLOW_UNEXPECTED) { if (result == GST_FLOW_UNEXPECTED) {
gst_pad_send_event (pad, gst_event_new_eos ()); gst_pad_send_event (pad, gst_event_new_eos ());
} else if (result < GST_FLOW_UNEXPECTED || result == GST_FLOW_NOT_LINKED) { } else if (result < GST_FLOW_UNEXPECTED || result == GST_FLOW_NOT_LINKED) {
GST_ELEMENT_ERROR (basesink, STREAM, FAILED, GST_ELEMENT_FLOW_ERROR (basesink, result);
(_("Internal data stream error.")),
("stream stopped, reason %s", gst_flow_get_name (result)));
gst_pad_send_event (pad, gst_event_new_eos ()); gst_pad_send_event (pad, gst_event_new_eos ());
} }
gst_object_unref (this); gst_object_unref (this);

View File

@ -743,9 +743,7 @@ error:
{ {
if (ret != GST_FLOW_OK && ret != GST_FLOW_NOT_LINKED if (ret != GST_FLOW_OK && ret != GST_FLOW_NOT_LINKED
&& ret != GST_FLOW_FLUSHING) { && ret != GST_FLOW_FLUSHING) {
GST_ELEMENT_ERROR (teletext, STREAM, FAILED, GST_ELEMENT_FLOW_ERROR (teletext, ret);
("Internal data stream error."), ("stream stopped, reason %s",
gst_flow_get_name (ret)));
return GST_FLOW_ERROR; return GST_FLOW_ERROR;
} }
return ret; return ret;

View File

@ -743,9 +743,7 @@ eos:
} }
error: error:
{ {
GST_ELEMENT_ERROR (timidity, STREAM, FAILED, GST_ELEMENT_FLOW_ERROR (timidity, ret);
("Internal data stream error"),
("Streaming stopped, reason %s", gst_flow_get_name (ret)));
gst_pad_push_event (timidity->srcpad, gst_event_new_eos ()); gst_pad_push_event (timidity->srcpad, gst_event_new_eos ());
goto paused; goto paused;
} }

View File

@ -898,9 +898,7 @@ pause:
event = gst_event_new_eos (); event = gst_event_new_eos ();
/* for fatal errors we post an error message, post the error /* for fatal errors we post an error message, post the error
* first so the app knows about the error first. */ * first so the app knows about the error first. */
GST_ELEMENT_ERROR (wildmidi, STREAM, FAILED, GST_ELEMENT_FLOW_ERROR (wildmidi, ret);
("Internal data flow error."),
("streaming task paused, reason %s (%d)", reason, ret));
gst_pad_push_event (wildmidi->srcpad, event); gst_pad_push_event (wildmidi->srcpad, event);
} }
} }

View File

@ -2230,8 +2230,7 @@ _src_chain (GstPad * pad, GstObject * parent, GstBuffer * buffer)
gboolean finished = FALSE; gboolean finished = FALSE;
if (ret < GST_FLOW_EOS) { if (ret < GST_FLOW_EOS) {
GST_ELEMENT_ERROR (demux, STREAM, FAILED, (NULL), GST_ELEMENT_FLOW_ERROR (demux, ret);
("stream stopped, reason %s", gst_flow_get_name (ret)));
/* TODO push this on all pads */ /* TODO push this on all pads */
gst_pad_push_event (stream->pad, gst_event_new_eos ()); gst_pad_push_event (stream->pad, gst_event_new_eos ());
@ -3285,12 +3284,14 @@ gst_adaptive_demux_stream_download_loop (GstAdaptiveDemuxStream * stream)
break; break;
case GST_FLOW_NOT_LINKED: case GST_FLOW_NOT_LINKED:
{
GstFlowReturn ret;
gst_task_stop (stream->download_task); gst_task_stop (stream->download_task);
if (gst_adaptive_demux_combine_flows (demux)
== GST_FLOW_NOT_LINKED) { ret = gst_adaptive_demux_combine_flows (demux);
GST_ELEMENT_ERROR (demux, STREAM, FAILED, if (ret == GST_FLOW_NOT_LINKED) {
(_("Internal data stream error.")), ("stream stopped, reason %s", GST_ELEMENT_FLOW_ERROR (demux, ret);
gst_flow_get_name (GST_FLOW_NOT_LINKED))); }
} }
break; break;

View File

@ -1527,9 +1527,7 @@ pause:
} else if (ret < GST_FLOW_EOS || ret == GST_FLOW_NOT_LINKED) { } else if (ret < GST_FLOW_EOS || ret == GST_FLOW_NOT_LINKED) {
/* for fatal errors we post an error message, post the error /* for fatal errors we post an error message, post the error
* first so the app knows about the error first. */ * first so the app knows about the error first. */
GST_ELEMENT_ERROR (aiff, STREAM, FAILED, GST_ELEMENT_FLOW_ERROR (aiff, ret);
(_("Internal data flow error.")),
("streaming task paused, reason %s (%d)", reason, ret));
gst_pad_push_event (aiff->srcpad, gst_event_new_eos ()); gst_pad_push_event (aiff->srcpad, gst_event_new_eos ());
} }
return; return;

View File

@ -1282,9 +1282,7 @@ pause:
event = gst_event_new_eos (); event = gst_event_new_eos ();
/* for fatal errors we post an error message, post the error /* for fatal errors we post an error message, post the error
* first so the app knows about the error first. */ * first so the app knows about the error first. */
GST_ELEMENT_ERROR (midiparse, STREAM, FAILED, GST_ELEMENT_FLOW_ERROR (midiparse, ret);
("Internal data flow error."),
("streaming task paused, reason %s (%d)", reason, ret));
gst_pad_push_event (midiparse->srcpad, event); gst_pad_push_event (midiparse->srcpad, event);
} }
} }

View File

@ -3005,9 +3005,7 @@ pause:
} }
} }
} else if (ret == GST_FLOW_NOT_LINKED || ret < GST_FLOW_EOS) { } else if (ret == GST_FLOW_NOT_LINKED || ret < GST_FLOW_EOS) {
GST_ELEMENT_ERROR (demux, STREAM, FAILED, GST_ELEMENT_FLOW_ERROR (demux, ret);
("Internal data stream error."),
("stream stopped, reason %s", reason));
gst_ps_demux_send_event (demux, gst_event_new_eos ()); gst_ps_demux_send_event (demux, gst_event_new_eos ());
} }

View File

@ -1382,9 +1382,7 @@ error:
(_("Internal data stream error.")), (_("Internal data stream error.")),
("No program activated before EOS")); ("No program activated before EOS"));
} else if (ret == GST_FLOW_NOT_LINKED || ret < GST_FLOW_EOS) { } else if (ret == GST_FLOW_NOT_LINKED || ret < GST_FLOW_EOS) {
GST_ELEMENT_ERROR (base, STREAM, FAILED, GST_ELEMENT_FLOW_ERROR (base, ret);
(_("Internal data stream error.")),
("stream stopped, reason %s", reason));
GST_MPEGTS_BASE_GET_CLASS (base)->push_event (base, gst_event_new_eos ()); GST_MPEGTS_BASE_GET_CLASS (base)->push_event (base, gst_event_new_eos ());
} }
gst_pad_pause_task (base->sinkpad); gst_pad_pause_task (base->sinkpad);

View File

@ -3098,9 +3098,7 @@ pause:
} else if (flow == GST_FLOW_NOT_LINKED || flow < GST_FLOW_EOS) { } else if (flow == GST_FLOW_NOT_LINKED || flow < GST_FLOW_EOS) {
GstEvent *e; GstEvent *e;
GST_ELEMENT_ERROR (demux, STREAM, FAILED, GST_ELEMENT_FLOW_ERROR (demux, flow);
("Internal data stream error."),
("stream stopped, reason %s", reason));
e = gst_event_new_eos (); e = gst_event_new_eos ();
gst_event_set_seqnum (e, demux->seqnum); gst_event_set_seqnum (e, demux->seqnum);
gst_mxf_demux_push_src_event (demux, e); gst_mxf_demux_push_src_event (demux, e);

View File

@ -729,9 +729,7 @@ pause:
if (res == GST_FLOW_UNEXPECTED) { if (res == GST_FLOW_UNEXPECTED) {
gst_nuv_demux_send_eos (nuv); gst_nuv_demux_send_eos (nuv);
} else if (res == GST_FLOW_NOT_LINKED || res < GST_FLOW_UNEXPECTED) { } else if (res == GST_FLOW_NOT_LINKED || res < GST_FLOW_UNEXPECTED) {
GST_ELEMENT_ERROR (nuv, STREAM, FAILED, GST_ELEMENT_FLOW_ERROR (nuv, res);
(_("Internal data stream error.")),
("streaming stopped, reason %s", gst_flow_get_name (res)));
gst_nuv_demux_send_eos (nuv); gst_nuv_demux_send_eos (nuv);
} }

View File

@ -468,9 +468,7 @@ pause:
if (ret == GST_FLOW_UNEXPECTED) { if (ret == GST_FLOW_UNEXPECTED) {
gst_pad_push_event (ttaparse->srcpad, gst_event_new_eos ()); gst_pad_push_event (ttaparse->srcpad, gst_event_new_eos ());
} else if (ret < GST_FLOW_UNEXPECTED || ret == GST_FLOW_NOT_LINKED) { } else if (ret < GST_FLOW_UNEXPECTED || ret == GST_FLOW_NOT_LINKED) {
GST_ELEMENT_ERROR (ttaparse, STREAM, FAILED, GST_ELEMENT_FLOW_ERROR (ttaparse, ret);
("Internal data stream error."),
("streaming stopped, reason %s", gst_flow_get_name (ret)));
gst_pad_push_event (ttaparse->srcpad, gst_event_new_eos ()); gst_pad_push_event (ttaparse->srcpad, gst_event_new_eos ());
} }
} }

View File

@ -670,9 +670,7 @@ flow_error:
gst_event_new_eos ()); gst_event_new_eos ());
gst_pad_pause_task (GST_AUDIO_DECODER_SRC_PAD (self)); gst_pad_pause_task (GST_AUDIO_DECODER_SRC_PAD (self));
} else if (flow_ret < GST_FLOW_EOS) { } else if (flow_ret < GST_FLOW_EOS) {
GST_ELEMENT_ERROR (self, STREAM, FAILED, GST_ELEMENT_FLOW_ERROR (self, flow_ret);
("Internal data stream error."), ("stream stopped, reason %s",
gst_flow_get_name (flow_ret)));
gst_pad_push_event (GST_AUDIO_DECODER_SRC_PAD (self), gst_pad_push_event (GST_AUDIO_DECODER_SRC_PAD (self),
gst_event_new_eos ()); gst_event_new_eos ());
gst_pad_pause_task (GST_AUDIO_DECODER_SRC_PAD (self)); gst_pad_pause_task (GST_AUDIO_DECODER_SRC_PAD (self));

View File

@ -1590,9 +1590,7 @@ flow_error:
gst_event_new_eos ()); gst_event_new_eos ());
gst_pad_pause_task (GST_VIDEO_DECODER_SRC_PAD (self)); gst_pad_pause_task (GST_VIDEO_DECODER_SRC_PAD (self));
} else if (flow_ret < GST_FLOW_EOS) { } else if (flow_ret < GST_FLOW_EOS) {
GST_ELEMENT_ERROR (self, STREAM, FAILED, GST_ELEMENT_FLOW_ERROR (self, flow_ret);
("Internal data stream error."), ("stream stopped, reason %s",
gst_flow_get_name (flow_ret)));
gst_pad_push_event (GST_VIDEO_DECODER_SRC_PAD (self), gst_pad_push_event (GST_VIDEO_DECODER_SRC_PAD (self),
gst_event_new_eos ()); gst_event_new_eos ());
gst_pad_pause_task (GST_VIDEO_DECODER_SRC_PAD (self)); gst_pad_pause_task (GST_VIDEO_DECODER_SRC_PAD (self));

View File

@ -1129,9 +1129,7 @@ flow_error:
gst_event_new_eos ()); gst_event_new_eos ());
gst_pad_pause_task (GST_VIDEO_ENCODER_SRC_PAD (self)); gst_pad_pause_task (GST_VIDEO_ENCODER_SRC_PAD (self));
} else if (flow_ret == GST_FLOW_NOT_LINKED || flow_ret < GST_FLOW_EOS) { } else if (flow_ret == GST_FLOW_NOT_LINKED || flow_ret < GST_FLOW_EOS) {
GST_ELEMENT_ERROR (self, STREAM, FAILED, GST_ELEMENT_FLOW_ERROR (self, flow_ret);
("Internal data stream error."), ("stream stopped, reason %s",
gst_flow_get_name (flow_ret)));
gst_pad_push_event (GST_VIDEO_ENCODER_SRC_PAD (self), gst_pad_push_event (GST_VIDEO_ENCODER_SRC_PAD (self),
gst_event_new_eos ()); gst_event_new_eos ());
gst_pad_pause_task (GST_VIDEO_ENCODER_SRC_PAD (self)); gst_pad_pause_task (GST_VIDEO_ENCODER_SRC_PAD (self));

View File

@ -535,8 +535,7 @@ gst_avf_asset_src_read_data (GstAVFAssetSrc *self, GstPad *pad,
} }
if (combined_ret != GST_FLOW_OK) { if (combined_ret != GST_FLOW_OK) {
GST_ELEMENT_ERROR (self, STREAM, FAILED, ("Internal data stream error."), GST_ELEMENT_FLOW_ERROR (self, ret);
("stream stopped reason %s", gst_flow_get_name (ret)));
} }
gst_pad_pause_task (pad); gst_pad_pause_task (pad);