mssdemux: add some more error handling

Post error in some more scenarios:
* when the manifest has no streams
* when getting the fragment url fails
This commit is contained in:
Thiago Santos 2012-12-21 16:42:11 -03:00
parent 529b248a89
commit 0f1ef317f0

View file

@ -301,7 +301,10 @@ gst_mss_demux_create_streams (GstMssDemux * mssdemux)
if (streams == NULL) {
GST_INFO_OBJECT (mssdemux, "No streams found in the manifest");
/* TODO post eos? */
GST_ELEMENT_ERROR (mssdemux, STREAM, DEMUX,
(_("This file contains no playable streams.")),
("no streams found at the Manifest"));
return;
}
for (iter = streams; iter; iter = g_slist_next (iter)) {
@ -434,7 +437,7 @@ gst_mss_demux_stream_loop (GstMssDemuxStream * stream)
break;
}
if (!path) {
/* TODO */
goto no_url_error;
}
GST_DEBUG_OBJECT (mssdemux, "Got url path '%s' for stream %p", path, stream);
@ -448,7 +451,7 @@ gst_mss_demux_stream_loop (GstMssDemuxStream * stream)
buffer = gst_buffer_make_metadata_writable (buffer);
gst_buffer_set_caps (buffer, GST_PAD_CAPS (stream->pad));
ret = gst_pad_push (stream->pad, buffer); /* TODO check return */
ret = gst_pad_push (stream->pad, buffer);
switch (ret) {
case GST_FLOW_UNEXPECTED:
goto eos; /* EOS ? */
@ -473,6 +476,14 @@ eos:
gst_task_stop (stream->stream_task);
return;
}
no_url_error:
{
GST_ELEMENT_ERROR (mssdemux, STREAM, DEMUX,
(_("Failed to get fragment URL.")),
("An error happened when getting fragment URL"));
gst_task_stop (stream->stream_task);
return;
}
error:
{
GST_WARNING_OBJECT (mssdemux, "Error while pushing fragment");