From 35d33587722cf44478632827bfb7049c003c4fef 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 26/33] 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 fe7e0e3..934464c 100644
|
--- a/ext/wayland/gstwaylandsink.c
|
+++ b/ext/wayland/gstwaylandsink.c
|
@@ -917,7 +917,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;
|
|
@@ -991,7 +990,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;
|
@@ -1032,9 +1030,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... */
|
@@ -1060,8 +1055,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 1f70f76..4f517f8 100644
|
--- a/ext/wayland/gstwaylandsink.h
|
+++ b/ext/wayland/gstwaylandsink.h
|
@@ -61,6 +61,7 @@ struct _GstWaylandSink
|
|
gboolean video_info_changed;
|
GstVideoInfo video_info;
|
+ GstVideoInfo pool_vinfo;
|
gboolean fullscreen;
|
GstWlWindowLayer layer;
|
gdouble alpha;
|
--
|
2.20.1
|