waylandsink/waylandpool: ref the display instead of the sink to avoid cyclic references
The reference to the sink is not really needed anyway in waylandpool, what matters basically is that the display is active as long as the pool is active, so we really want to reference the display object instead of the sink.
This commit is contained in:
parent
253eafd4ef
commit
a67b08cdd0
@ -241,7 +241,7 @@ gst_wayland_sink_set_caps (GstBaseSink * bsink, GstCaps * caps)
|
|||||||
size = info.size;
|
size = info.size;
|
||||||
|
|
||||||
/* create a new pool for the new configuration */
|
/* create a new pool for the new configuration */
|
||||||
newpool = gst_wayland_buffer_pool_new (sink);
|
newpool = gst_wayland_buffer_pool_new (sink->display);
|
||||||
|
|
||||||
if (!newpool) {
|
if (!newpool) {
|
||||||
GST_DEBUG_OBJECT (sink, "Failed to create new pool");
|
GST_DEBUG_OBJECT (sink, "Failed to create new pool");
|
||||||
@ -334,7 +334,7 @@ gst_wayland_sink_propose_allocation (GstBaseSink * bsink, GstQuery * query)
|
|||||||
goto invalid_caps;
|
goto invalid_caps;
|
||||||
|
|
||||||
GST_DEBUG_OBJECT (sink, "create new pool");
|
GST_DEBUG_OBJECT (sink, "create new pool");
|
||||||
pool = gst_wayland_buffer_pool_new (sink);
|
pool = gst_wayland_buffer_pool_new (sink->display);
|
||||||
|
|
||||||
/* the normal size of a frame */
|
/* the normal size of a frame */
|
||||||
size = info.size;
|
size = info.size;
|
||||||
@ -406,7 +406,7 @@ gst_wayland_sink_render (GstBaseSink * bsink, GstBuffer * buffer)
|
|||||||
|
|
||||||
meta = gst_buffer_get_wl_meta (buffer);
|
meta = gst_buffer_get_wl_meta (buffer);
|
||||||
|
|
||||||
if (meta && meta->sink == sink) {
|
if (meta && meta->display == sink->display) {
|
||||||
GST_LOG_OBJECT (sink, "buffer %p from our pool, writing directly", buffer);
|
GST_LOG_OBJECT (sink, "buffer %p from our pool, writing directly", buffer);
|
||||||
to_render = buffer;
|
to_render = buffer;
|
||||||
} else {
|
} else {
|
||||||
|
@ -55,7 +55,7 @@ gst_wl_meta_api_get_type (void)
|
|||||||
static void
|
static void
|
||||||
gst_wl_meta_free (GstWlMeta * meta, GstBuffer * buffer)
|
gst_wl_meta_free (GstWlMeta * meta, GstBuffer * buffer)
|
||||||
{
|
{
|
||||||
gst_object_unref (meta->sink);
|
g_object_unref (meta->display);
|
||||||
munmap (meta->data, meta->size);
|
munmap (meta->data, meta->size);
|
||||||
wl_buffer_destroy (meta->wbuffer);
|
wl_buffer_destroy (meta->wbuffer);
|
||||||
}
|
}
|
||||||
@ -117,7 +117,7 @@ gst_wayland_buffer_pool_finalize (GObject * object)
|
|||||||
if (pool->wl_pool)
|
if (pool->wl_pool)
|
||||||
gst_wayland_buffer_pool_stop (GST_BUFFER_POOL (pool));
|
gst_wayland_buffer_pool_stop (GST_BUFFER_POOL (pool));
|
||||||
|
|
||||||
gst_object_unref (pool->sink);
|
g_object_unref (pool->display);
|
||||||
|
|
||||||
G_OBJECT_CLASS (gst_wayland_buffer_pool_parent_class)->finalize (object);
|
G_OBJECT_CLASS (gst_wayland_buffer_pool_parent_class)->finalize (object);
|
||||||
}
|
}
|
||||||
@ -201,9 +201,7 @@ gst_wayland_buffer_pool_start (GstBufferPool * pool)
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
self->wl_pool =
|
self->wl_pool = wl_shm_create_pool (self->display->shm, fd, size);
|
||||||
wl_shm_create_pool (self->sink->display->shm,
|
|
||||||
fd, size);
|
|
||||||
close (fd);
|
close (fd);
|
||||||
|
|
||||||
self->size = size;
|
self->size = size;
|
||||||
@ -263,7 +261,7 @@ gst_wayland_buffer_pool_alloc (GstBufferPool * pool, GstBuffer ** buffer,
|
|||||||
/* create buffer and its metadata object */
|
/* create buffer and its metadata object */
|
||||||
*buffer = gst_buffer_new ();
|
*buffer = gst_buffer_new ();
|
||||||
meta = (GstWlMeta *) gst_buffer_add_meta (*buffer, GST_WL_META_INFO, NULL);
|
meta = (GstWlMeta *) gst_buffer_add_meta (*buffer, GST_WL_META_INFO, NULL);
|
||||||
meta->sink = gst_object_ref (self->sink);
|
meta->display = g_object_ref (self->display);
|
||||||
meta->wbuffer = wl_shm_pool_create_buffer (self->wl_pool, offset,
|
meta->wbuffer = wl_shm_pool_create_buffer (self->wl_pool, offset,
|
||||||
width, height, stride, format);
|
width, height, stride, format);
|
||||||
meta->data = data;
|
meta->data = data;
|
||||||
@ -285,13 +283,13 @@ no_buffer:
|
|||||||
}
|
}
|
||||||
|
|
||||||
GstBufferPool *
|
GstBufferPool *
|
||||||
gst_wayland_buffer_pool_new (GstWaylandSink * waylandsink)
|
gst_wayland_buffer_pool_new (GstWlDisplay * display)
|
||||||
{
|
{
|
||||||
GstWaylandBufferPool *pool;
|
GstWaylandBufferPool *pool;
|
||||||
|
|
||||||
g_return_val_if_fail (GST_IS_WAYLAND_SINK (waylandsink), NULL);
|
g_return_val_if_fail (GST_IS_WL_DISPLAY (display), NULL);
|
||||||
pool = g_object_new (GST_TYPE_WAYLAND_BUFFER_POOL, NULL);
|
pool = g_object_new (GST_TYPE_WAYLAND_BUFFER_POOL, NULL);
|
||||||
pool->sink = gst_object_ref (waylandsink);
|
pool->display = g_object_ref (display);
|
||||||
|
|
||||||
return GST_BUFFER_POOL_CAST (pool);
|
return GST_BUFFER_POOL_CAST (pool);
|
||||||
}
|
}
|
||||||
|
@ -24,7 +24,7 @@
|
|||||||
#include <gst/video/video.h>
|
#include <gst/video/video.h>
|
||||||
#include <gst/video/gstvideometa.h>
|
#include <gst/video/gstvideometa.h>
|
||||||
|
|
||||||
#include "gstwaylandsink.h"
|
#include "wldisplay.h"
|
||||||
|
|
||||||
G_BEGIN_DECLS
|
G_BEGIN_DECLS
|
||||||
|
|
||||||
@ -42,7 +42,7 @@ const GstMetaInfo * gst_wl_meta_get_info (void);
|
|||||||
struct _GstWlMeta {
|
struct _GstWlMeta {
|
||||||
GstMeta meta;
|
GstMeta meta;
|
||||||
|
|
||||||
GstWaylandSink *sink;
|
GstWlDisplay *display;
|
||||||
|
|
||||||
struct wl_buffer *wbuffer;
|
struct wl_buffer *wbuffer;
|
||||||
void *data;
|
void *data;
|
||||||
@ -61,7 +61,7 @@ typedef struct _GstWaylandBufferPoolClass GstWaylandBufferPoolClass;
|
|||||||
struct _GstWaylandBufferPool
|
struct _GstWaylandBufferPool
|
||||||
{
|
{
|
||||||
GstBufferPool bufferpool;
|
GstBufferPool bufferpool;
|
||||||
GstWaylandSink *sink;
|
GstWlDisplay *display;
|
||||||
|
|
||||||
/* external configuration */
|
/* external configuration */
|
||||||
GstVideoInfo info;
|
GstVideoInfo info;
|
||||||
@ -80,7 +80,7 @@ struct _GstWaylandBufferPoolClass
|
|||||||
|
|
||||||
GType gst_wayland_buffer_pool_get_type (void);
|
GType gst_wayland_buffer_pool_get_type (void);
|
||||||
|
|
||||||
GstBufferPool *gst_wayland_buffer_pool_new (GstWaylandSink * waylandsink);
|
GstBufferPool *gst_wayland_buffer_pool_new (GstWlDisplay * display);
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user