From 46f282d32b13b26dfd6774790aac8c595be8f056 Mon Sep 17 00:00:00 2001
|
From: Jeffy Chen <jeffy.chen@rock-chips.com>
|
Date: Wed, 22 Dec 2021 16:04:46 +0800
|
Subject: [PATCH 36/40] waylandsink: Use the correct video info to access
|
allocated buffer
|
|
The video info might changed after pool activated.
|
|
Signed-off-by: Jeffy Chen <jeffy.chen@rock-chips.com>
|
---
|
ext/wayland/gstwaylandsink.c | 10 +++++-----
|
ext/wayland/gstwaylandsink.h | 1 +
|
2 files changed, 6 insertions(+), 5 deletions(-)
|
|
diff --git a/ext/wayland/gstwaylandsink.c b/ext/wayland/gstwaylandsink.c
|
index 1e67bac..e09cae5 100644
|
--- a/ext/wayland/gstwaylandsink.c
|
+++ b/ext/wayland/gstwaylandsink.c
|
@@ -893,7 +893,6 @@ gst_wayland_sink_show_frame (GstVideoSink * vsink, GstBuffer * buffer)
|
GstVideoCropMeta *crop;
|
GstVideoMeta *vmeta;
|
GstVideoFormat format;
|
- GstVideoInfo old_vinfo;
|
GstMemory *mem;
|
struct wl_buffer *wbuf = NULL;
|
|
@@ -967,7 +966,6 @@ gst_wayland_sink_show_frame (GstVideoSink * vsink, GstBuffer * buffer)
|
/* update video info from video meta */
|
mem = gst_buffer_peek_memory (buffer, 0);
|
|
- old_vinfo = sink->video_info;
|
vmeta = gst_buffer_get_video_meta (buffer);
|
if (vmeta) {
|
gint i;
|
@@ -1008,9 +1006,6 @@ gst_wayland_sink_show_frame (GstVideoSink * vsink, GstBuffer * buffer)
|
GstVideoFrame src, dst;
|
GstVideoInfo src_info = sink->video_info;
|
|
- /* rollback video info changes */
|
- sink->video_info = old_vinfo;
|
-
|
/* we don't know how to create a wl_buffer directly from the provided
|
* memory, so we have to copy the data to shm memory that we know how
|
* to handle... */
|
@@ -1036,8 +1031,13 @@ gst_wayland_sink_show_frame (GstVideoSink * vsink, GstBuffer * buffer)
|
if (!gst_buffer_pool_set_config (sink->pool, config) ||
|
!gst_buffer_pool_set_active (sink->pool, TRUE))
|
goto activate_failed;
|
+
|
+ sink->pool_vinfo = sink->video_info;
|
}
|
|
+ /* rollback video info changes */
|
+ sink->video_info = sink->pool_vinfo;
|
+
|
ret = gst_buffer_pool_acquire_buffer (sink->pool, &to_render, NULL);
|
if (ret != GST_FLOW_OK)
|
goto no_buffer;
|
diff --git a/ext/wayland/gstwaylandsink.h b/ext/wayland/gstwaylandsink.h
|
index 8b99ca3..9ed5f42 100644
|
--- a/ext/wayland/gstwaylandsink.h
|
+++ b/ext/wayland/gstwaylandsink.h
|
@@ -60,6 +60,7 @@ struct _GstWaylandSink
|
|
gboolean video_info_changed;
|
GstVideoInfo video_info;
|
+ GstVideoInfo pool_vinfo;
|
gboolean fullscreen;
|
GstWlWindowLayer layer;
|
gdouble alpha;
|
--
|
2.17.1
|