After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 787243 - pad: probe returning HANDLED does not behave in the expected way
pad: probe returning HANDLED does not behave in the expected way
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gstreamer (core)
git master
Other Linux
: Normal normal
: 1.13.1
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2017-09-04 10:50 UTC by Miguel París Díaz
Modified: 2017-09-05 08:52 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
pad: add test to check handled and drop probes (3.19 KB, patch)
2017-09-04 10:50 UTC, Miguel París Díaz
committed Details | Review
pad: Don't call remaining probes after they return DROPPED|HANDLED (1.27 KB, patch)
2017-09-04 12:37 UTC, Edward Hervey
committed Details | Review

Description Miguel París Díaz 2017-09-04 10:50:37 UTC
Created attachment 359065 [details] [review]
pad: add test to check handled and drop probes

Hello,
I have come across that probes returning HANDLED do not behave as the current doc says:
  @GST_PAD_PROBE_HANDLED: Data has been handled in the probe and will not be
    forwarded further. For events and buffers this is the same behaviour as
    %GST_PAD_PROBE_DROP (except that in this case you need to unref the buffer
    or event yourself). For queries it will also return %TRUE to the caller.
    The probe can also modify the #GstFlowReturn value by using the
     #GST_PAD_PROBE_INFO_FLOW_RETURN() accessor.
    Note that the resulting query must contain valid entries.
    Since: 1.6

The point is that if there is another probe in the same pad it is called after the probe returning HANDLED (when not expected) and if this other probe returns DROP we deal with a GstBuffer refcount problem.
In order to show this issue I have created a test where you can see:
GStreamer-CRITICAL **: gst_mini_object_unref: assertion 'mini_object->refcount > 0' failed
Comment 1 Edward Hervey 2017-09-04 12:37:48 UTC
Created attachment 359072 [details] [review]
pad: Don't call remaining probes after they return DROPPED|HANDLED

If multiple probes are set on a pad and one probe returns either
GST_PAD_PROBE_HANDLED or GST_PAD_PROBE_DROPPED we need to stop
calling the remaining probes.
Comment 2 Nicolas Dufresne (ndufresne) 2017-09-04 13:15:18 UTC
Review of attachment 359072 [details] [review]:

Make sense to me.
Comment 3 Edward Hervey 2017-09-04 15:33:11 UTC
commit 1b469fbcd07aec39683055e1c48c0e2b59a3da61 (HEAD -> master, origin/master, origin/HEAD)
Author: Miguel París <mparisdiaz@gmail.com>
Date:   Mon Sep 4 12:20:43 2017 +0200

    pad: add test to check handled and drop probes
    
    https://bugzilla.gnome.org/show_bug.cgi?id=787243

commit aed32ee2abf866f905b710102ef1a3f2dcd4e502
Author: Edward Hervey <edward@centricular.com>
Date:   Mon Sep 4 14:33:29 2017 +0200

    pad: Don't call remaining probes after they return DROPPED|HANDLED
    
    If multiple probes are set on a pad and one probe returns either
    GST_PAD_PROBE_HANDLED or GST_PAD_PROBE_DROPPED we need to stop
    calling the remaining probes.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=787243
Comment 4 Miguel París Díaz 2017-09-05 08:52:36 UTC
Thanks everybody for handling this so fast ;).