mxfdemux: Post an error message if we got EOS before having any source pads
authorSebastian Dröge <sebastian@centricular.com>
Sat, 26 Nov 2016 10:28:57 +0000 (12:28 +0200)
committerSebastian Dröge <sebastian@centricular.com>
Sat, 26 Nov 2016 10:28:57 +0000 (12:28 +0200)
Otherwise, sending an EOS event has no effect and the application waits
forever for something to happen.

gst/mxf/mxfdemux.c

index 525ff43..a380f6d 100644 (file)
@@ -3068,7 +3068,11 @@ pause:
 
     if (flow == GST_FLOW_EOS) {
       /* perform EOS logic */
-      if (demux->segment.flags & GST_SEEK_FLAG_SEGMENT) {
+      if (demux->src->len == 0) {
+        GST_ELEMENT_ERROR (demux, STREAM, WRONG_TYPE,
+            ("This stream contains no data."),
+            ("got eos and didn't find any streams"));
+      } else if (demux->segment.flags & GST_SEEK_FLAG_SEGMENT) {
         gint64 stop;
         GstMessage *m;
         GstEvent *e;
@@ -4084,6 +4088,12 @@ gst_mxf_demux_sink_event (GstPad * pad, GstObject * parent, GstEvent * event)
       GstMXFDemuxPad *p = NULL;
       guint i;
 
+      if (demux->src->len == 0) {
+        GST_ELEMENT_ERROR (demux, STREAM, WRONG_TYPE,
+            ("This stream contains no data."),
+            ("got eos and didn't find any streams"));
+      }
+
       for (i = 0; i < demux->essence_tracks->len; i++) {
         GstMXFDemuxEssenceTrack *t =
             &g_array_index (demux->essence_tracks, GstMXFDemuxEssenceTrack, i);