waylandsink: access sink->pool in a more atomic fashion

This commit is contained in:
George Kiagiadakis 2014-02-14 17:20:42 +01:00
parent 58a4d247b3
commit e7650117af

View file

@ -212,7 +212,7 @@ static gboolean
gst_wayland_sink_set_caps (GstBaseSink * bsink, GstCaps * caps) gst_wayland_sink_set_caps (GstBaseSink * bsink, GstCaps * caps)
{ {
GstWaylandSink *sink; GstWaylandSink *sink;
GstBufferPool *newpool, *oldpool; GstBufferPool *newpool;
GstVideoInfo info; GstVideoInfo info;
GstStructure *structure; GstStructure *structure;
static GstAllocationParams params = { 0, 0, 0, 15, }; static GstAllocationParams params = { 0, 0, 0, 15, };
@ -252,10 +252,8 @@ gst_wayland_sink_set_caps (GstBaseSink * bsink, GstCaps * caps)
if (!gst_buffer_pool_set_config (newpool, structure)) if (!gst_buffer_pool_set_config (newpool, structure))
goto config_failed; goto config_failed;
oldpool = sink->pool; gst_object_replace ((GstObject **) & sink->pool, (GstObject *) newpool);
sink->pool = newpool; gst_object_unref (newpool);
if (oldpool)
gst_object_unref (oldpool);
return TRUE; return TRUE;
@ -298,7 +296,7 @@ static gboolean
gst_wayland_sink_propose_allocation (GstBaseSink * bsink, GstQuery * query) gst_wayland_sink_propose_allocation (GstBaseSink * bsink, GstQuery * query)
{ {
GstWaylandSink *sink = GST_WAYLAND_SINK (bsink); GstWaylandSink *sink = GST_WAYLAND_SINK (bsink);
GstBufferPool *pool; GstBufferPool *pool = NULL;
GstStructure *config; GstStructure *config;
GstCaps *caps; GstCaps *caps;
guint size; guint size;
@ -309,8 +307,8 @@ gst_wayland_sink_propose_allocation (GstBaseSink * bsink, GstQuery * query)
if (caps == NULL) if (caps == NULL)
goto no_caps; goto no_caps;
if ((pool = sink->pool)) if (sink->pool)
gst_object_ref (pool); pool = gst_object_ref (sink->pool);
if (pool != NULL) { if (pool != NULL) {
GstCaps *pcaps; GstCaps *pcaps;