From 20483c3449e44d989d1d1f40ffc88dc3a6249ded Mon Sep 17 00:00:00 2001 From: Mathieu Duponchelle Date: Thu, 15 Jul 2021 21:10:14 +0200 Subject: cccombiner: fix scheduling with interlaced video buffers The initial code was written with the misunderstanding that IS_TOP_FIELD indicated that an interlaced buffer contained a top field, not that it contained only a top field Part-of: --- ext/closedcaption/gstcccombiner.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/ext/closedcaption/gstcccombiner.c b/ext/closedcaption/gstcccombiner.c index d0bb23c72..07d073e98 100644 --- a/ext/closedcaption/gstcccombiner.c +++ b/ext/closedcaption/gstcccombiner.c @@ -853,7 +853,7 @@ gst_cc_combiner_collect_captions (GstCCCombiner * self, gboolean timeout) /* Only relevant in alternate and mixed mode, no need to look at the caps */ if (GST_BUFFER_FLAG_IS_SET (self->current_video_buffer, GST_VIDEO_BUFFER_FLAG_INTERLACED)) { - if (GST_VIDEO_BUFFER_IS_TOP_FIELD (self->current_video_buffer)) { + if (!GST_VIDEO_BUFFER_IS_BOTTOM_FIELD (self->current_video_buffer)) { dequeue_caption (self, tc, 0); } } else { @@ -867,11 +867,12 @@ gst_cc_combiner_collect_captions (GstCCCombiner * self, gboolean timeout) if (self->progressive) { dequeue_caption (self, tc, 0); } else if (GST_BUFFER_FLAG_IS_SET (self->current_video_buffer, - GST_VIDEO_BUFFER_FLAG_INTERLACED)) { + GST_VIDEO_BUFFER_FLAG_INTERLACED) && + GST_BUFFER_FLAG_IS_SET (self->current_video_buffer, + GST_VIDEO_BUFFER_FLAG_ONEFIELD)) { if (GST_VIDEO_BUFFER_IS_TOP_FIELD (self->current_video_buffer)) { dequeue_caption (self, tc, 0); - } - if (GST_VIDEO_BUFFER_IS_BOTTOM_FIELD (self->current_video_buffer)) { + } else { dequeue_caption (self, tc, 1); } } else { @@ -886,7 +887,7 @@ gst_cc_combiner_collect_captions (GstCCCombiner * self, gboolean timeout) dequeue_caption (self, tc, 0); } else if (GST_BUFFER_FLAG_IS_SET (self->current_video_buffer, GST_VIDEO_BUFFER_FLAG_INTERLACED)) { - if (GST_VIDEO_BUFFER_IS_TOP_FIELD (self->current_video_buffer)) { + if (!GST_VIDEO_BUFFER_IS_BOTTOM_FIELD (self->current_video_buffer)) { dequeue_caption (self, tc, 0); } } else { -- cgit v1.2.1