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 619522 - basetransform fix for upstream caps-renegotiation
basetransform fix for upstream caps-renegotiation
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gstreamer (core)
git master
Other Linux
: Normal normal
: 0.10.31
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2010-05-24 14:39 UTC by Rob Clark
Modified: 2010-07-28 10:23 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
basetransform fix for upstream caps-renegotiation (3.04 KB, patch)
2010-05-24 14:41 UTC, Rob Clark
none Details | Review

Description Rob Clark 2010-05-24 14:39:19 UTC
If initially pass-through caps are negotiated between a transform element's
sink and src pads, but then the downstream element returns different caps
on a buffer from pad_alloc(), basetransform gets stuck with proxy_alloc=TRUE
even though the upstream peer doesn't accept the caps, causing
gst_pad_peer_accept_caps() to be called on each buffer in _buffer_alloc():

    if (!gst_caps_is_equal (newcaps, caps)) {
      GST_DEBUG_OBJECT (trans, "caps are new");
      /* we have new caps, see if we can proxy downstream */
>>    if (gst_pad_peer_accept_caps (pad, newcaps)) {
        /* peer accepts the caps, return a buffer in this format */
        GST_DEBUG_OBJECT (trans, "peer accepted new caps");

which is taking ~40ms/frame.

This patch does two things.  (1) if the buffer returned from pad_alloc() has
new caps, trigger the decision whether to proxy the buffer-alloc to be
revisited, and (2) disable proxy if peer does not accept new caps.  (The first
part may not be strictly needed, but seemed like a good idea.)

Note that this issue would not arise except in case of downstream elements
who have on their template-caps, some that would be suitable for pass-through,
but at runtime pick more restrictive caps (for ex, after querying a driver for
what formats it actually supports).
Comment 1 Rob Clark 2010-05-24 14:41:17 UTC
Created attachment 161870 [details] [review]
basetransform fix for upstream caps-renegotiation
Comment 2 Wim Taymans 2010-07-28 10:23:54 UTC
commit 29289ee79e1b49b6dcbb314bee8c760395e5c8e9
Author: Rob Clark <rob@ti.com>
Date:   Sat May 22 16:33:11 2010 -0500

    basetransform fix for upstream caps-renegotiation
    
    If initially pass-through caps are negotiated between a transform element's
    sink and src pads, but then the downstream element returns different caps
    on a buffer from pad_alloc(), basetransform gets stuck with proxy_alloc=TRUE
    even though the upstream peer doesn't accept the caps, causing
    gst_pad_peer_accept_caps() to be called on each buffer in _buffer_alloc():
    
        if (!gst_caps_is_equal (newcaps, caps)) {
          GST_DEBUG_OBJECT (trans, "caps are new");
          /* we have new caps, see if we can proxy downstream */
    >>    if (gst_pad_peer_accept_caps (pad, newcaps)) {
            /* peer accepts the caps, return a buffer in this format */
            GST_DEBUG_OBJECT (trans, "peer accepted new caps");
    
    which is taking ~40ms/frame.
    
    This patch does two things.  (1) if the buffer returned from pad_alloc() has
    new caps, trigger the decision whether to proxy the buffer-alloc to be
    revisited, and (2) disable proxy if peer does not accept new caps.  (The first
    part may not be strictly needed, but seemed like a good idea.)
    
    Note that this issue would not arise except in case of downstream elements
    who have on their template-caps, some that would be suitable for pass-through,
    but at runtime pick more restrictive caps (for ex, after querying a driver for
    what formats it actually supports).