mpegtsmux: detect and ignore gap buffers
authorAlex Hoenig <alexander.hoenig@progeny.net>
Tue, 12 May 2020 14:55:45 +0000 (10:55 -0400)
committerAlex Hoenig <alexander.hoenig@progeny.net>
Tue, 12 May 2020 16:18:28 +0000 (12:18 -0400)
Fixes #1291.  Without this, when a stream has gaps and then resumes, the next buffer PTS that is written to the TS is given the PTS of the first gap.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1263>

gst/mpegtsmux/gstbasetsmux.c

index d40d5a6..a68af99 100644 (file)
@@ -1076,6 +1076,12 @@ gst_base_ts_mux_aggregate_buffer (GstBaseTsMux * mux,
 
   GST_DEBUG_OBJECT (mux, "Pads collected");
 
+  if (buf && gst_buffer_get_size (buf) == 0
+      && GST_BUFFER_FLAG_IS_SET (buf, GST_BUFFER_FLAG_GAP)) {
+    gst_buffer_unref (buf);
+    return GST_FLOW_OK;
+  }
+
   if (G_UNLIKELY (mux->first)) {
     ret = gst_base_ts_mux_create_streams (mux);
     if (G_UNLIKELY (ret != GST_FLOW_OK)) {