From c5a57190ee35dfe341da88d7048f7d9fe12f1ee0 Mon Sep 17 00:00:00 2001 From: Stefan Kost Date: Wed, 12 Jan 2011 16:03:30 +0200 Subject: [PATCH] typefind: don't take object lock for reading the found caps Once we switch to normal mode, we're not typefinding anymore and thus the caps will not change. Therefore can avoid the object lock in the data-flow path. The locking was added in order to fix bug #608877. --- plugins/elements/gsttypefindelement.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/plugins/elements/gsttypefindelement.c b/plugins/elements/gsttypefindelement.c index 0b545e0ff5..baf36c4cf7 100644 --- a/plugins/elements/gsttypefindelement.c +++ b/plugins/elements/gsttypefindelement.c @@ -765,10 +765,9 @@ gst_type_find_element_chain (GstPad * pad, GstBuffer * buffer) /* we should already have called GST_ELEMENT_ERROR */ return GST_FLOW_ERROR; case MODE_NORMAL: - GST_OBJECT_LOCK (typefind); + /* don't take object lock as typefind->caps should not change anymore */ buffer = gst_buffer_make_metadata_writable (buffer); gst_buffer_set_caps (buffer, typefind->caps); - GST_OBJECT_UNLOCK (typefind); return gst_pad_push (typefind->src, buffer); case MODE_TYPEFIND:{ GST_OBJECT_LOCK (typefind); @@ -874,11 +873,9 @@ gst_type_find_element_getrange (GstPad * srcpad, ret = gst_pad_pull_range (typefind->sink, offset, length, buffer); if (ret == GST_FLOW_OK && buffer && *buffer) { - GST_OBJECT_LOCK (typefind); - + /* don't take object lock as typefind->caps should not change anymore */ /* we assume that pulled buffers are meta-data writable */ gst_buffer_set_caps (*buffer, typefind->caps); - GST_OBJECT_UNLOCK (typefind); } return ret;