asfdemux: If pushing buffers returned EOS, go into the EOS and not failure code path

We don't want to unconditionally send an EOS event downstream, but might want
to send a SEGMENT_DONE message/event instead if a segment seek was done
before.

https://bugzilla.gnome.org/show_bug.cgi?id=755469
This commit is contained in:
Sebastian Dröge 2015-09-23 16:31:28 +02:00
parent 5ff1ef181a
commit 42d7aec412

View file

@ -1808,7 +1808,6 @@ gst_asf_demux_loop (GstASFDemux * demux)
GstFlowReturn flow = GST_FLOW_OK;
GstBuffer *buf = NULL;
guint64 off;
gboolean sent_eos = FALSE;
if (G_UNLIKELY (demux->state == GST_ASF_DEMUX_STATE_HEADER)) {
if (!gst_asf_demux_pull_headers (demux, &flow)) {
@ -1832,14 +1831,15 @@ gst_asf_demux_loop (GstASFDemux * demux)
if (G_UNLIKELY (!gst_asf_demux_pull_data (demux, off,
demux->packet_size * demux->speed_packets, &buf, &flow))) {
GST_DEBUG_OBJECT (demux, "got flow %s", gst_flow_get_name (flow));
if (flow == GST_FLOW_EOS)
if (flow == GST_FLOW_EOS) {
goto eos;
else if (flow == GST_FLOW_FLUSHING) {
} else if (flow == GST_FLOW_FLUSHING) {
GST_DEBUG_OBJECT (demux, "Not fatal");
goto pause;
} else
} else {
goto read_failed;
}
}
if (G_LIKELY (demux->speed_packets == 1)) {
GstAsfDemuxParsePacketError err;
@ -1914,8 +1914,9 @@ gst_asf_demux_loop (GstASFDemux * demux)
gst_buffer_unref (buf);
if (G_UNLIKELY (demux->num_packets > 0
&& demux->packet >= demux->num_packets)) {
if (G_UNLIKELY ((demux->num_packets > 0
&& demux->packet >= demux->num_packets)
|| flow == GST_FLOW_EOS)) {
GST_LOG_OBJECT (demux, "reached EOS");
goto eos;
}
@ -1964,7 +1965,6 @@ eos:
/* 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 ());
sent_eos = TRUE;
/* ... and fall through to pause */
}
pause:
@ -1974,17 +1974,13 @@ pause:
demux->segment_running = FALSE;
gst_pad_pause_task (demux->sinkpad);
/* For the error cases (not EOS) */
if (!sent_eos) {
if (flow == GST_FLOW_EOS)
gst_asf_demux_send_event_unlocked (demux, gst_event_new_eos ());
else if (flow < GST_FLOW_EOS || flow == GST_FLOW_NOT_LINKED) {
/* For the error cases */
if (flow < GST_FLOW_EOS || flow == GST_FLOW_NOT_LINKED) {
/* Post an error. Hopefully something else already has, but if not... */
GST_ELEMENT_ERROR (demux, STREAM, FAILED,
(_("Internal data stream error.")),
("streaming stopped, reason %s", gst_flow_get_name (flow)));
}
}
return;
}