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: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2880>
This commit is contained in:
Sebastian Dröge 2022-08-13 11:50:20 +03:00
parent f060b8b6f3
commit aff79db608

View file

@ -598,11 +598,16 @@ gst_play_set_playbin_video_sink (GstPlay * self)
{ {
GstElement *video_sink = NULL; GstElement *video_sink = NULL;
if (self->video_renderer != NULL) if (self->video_renderer != NULL) {
video_sink = video_sink =
gst_play_video_renderer_create_video_sink (self->video_renderer, self); 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); g_object_set (self->playbin, "video-sink", video_sink, NULL);
gst_object_unref (video_sink);
}
} }
static void static void