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 746329 - Queries should always be writable when passed in the Gst.Pad.do_query 'vmethod'
Queries should always be writable when passed in the Gst.Pad.do_query 'vmethod'
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gst-python
1.4.0
Other Linux
: Normal normal
: 1.5.x
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2015-03-17 04:25 UTC by Andrew
Modified: 2015-04-24 09:28 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Simple program demonstrating the issue (2.71 KB, text/x-python)
2015-03-17 04:25 UTC, Andrew
Details

Description Andrew 2015-03-17 04:25:13 UTC
Created attachment 299569 [details]
Simple program demonstrating the issue

query.type: <enum GST_QUERY_CAPS of type GstQueryType>

(python3:2997): GStreamer-CRITICAL **: gst_query_set_caps_result: assertion 'gst_query_is_writable (query)' failed
done

(python3:2997): GStreamer-CRITICAL **: gst_mini_object_ref: assertion 'mini_object != NULL' failed

(python3:2997): GStreamer-CRITICAL **: gst_caps_can_intersect: assertion 'GST_IS_CAPS (caps1)' failed

(python3:2997): GStreamer-CRITICAL **: gst_mini_object_unref: assertion 'mini_object != NULL' failed
query.type: <enum GST_QUERY_CAPS of type GstQueryType>

(python3:2997): GStreamer-CRITICAL **: gst_query_set_caps_result: assertion 'gst_query_is_writable (query)' failed
done

(python3:2997): GStreamer-CRITICAL **: gst_mini_object_ref: assertion 'mini_object != NULL' failed

(python3:2997): GStreamer-CRITICAL **: gst_caps_can_intersect: assertion 'GST_IS_CAPS (caps2)' failed

(python3:2997): GStreamer-CRITICAL **: gst_mini_object_unref: assertion 'mini_object != NULL' failed
query.type: <enum GST_QUERY_CAPS of type GstQueryType>

(python3:2997): GStreamer-CRITICAL **: gst_query_set_caps_result: assertion 'gst_query_is_writable (query)' failed
done

(python3:2997): GStreamer-CRITICAL **: gst_mini_object_ref: assertion 'mini_object != NULL' failed

(python3:2997): GStreamer-CRITICAL **: gst_pad_template_new: assertion 'caps != NULL' failed

(python3:2997): GStreamer-CRITICAL **: gst_mini_object_unref: assertion 'mini_object != NULL' failed

(python3:2997): GStreamer-CRITICAL **: gst_element_request_compatible_pad: assertion 'GST_IS_PAD_TEMPLATE (templ)' failed

(python3:2997): GStreamer-CRITICAL **: gst_object_unref: assertion 'object != NULL' failed
(GLib.Error('Internal data flow error.', 'gst-stream-error-quark', 1), 'gstbasesrc.c(2933): gst_base_src_loop (): /GstPipeline:pipeline0/GstVideoTestSrc:videotestsrc0:\nstreaming task paused, reason not-linked (-1)')

Setting the PROXY_CAPS flag is not currently possible, see #746320
Comment 1 Andrew 2015-03-17 09:25:11 UTC
Compiled 1.4.0, doesn't fix the issue

Running on debian sid

python3 3.4.2-2
python3-gi 3.14.0-1
gstreamer1.0 1.4.4-2
Comment 2 Andrew 2015-03-18 12:34:00 UTC
Workaround, works by setting the refcount manually (courtesy of thiblahute on freenode) 

def _sink_query(self, pad, parent, query):
    query.mini_object.refcount = 1
    if query.type == Gst.QueryType.CAPS:
        res = pad.proxy_query_caps(query)
    else:
        res = pad.query_default(parent, query)
    query.mini_object.refcount = 2
    return res
Comment 3 Thibault Saunier 2015-03-18 13:08:04 UTC
We might want to go this way: http://phabricator.freedesktop.org/D41

I can not think of a cleaner solution actually.
Comment 4 Thibault Saunier 2015-03-19 09:30:01 UTC
commit 3d19875eb7c20cedb4ab64e295c338ebd32f4b04
Author: Thibault Saunier <tsaunier@gnome.org>
Date:   Wed Mar 18 13:53:55 2015 +0100

    overrides: Try hard to make the query writable in the pad query function
    
    Summary:
    We know that the bindings will get an extra ref but we know that
    it is not actually needed, so we are safe to decrease the refcount
    by one in that particular context making sure we give PyGI its
    ref back when we are done.
    
    Reviewers: Mathieu_Du
    
    Differential Revision: http://phabricator.freedesktop.org/D41
    
    https://bugzilla.gnome.org/show_bug.cgi?id=746329
Comment 5 Christoph Reiter (lazka) 2015-04-23 20:17:06 UTC
This breaks under Python 2. "from inspect import signature" is Python 3 only.
Comment 6 Thibault Saunier 2015-04-24 09:28:55 UTC
commit 74f7ffbb24ceaa122c36248419faa76a6afadffc
Author: Thibault Saunier <tsaunier@gnome.org>
Date:   Fri Apr 24 10:27:47 2015 +0200

    overrides: Do not use inspect.signature as it is not available in python2
    
    Fix regression from https://bugzilla.gnome.org/show_bug.cgi?id=746329