mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 12:11:13 +00:00
asfdemux: Handle issues with "empty" files
In some corrupted files, we could end up with no actual streams being exposed. In those cases, make sure we properly propagate the failure all the way to the loop function. This avoids ending up in cases where we are neither EOS'd nor ERROR'd out from a pipeline point of view. https://bugzilla.gnome.org/show_bug.cgi?id=774846
This commit is contained in:
parent
aab716ac40
commit
45c7826d76
1 changed files with 21 additions and 6 deletions
|
@ -1493,7 +1493,7 @@ gst_asf_demux_update_caps_from_payload (GstASFDemux * demux, AsfStream * stream)
|
|||
static gboolean
|
||||
gst_asf_demux_check_activate_streams (GstASFDemux * demux, gboolean force)
|
||||
{
|
||||
guint i;
|
||||
guint i, actual_streams = 0;
|
||||
|
||||
if (demux->activated_streams)
|
||||
return TRUE;
|
||||
|
@ -1522,11 +1522,18 @@ gst_asf_demux_check_activate_streams (GstASFDemux * demux, gboolean force)
|
|||
* a stream, then we active it, or we don't, then we'll ignore it */
|
||||
GST_LOG_OBJECT (stream->pad, "is prerolled - activate!");
|
||||
gst_asf_demux_activate_stream (demux, stream);
|
||||
actual_streams += 1;
|
||||
} else {
|
||||
GST_LOG_OBJECT (stream->pad, "no data, ignoring stream");
|
||||
}
|
||||
}
|
||||
|
||||
if (actual_streams == 0) {
|
||||
/* We don't have any streams activated ! */
|
||||
GST_ERROR_OBJECT (demux, "No streams activated!");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
gst_asf_demux_release_old_pads (demux);
|
||||
|
||||
demux->activated_streams = TRUE;
|
||||
|
@ -2078,7 +2085,7 @@ eos:
|
|||
* less data queued than required for preroll; force stream activation and
|
||||
* send any pending payloads before sending EOS */
|
||||
if (!demux->activated_streams)
|
||||
gst_asf_demux_push_complete_payloads (demux, TRUE);
|
||||
flow = gst_asf_demux_push_complete_payloads (demux, TRUE);
|
||||
|
||||
/* we want to push an eos or post a segment-done in any case */
|
||||
if (demux->segment.flags & GST_SEEK_FLAG_SEGMENT) {
|
||||
|
@ -2105,9 +2112,14 @@ eos:
|
|||
}
|
||||
|
||||
if (!(demux->segment.flags & GST_SEEK_FLAG_SEGMENT)) {
|
||||
/* normal playback, send EOS to all linked pads */
|
||||
GST_INFO_OBJECT (demux, "Sending EOS, at end of stream");
|
||||
gst_asf_demux_send_event_unlocked (demux, gst_event_new_eos ());
|
||||
if (demux->activated_streams) {
|
||||
/* normal playback, send EOS to all linked pads */
|
||||
GST_INFO_OBJECT (demux, "Sending EOS, at end of stream");
|
||||
gst_asf_demux_send_event_unlocked (demux, gst_event_new_eos ());
|
||||
} else {
|
||||
GST_WARNING_OBJECT (demux, "EOS without exposed streams");
|
||||
flow = GST_FLOW_EOS;
|
||||
}
|
||||
}
|
||||
/* ... and fall through to pause */
|
||||
}
|
||||
|
@ -2119,7 +2131,10 @@ pause:
|
|||
gst_pad_pause_task (demux->sinkpad);
|
||||
|
||||
/* For the error cases */
|
||||
if (flow < GST_FLOW_EOS || flow == GST_FLOW_NOT_LINKED) {
|
||||
if (flow == GST_FLOW_EOS && !demux->activated_streams) {
|
||||
GST_ELEMENT_ERROR (demux, STREAM, WRONG_TYPE, (NULL),
|
||||
("This doesn't seem to be an ASF file"));
|
||||
} else if (flow < GST_FLOW_EOS || flow == GST_FLOW_NOT_LINKED) {
|
||||
/* Post an error. Hopefully something else already has, but if not... */
|
||||
GST_ELEMENT_FLOW_ERROR (demux, flow);
|
||||
gst_asf_demux_send_event_unlocked (demux, gst_event_new_eos ());
|
||||
|
|
Loading…
Reference in a new issue