adder: be more graceful in the clipfunction
authorStefan Sauer <ensonic@users.sf.net>
Thu, 1 Dec 2011 10:59:17 +0000 (11:59 +0100)
committerStefan Sauer <ensonic@users.sf.net>
Thu, 1 Dec 2011 11:03:17 +0000 (12:03 +0100)
Doing dynamic pipelines is hard in 0.10. As we don't have the sticky events in
0.10 and sending such events in special elements like adder and tee was outvoted
on last attempt, be graceful to the misbehaviour instead.

gst/adder/gstadder.c

index 9c69717..3726f27 100644 (file)
@@ -1016,8 +1016,14 @@ gst_adder_do_clip (GstCollectPads * pads, GstCollectData * data,
 {
   GstAdder *adder = GST_ADDER (user_data);
 
-  buffer = gst_audio_buffer_clip (buffer, &data->segment, adder->rate,
-      adder->bps);
+  /* in 0.10 the application might need to seek on newly added source-branches
+   * to make it send a newsegment, that is hard to sync and so the segment might
+   * not be initialized. Check this here to not trigger the assertion
+   */
+  if (data->segment.format != GST_FORMAT_UNDEFINED) {
+    buffer = gst_audio_buffer_clip (buffer, &data->segment, adder->rate,
+        adder->bps);
+  }
 
   return buffer;
 }