summaryrefslogtreecommitdiff
path: root/ext/closedcaption
diff options
context:
space:
mode:
authorMathieu Duponchelle <mathieu@centricular.com>2020-04-22 16:51:08 +0200
committerSebastian Dröge <slomo@coaxion.net>2020-04-24 08:47:50 +0000
commitf02300eef56d2fe7699ac82858ee60e8ff863cbc (patch)
tree723a1236a360d14ca7f7aac381267b91b2b0bccb /ext/closedcaption
parentac850fd25d4e36dc3e1b5393b7b492f33b35a874 (diff)
downloadgstreamer-plugins-bad-f02300eef56d2fe7699ac82858ee60e8ff863cbc.tar.gz
cccombiner: handle gap buffers adequately
- Don't try to map them as actual CC data, that was raising a critical - Consume video buffers up to the end of the gap Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1207>
Diffstat (limited to 'ext/closedcaption')
-rw-r--r--ext/closedcaption/gstcccombiner.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/ext/closedcaption/gstcccombiner.c b/ext/closedcaption/gstcccombiner.c
index bc7588403..a8adb7845 100644
--- a/ext/closedcaption/gstcccombiner.c
+++ b/ext/closedcaption/gstcccombiner.c
@@ -145,6 +145,32 @@ gst_cc_combiner_collect_captions (GstCCCombiner * self, gboolean timeout)
continue;
}
+ if (gst_buffer_get_size (caption_buf) == 0 &&
+ GST_BUFFER_FLAG_IS_SET (caption_buf, GST_BUFFER_FLAG_GAP)) {
+ /* This is a gap, we can go ahead. We only consume it once its end point
+ * is behind the current video running time. Important to note that
+ * we can't deal with gaps with no duration (-1)
+ */
+ if (!GST_CLOCK_TIME_IS_VALID (GST_BUFFER_DURATION (caption_buf))) {
+ GST_ERROR_OBJECT (self, "GAP buffer without a duration");
+
+ gst_buffer_unref (caption_buf);
+ gst_object_unref (caption_pad);
+
+ return GST_FLOW_ERROR;
+ }
+
+ gst_buffer_unref (caption_buf);
+
+ if (caption_time + GST_BUFFER_DURATION (caption_buf) <
+ self->current_video_running_time_end) {
+ gst_aggregator_pad_drop_buffer (caption_pad);
+ continue;
+ } else {
+ break;
+ }
+ }
+
/* Collected all caption buffers for this video buffer */
if (caption_time >= self->current_video_running_time_end) {
gst_buffer_unref (caption_buf);