[Bug 707605] Need "reverse-funnel" element

GStreamer (bugzilla.gnome.org) bugzilla at gnome.org
Tue Oct 8 12:42:36 CEST 2013


https://bugzilla.gnome.org/show_bug.cgi?id=707605
  GStreamer | gstreamer (core) | git

--- Comment #38 from Sebastian Dröge (slomo) <slomo at circular-chaos.org> 2013-10-08 10:42:33 UTC ---
(In reply to comment #37)
> ::: plugins/elements/gststreamiddemux.c
> @@ +191,3 @@
> +  demux->active_srcpad = srcpad;
> +  g_hash_table_insert (demux->stream_id_pairs, g_strdup (stream_id),
> +      (gpointer) srcpad);
> 
> Do you want to use the RW lock or the object lock for the hashtable now? You do
> both in inconsistent ways currently.
> => I did understand that you want me to use object lock instead of using
> g_rw_lock_writer_lock().
> If I want to use object lock, I need to remove RW lock with
> g_rw_lock_reader_lock()?

Use one of them, but make the usage consistent.

> @@ +287,3 @@
> +    res = gst_pad_event_default (pad, parent, event);
> +  else if (demux->active_srcpad)
> +    res = gst_pad_push_event (demux->active_srcpad, event);
> 
> You need locking to access the active_srcpad as elsewhere.
> => do you think object lock is needed above gst_pad_push_event
> (demux->active_srcpad, event)?

Yes, code like this:
lock();
pad = gst_object_ref (demux->active_srcpad);
unlock();
res = gst_pad_push_event (pad, event);
gst_object_unref (pad);

> @@ +311,3 @@
> +  if (srcpad != NULL) {
> +    if (GST_OBJECT_REFCOUNT_VALUE (srcpad) > 0)
> +      gst_object_unref (srcpad);
> 
> Never do something like this, if you need it you get the refcounting wrong
> elsewhere.
> => Could you tell me why i am not using GST_OBJECT_REFCOUNT_VALUE() ?
> I think that if I could know refcount of srcpad, then I could call
> gst_object_unref(srcpad)
> Is there any idea for this?

Read about the concepts of refcounting. Either you own a reference and need to
unref or give it away, or you don't and then don't unref or give it away.

> @@ +358,3 @@
> +      gst_object_unref (demux->active_srcpad);
> +    demux->active_srcpad = NULL;
> +  }
> 
> hashtable and active_srcpad need proper locking
> => before release hashtable and active_srcpad, object lock is needed, right?

Depends on which lock you want to use. IMHO you can just use the object lock
for all of these things and just get rid of that RW lock.

-- 
Configure bugmail: https://bugzilla.gnome.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.


More information about the gstreamer-bugs mailing list