From 7cb2dff8307b9579c9e64fac7054185c82581f1c Mon Sep 17 00:00:00 2001 From: =?utf8?q?Sebastian=20Dr=C3=B6ge?= Date: Tue, 19 Oct 2021 17:07:37 +0300 Subject: [PATCH] video-overlay-composition: Fix constructor guard to actually allow NULL as parameter And don't use a NULL rectangle later. Part-of: --- .../gst-libs/gst/video/video-overlay-composition.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/subprojects/gst-plugins-base/gst-libs/gst/video/video-overlay-composition.c b/subprojects/gst-plugins-base/gst-libs/gst/video/video-overlay-composition.c index de47a2b..ee83ec1 100644 --- a/subprojects/gst-plugins-base/gst-libs/gst/video/video-overlay-composition.c +++ b/subprojects/gst-plugins-base/gst-libs/gst/video/video-overlay-composition.c @@ -344,7 +344,7 @@ gst_video_overlay_composition_new (GstVideoOverlayRectangle * rectangle) GstVideoOverlayComposition *comp; g_return_val_if_fail (GST_IS_VIDEO_OVERLAY_RECTANGLE (rectangle) - || NULL, NULL); + || rectangle == NULL, NULL); comp = g_slice_new0 (GstVideoOverlayComposition); @@ -356,14 +356,15 @@ gst_video_overlay_composition_new (GstVideoOverlayRectangle * rectangle) comp->rectangles = g_new0 (GstVideoOverlayRectangle *, RECTANGLE_ARRAY_STEP); comp->seq_num = gst_video_overlay_get_seqnum (); - - /* since the rectangle was created earlier, its seqnum is smaller than ours */ - comp->min_seq_num_used = rectangle->seq_num; + comp->min_seq_num_used = comp->seq_num; GST_LOG ("new composition %p: seq_num %u", comp, comp->seq_num); - if (rectangle) + if (rectangle) { + /* since the rectangle was created earlier, its seqnum is smaller than ours */ + comp->min_seq_num_used = rectangle->seq_num; gst_video_overlay_composition_add_rectangle (comp, rectangle); + } return comp; } -- 2.7.4