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)) {
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)) {
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;
}
/* 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:
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) {
- /* 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)));
- }
+ /* 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;
}