liveadder: handle gap buffer flag
authorMichael Olbrich <m.olbrich@pengutronix.de>
Mon, 14 Oct 2013 14:14:42 +0000 (16:14 +0200)
committerOlivier CrĂȘte <olivier.crete@collabora.com>
Tue, 3 Jun 2014 18:59:30 +0000 (14:59 -0400)
Remove GAP flag unless both sides have gap data, ignore
incoming data if it is gap data.

https://bugzilla.gnome.org/show_bug.cgi?id=722397

gst/liveadder/liveadder.c

index eed3f738fb1441baf3c20767910c6338f9b98430..1c3b7a0e0738784ae069a8843acca5ad4d837795 100644 (file)
@@ -1114,15 +1114,18 @@ gst_live_live_adder_chain (GstPad * pad, GstObject * parent, GstBuffer * buffer)
 
     mix_duration = mix_end - mix_start;
 
-    gst_buffer_map (oldbuffer, &oldmap, GST_MAP_WRITE);
-    gst_buffer_map (buffer, &map, GST_MAP_READ);
-    adder->func (oldmap.data +
-        gst_live_adder_length_from_duration (adder, old_skip),
-        map.data +
-        gst_live_adder_length_from_duration (adder, skip),
-        gst_live_adder_length_from_duration (adder, mix_duration));
-    gst_buffer_unmap (oldbuffer, &oldmap);
-    gst_buffer_unmap (buffer, &map);
+    if (!GST_BUFFER_FLAG_IS_SET (buffer, GST_BUFFER_FLAG_GAP)) {
+      GST_BUFFER_FLAG_UNSET (oldbuffer, GST_BUFFER_FLAG_GAP);
+      gst_buffer_map (oldbuffer, &oldmap, GST_MAP_WRITE);
+      gst_buffer_map (buffer, &map, GST_MAP_READ);
+      adder->func (oldmap.data +
+          gst_live_adder_length_from_duration (adder, old_skip),
+          map.data +
+          gst_live_adder_length_from_duration (adder, skip),
+          gst_live_adder_length_from_duration (adder, mix_duration));
+      gst_buffer_unmap (oldbuffer, &oldmap);
+      gst_buffer_unmap (buffer, &map);
+    }
     skip += mix_duration;
   }