From aff79db608dbd41fd9c5f6ffb6496727efbdd7d0 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Sebastian=20Dr=C3=B6ge?= Date: Sat, 13 Aug 2022 11:50:20 +0300 Subject: [PATCH] play: Make ownership of video-sink clearer in combination with floating references And correctly handle the case of VideoRenderer::create_video_sink() not actually returning a floating reference, which might be tricky for some bindings. Part-of: --- subprojects/gst-plugins-bad/gst-libs/gst/play/gstplay.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/subprojects/gst-plugins-bad/gst-libs/gst/play/gstplay.c b/subprojects/gst-plugins-bad/gst-libs/gst/play/gstplay.c index 63bbf64..950be08 100644 --- a/subprojects/gst-plugins-bad/gst-libs/gst/play/gstplay.c +++ b/subprojects/gst-plugins-bad/gst-libs/gst/play/gstplay.c @@ -598,11 +598,16 @@ gst_play_set_playbin_video_sink (GstPlay * self) { GstElement *video_sink = NULL; - if (self->video_renderer != NULL) + if (self->video_renderer != NULL) { video_sink = gst_play_video_renderer_create_video_sink (self->video_renderer, self); - if (video_sink) + } + + if (video_sink) { + gst_object_ref_sink (video_sink); g_object_set (self->playbin, "video-sink", video_sink, NULL); + gst_object_unref (video_sink); + } } static void -- 2.7.4