matroskademux: avoid posting invalid duration for each frame
authorNicola Murino <nicola.murino@gmail.com>
Sat, 28 Jan 2012 10:13:16 +0000 (11:13 +0100)
committerVincent Penquerc'h <vincent.penquerch@collabora.co.uk>
Mon, 6 Feb 2012 10:23:51 +0000 (10:23 +0000)
https://bugzilla.gnome.org/show_bug.cgi?id=666583

gst/matroska/matroska-demux.c

index c30e0d0..6e49baa 100644 (file)
@@ -3512,10 +3512,12 @@ gst_matroska_demux_parse_blockgroup_or_simpleblock (GstMatroskaDemux * demux,
           gst_segment_set_duration (&demux->common.segment, GST_FORMAT_TIME,
               last_stop_end - demux->stream_start_time);
           GST_OBJECT_UNLOCK (demux);
-          gst_element_post_message (GST_ELEMENT_CAST (demux),
-              gst_message_new_duration (GST_OBJECT_CAST (demux),
-                  GST_FORMAT_TIME, GST_CLOCK_TIME_NONE));
-          demux->invalid_duration = TRUE;
+          if (!demux->invalid_duration) {
+            gst_element_post_message (GST_ELEMENT_CAST (demux),
+                gst_message_new_duration (GST_OBJECT_CAST (demux),
+                    GST_FORMAT_TIME, GST_CLOCK_TIME_NONE));
+            demux->invalid_duration = TRUE;
+          }
         } else {
           GST_OBJECT_UNLOCK (demux);
         }