flvdemux: Make sure to only signal no-more-pads a single time

This commit is contained in:
Sebastian Dröge 2009-10-02 14:37:40 +02:00
parent ccddf0643d
commit f84bc538b5
3 changed files with 21 additions and 3 deletions

View file

@ -112,6 +112,8 @@ gst_flv_demux_cleanup (GstFLVDemux * demux)
demux->push_tags = FALSE; demux->push_tags = FALSE;
demux->got_par = FALSE; demux->got_par = FALSE;
demux->no_more_pads = FALSE;
gst_segment_init (&demux->segment, GST_FORMAT_TIME); gst_segment_init (&demux->segment, GST_FORMAT_TIME);
demux->w = demux->h = 0; demux->w = demux->h = 0;
@ -569,7 +571,11 @@ pause:
if (GST_FLOW_IS_FATAL (ret) || ret == GST_FLOW_NOT_LINKED) { if (GST_FLOW_IS_FATAL (ret) || ret == GST_FLOW_NOT_LINKED) {
if (ret == GST_FLOW_UNEXPECTED) { if (ret == GST_FLOW_UNEXPECTED) {
/* perform EOS logic */ /* perform EOS logic */
gst_element_no_more_pads (GST_ELEMENT_CAST (demux)); if (!demux->no_more_pads) {
gst_element_no_more_pads (GST_ELEMENT_CAST (demux));
demux->no_more_pads = TRUE;
}
if (demux->segment.flags & GST_SEEK_FLAG_SEGMENT) { if (demux->segment.flags & GST_SEEK_FLAG_SEGMENT) {
gint64 stop; gint64 stop;
@ -592,7 +598,11 @@ pause:
} }
} else { } else {
/* normal playback, send EOS to all linked pads */ /* normal playback, send EOS to all linked pads */
gst_element_no_more_pads (GST_ELEMENT (demux)); if (!demux->no_more_pads) {
gst_element_no_more_pads (GST_ELEMENT (demux));
demux->no_more_pads = TRUE;
}
GST_LOG_OBJECT (demux, "Sending EOS, at end of stream"); GST_LOG_OBJECT (demux, "Sending EOS, at end of stream");
if (!gst_flv_demux_push_src_event (demux, gst_event_new_eos ())) if (!gst_flv_demux_push_src_event (demux, gst_event_new_eos ()))
GST_WARNING_OBJECT (demux, "failed pushing EOS on streams"); GST_WARNING_OBJECT (demux, "failed pushing EOS on streams");
@ -951,7 +961,11 @@ gst_flv_demux_sink_event (GstPad * pad, GstEvent * event)
GST_DEBUG_OBJECT (demux, "committing index"); GST_DEBUG_OBJECT (demux, "committing index");
gst_index_commit (demux->index, demux->index_id); gst_index_commit (demux->index, demux->index_id);
} }
gst_element_no_more_pads (GST_ELEMENT (demux)); if (!demux->no_more_pads) {
gst_element_no_more_pads (GST_ELEMENT (demux));
demux->no_more_pads = TRUE;
}
if (!gst_flv_demux_push_src_event (demux, event)) if (!gst_flv_demux_push_src_event (demux, event))
GST_WARNING_OBJECT (demux, "failed pushing EOS on streams"); GST_WARNING_OBJECT (demux, "failed pushing EOS on streams");
ret = TRUE; ret = TRUE;

View file

@ -114,6 +114,8 @@ struct _GstFLVDemux
gboolean push_tags; gboolean push_tags;
gboolean strict; gboolean strict;
gboolean flushing; gboolean flushing;
gboolean no_more_pads;
}; };
struct _GstFLVDemuxClass struct _GstFLVDemuxClass

View file

@ -655,6 +655,7 @@ gst_flv_parse_tag_audio (GstFLVDemux * demux, GstBuffer * buffer)
if (demux->audio_pad && demux->video_pad) { if (demux->audio_pad && demux->video_pad) {
GST_DEBUG_OBJECT (demux, "emitting no more pads"); GST_DEBUG_OBJECT (demux, "emitting no more pads");
gst_element_no_more_pads (GST_ELEMENT (demux)); gst_element_no_more_pads (GST_ELEMENT (demux));
demux->no_more_pads = TRUE;
} }
} }
@ -969,6 +970,7 @@ gst_flv_parse_tag_video (GstFLVDemux * demux, GstBuffer * buffer)
if (demux->audio_pad && demux->video_pad) { if (demux->audio_pad && demux->video_pad) {
GST_DEBUG_OBJECT (demux, "emitting no more pads"); GST_DEBUG_OBJECT (demux, "emitting no more pads");
gst_element_no_more_pads (GST_ELEMENT (demux)); gst_element_no_more_pads (GST_ELEMENT (demux));
demux->no_more_pads = TRUE;
} }
} }