From 980051ed070f8b2fb9d215d6ab481cb2c473adda Mon Sep 17 00:00:00 2001 From: Scott Talbert Date: Mon, 10 Jan 2022 10:51:37 -0500 Subject: [PATCH] Fix GstPlayer with GstPlayerVideoOverlayVideoRenderer (#2035937) --- ...time-configuration-of-video-renderer.patch | 94 +++++++++++++++++++ ...e-GstPlay-is-created-before-the-wrap.patch | 37 ++++++++ gstreamer1-plugins-bad-free.spec | 12 ++- 3 files changed, 142 insertions(+), 1 deletion(-) create mode 100644 0001-play-Allow-runtime-configuration-of-video-renderer.patch create mode 100644 0002-player-Ensure-the-GstPlay-is-created-before-the-wrap.patch diff --git a/0001-play-Allow-runtime-configuration-of-video-renderer.patch b/0001-play-Allow-runtime-configuration-of-video-renderer.patch new file mode 100644 index 0000000..6b6ee45 --- /dev/null +++ b/0001-play-Allow-runtime-configuration-of-video-renderer.patch @@ -0,0 +1,94 @@ +From 12a5bf64f88d3b7a714649752ec0bef2ec2b6ba1 Mon Sep 17 00:00:00 2001 +From: Philippe Normand +Date: Sat, 13 Nov 2021 12:17:23 +0000 +Subject: [PATCH 1/2] play: Allow runtime configuration of video-renderer + +This is a requirement for GstPlayer when using the default overlay interface +provided by the pipeline. The GstPlayerWrappedVideoRenderer requires a valid +pipeline, but that's available only after the GstPlay thread has successfully +started. + +Part-of: +--- + .../gst-libs/gst/play/gstplay.c | 35 ++++++++++++++----- + 1 file changed, 26 insertions(+), 9 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 79e47cd6f5..fbc55897ad 100644 +--- a/subprojects/gst-plugins-bad/gst-libs/gst/play/gstplay.c ++++ b/subprojects/gst-plugins-bad/gst-libs/gst/play/gstplay.c +@@ -352,8 +352,7 @@ gst_play_class_init (GstPlayClass * klass) + param_specs[PROP_VIDEO_RENDERER] = + g_param_spec_object ("video-renderer", + "Video Renderer", "Video renderer to use for rendering videos", +- GST_TYPE_PLAY_VIDEO_RENDERER, +- G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS); ++ GST_TYPE_PLAY_VIDEO_RENDERER, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); + + param_specs[PROP_URI] = g_param_spec_string ("uri", "URI", "Current URI", + DEFAULT_URI, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); +@@ -590,6 +589,18 @@ gst_play_set_rate_internal (GstPlay * self) + } + } + ++static void ++gst_play_set_playbin_video_sink (GstPlay * self) ++{ ++ GstElement *video_sink = NULL; ++ ++ if (self->video_renderer != NULL) ++ video_sink = ++ gst_play_video_renderer_create_video_sink (self->video_renderer, self); ++ if (video_sink) ++ g_object_set (self->playbin, "video-sink", video_sink, NULL); ++} ++ + static void + gst_play_set_property (GObject * object, guint prop_id, + const GValue * value, GParamSpec * pspec) +@@ -598,7 +609,11 @@ gst_play_set_property (GObject * object, guint prop_id, + + switch (prop_id) { + case PROP_VIDEO_RENDERER: ++ g_mutex_lock (&self->lock); ++ g_clear_object (&self->video_renderer); + self->video_renderer = g_value_dup_object (value); ++ gst_play_set_playbin_video_sink (self); ++ g_mutex_unlock (&self->lock); + break; + case PROP_URI:{ + g_mutex_lock (&self->lock); +@@ -2496,12 +2511,7 @@ gst_play_main (gpointer data) + gst_object_ref_sink (self->playbin); + + if (self->video_renderer) { +- GstElement *video_sink = +- gst_play_video_renderer_create_video_sink (self->video_renderer, +- self); +- +- if (video_sink) +- g_object_set (self->playbin, "video-sink", video_sink, NULL); ++ gst_play_set_playbin_video_sink (self); + } + + scaletempo = gst_element_factory_make ("scaletempo", NULL); +@@ -2638,8 +2648,15 @@ gst_play_new (GstPlayVideoRenderer * video_renderer) + + g_once (&once, gst_play_init_once, NULL); + +- self = g_object_new (GST_TYPE_PLAY, "video-renderer", video_renderer, NULL); ++ self = g_object_new (GST_TYPE_PLAY, NULL); + ++ // When the video_renderer is a GstPlayerWrappedVideoRenderer it cannot be set ++ // at construction time because it requires a valid pipeline which is created ++ // only after GstPlay has been constructed. That is why the video renderer is ++ // set *after* GstPlay has been constructed. ++ if (video_renderer != NULL) { ++ g_object_set (self, "video-renderer", video_renderer, NULL); ++ } + gst_object_ref_sink (self); + + if (video_renderer) +-- +2.33.1 + diff --git a/0002-player-Ensure-the-GstPlay-is-created-before-the-wrap.patch b/0002-player-Ensure-the-GstPlay-is-created-before-the-wrap.patch new file mode 100644 index 0000000..a8a2426 --- /dev/null +++ b/0002-player-Ensure-the-GstPlay-is-created-before-the-wrap.patch @@ -0,0 +1,37 @@ +From ee7fe545b2d6f8c26b0d53830395726e11ae6eb2 Mon Sep 17 00:00:00 2001 +From: Philippe Normand +Date: Sat, 13 Nov 2021 12:22:36 +0000 +Subject: [PATCH 2/2] player: Ensure the GstPlay is created before the wrapped + renderer + +The GstPlayerWrappedVideoRenderer implicitely depends on GstPlay. + +Fixes #878 + +Part-of: +--- + subprojects/gst-plugins-bad/gst-libs/gst/player/gstplayer.c | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +diff --git a/subprojects/gst-plugins-bad/gst-libs/gst/player/gstplayer.c b/subprojects/gst-plugins-bad/gst-libs/gst/player/gstplayer.c +index cbc9501a36..d11e7a62db 100644 +--- a/subprojects/gst-plugins-bad/gst-libs/gst/player/gstplayer.c ++++ b/subprojects/gst-plugins-bad/gst-libs/gst/player/gstplayer.c +@@ -573,10 +573,13 @@ gst_player_new (GstPlayerVideoRenderer * video_renderer, + g_object_new (GST_TYPE_PLAYER, "signal-dispatcher", signal_dispatcher, + NULL); + ++ self->play = gst_play_new (NULL); ++ + if (video_renderer != NULL) { + renderer = gst_player_wrapped_video_renderer_new (video_renderer, self); ++ g_object_set (self->play, "video-renderer", ++ GST_PLAY_VIDEO_RENDERER (renderer), NULL); + } +- self->play = gst_play_new (GST_PLAY_VIDEO_RENDERER (renderer)); + + if (signal_dispatcher != NULL) { + GMainContext *context = NULL; +-- +2.33.1 + diff --git a/gstreamer1-plugins-bad-free.spec b/gstreamer1-plugins-bad-free.spec index 7736292..4d5979d 100644 --- a/gstreamer1-plugins-bad-free.spec +++ b/gstreamer1-plugins-bad-free.spec @@ -14,7 +14,7 @@ Name: gstreamer1-plugins-bad-free Version: 1.19.3 -Release: 3%{?gitcommit:.git%{shortcommit}}%{?dist} +Release: 4%{?gitcommit:.git%{shortcommit}}%{?dist} Summary: GStreamer streaming media framework "bad" plugins License: LGPLv2+ and LGPLv2 @@ -34,6 +34,11 @@ Source1: gst-p-bad-cleanup.sh # https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/issues/1406 # https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1570 Patch0: 0001-examples-only-check-opencv_dep-if-option-is-not-disa.patch +# Fix GstPlayer with GstPlayerVideoOverlayVideoRenderer +# https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/878 +# https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1345 +Patch1: 0001-play-Allow-runtime-configuration-of-video-renderer.patch +Patch2: 0002-player-Ensure-the-GstPlay-is-created-before-the-wrap.patch BuildRequires: meson >= 0.48.0 BuildRequires: gcc-c++ @@ -239,6 +244,8 @@ aren't tested well enough, or the code is not of good enough quality. %prep %setup -q -n gst-plugins-bad-%{version} %patch0 -p1 +%patch1 -p3 +%patch2 -p3 %build %meson \ @@ -637,6 +644,9 @@ rm $RPM_BUILD_ROOT%{_bindir}/playout %changelog +* Mon Jan 10 2022 Scott Talbert - 1.19.3-4 +- Fix GstPlayer with GstPlayerVideoOverlayVideoRenderer (#2035937) + * Mon Jan 10 2022 Scott Talbert - 1.19.3-3 - Add BR for wayland-protocols-devel to fix another FTBFS