Discussion:
[Bug 789055] New: Gst.Bin __init__ changed behavior between 1.10 and 1.12 GStreamer version
"GStreamer" (GNOME Bugzilla)
2017-10-16 13:23:30 UTC
Permalink
https://bugzilla.gnome.org/show_bug.cgi?id=789055

Bug ID: 789055
Summary: Gst.Bin __init__ changed behavior between 1.10 and
1.12 GStreamer version
Classification: Platform
Product: GStreamer
Version: 1.x
OS: Linux
Status: NEW
Severity: major
Priority: Normal
Component: gst-python
Assignee: gstreamer-***@lists.freedesktop.org
Reporter: ***@gmail.com
QA Contact: gstreamer-***@lists.freedesktop.org
GNOME version: ---

In version 1.10 Gst.Bin component behaved like a regular GObject class used in
python. I mean, you could define a new component using Gst.Bin as parent,
define properties as GObject.ParamFlags.CONSTRUCT_ONLY and pass values to
__init__ method in order to set them.

class MyBin(Gst.Bin):
foo = GObject.Property(type=str,
flags=GObject.ParamFlags.CONSTRUCT_ONLY |
GObject.ParamFlags.READWRITE)

def __init__(self, *args, **kwargs):
Gst.Bin.__init__(self, *args, **kwargs)
# your stuff



my_bin = MyBin(foo='bar')

But currently in Gst version 1.12 it raise an error because it does not pass
properties to GObject.Object.__init__.

TypeError: __init__() got an unexpected keyword argument 'foo'
--
You are receiving this mail because:
You are the QA Contact for the bug.
You are the assignee for the bug.
"GStreamer" (GNOME Bugzilla)
2017-10-16 13:24:49 UTC
Permalink
https://bugzilla.gnome.org/show_bug.cgi?id=789055

Andreu N <***@gmail.com> changed:

What |Removed |Added
----------------------------------------------------------------------------
Version|1.x |1.12.x
--
You are receiving this mail because:
You are the QA Contact for the bug.
You are the assignee for the bug.
"GStreamer" (GNOME Bugzilla)
2017-10-16 14:21:13 UTC
Permalink
https://bugzilla.gnome.org/show_bug.cgi?id=789055

Sebastian Dröge (slomo) <***@coaxion.net> changed:

What |Removed |Added
----------------------------------------------------------------------------
CC| |***@coaxion.net

--- Comment #1 from Sebastian Dröge (slomo) <***@coaxion.net> ---
I can't see any change between 1.10.0 and latest 1.12 that looks like it would
be the cause. Can you "git bisect" to find the offending commit?
--
You are receiving this mail because:
You are the QA Contact for the bug.
You are the assignee for the bug.
"GStreamer" (GNOME Bugzilla)
2017-10-16 14:40:41 UTC
Permalink
https://bugzilla.gnome.org/show_bug.cgi?id=789055

--- Comment #2 from Andreu N <***@gmail.com> ---
I've already reviewed changes between 1.10.x and 1.12.x. And you are right,
there are no (obvious) changes about that. And yet it happens. In fact, I can't
explain why it worked with 1.10.x. Behaviour in 1.12.x looks like regular one
looking at code.

I'm using a dirty workaround in 1.12.x:

class MyBin(Gst.Bin):
foo = GObject.Property(type=str,
flags=GObject.ParamFlags.CONSTRUCT_ONLY |
GObject.ParamFlags.READWRITE)

def __init__(self, *args, **kwargs):
Gst.Element.__init__(self, **kwargs)
Gst.Bin.__init__(self)
# your stuff

Perhaps I'm reserving more memory than I should, and I'm not sure if it will be
freed.
--
You are receiving this mail because:
You are the QA Contact for the bug.
You are the assignee for the bug.
"GStreamer" (GNOME Bugzilla)
2017-10-16 16:00:55 UTC
Permalink
https://bugzilla.gnome.org/show_bug.cgi?id=789055

--- Comment #3 from Andreu N <***@gmail.com> ---
More info:

In my remote machine (CentOS 7.2):

$ python3.4
Python 3.4.5 (default, May 29 2017, 15:17:55)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-11)] on linux
Type "help", "copyright", "credits" or "license" for more information.
import gi
gi.require_version('Gst', '1.0')
from gi.repository import Gst
Gst.version_string()
'GStreamer 1.10.2'
import inspect
inspect.signature(Gst.Bin.__init__).parameters
mappingproxy(OrderedDict([('self', <Parameter at 0x7f637cea4a68 'self'>),
('args', <Parameter at 0x7f637ce97e10 'args'>), ('kwargs', <Parameter at
0x7f637cc176c0 'kwargs'>)]))
Gst.Bin.__mro__
(<class 'gi.repository.Gst.Bin'>, <class 'gi.repository.Gst.Element'>, <class
'gi.repository.Gst.Object'>, <class 'gi.repository.GObject.InitiallyUnowned'>,
<class 'gi.overrides.GObject.Object'>, <class 'gi.repository.GObject.Object'>,
<class 'gi._gobject.GObject'>, <class 'gi.repository.Gst.ChildProxy'>, <class
'gobject.GInterface'>, <class 'object'>)


It looks like Gst.Bin is not overridden. It's weird because it is overridden
since commit 02ca5d3ad25 (5 years ago). On the other hand, I don't understand
why __init__ method must be overridden.

In my labtop (Fedora 26):

$ python3
Python 3.6.2 (default, Oct 2 2017, 16:51:32)
[GCC 7.2.1 20170915 (Red Hat 7.2.1-2)] on linux
Type "help", "copyright", "credits" or "license" for more information.
import gi
gi.require_version('Gst', '1.0')
from gi.repository import Gst
Gst.init([])
[]
Gst.version_string()
'GStreamer 1.12.3'
import inspect
inspect.signature(Gst.Bin.__init__).parameters
mappingproxy(OrderedDict([('self', <Parameter "self">), ('name', <Parameter
"name=None">)]))
Gst.Bin.__mro__
(<class 'gi.overrides.Gst.Bin'>, <class 'gi.repository.Gst.Bin'>, <class
'gi.repository.Gst.Element'>, <class 'gi.repository.Gst.Object'>, <class
'gi.repository.GObject.InitiallyUnowned'>, <class
'gi.overrides.GObject.Object'>, <class 'gi.repository.GObject.Object'>, <class
'gi._gobject.GObject'>, <class 'gi.repository.Gst.ChildProxy'>, <class
'gobject.GInterface'>, <class 'object'>)
--
You are receiving this mail because:
You are the QA Contact for the bug.
You are the assignee for the bug.
"GStreamer" (GNOME Bugzilla)
2018-01-14 20:28:59 UTC
Permalink
https://bugzilla.gnome.org/show_bug.cgi?id=789055

Tim-Philipp Müller <***@zen.co.uk> changed:

What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |NEEDINFO
CC| |***@zen.co.uk

--- Comment #4 from Tim-Philipp Müller <***@zen.co.uk> ---
Could this be caused by different versions of g-i/pygi or the presence/absence
of gst-python?

On my debian sid:

$ python3
Python 3.6.4 (default, Jan 5 2018, 02:13:53)
inspect.signature(Gst.Bin.__init__).parameters
mappingproxy(OrderedDict([('self', <Parameter "self">), ('args', <Parameter
"*args">), ('kwargs', <Parameter "**kwargs">)]))
Gst.Bin.__mro__
(<class 'gi.repository.Gst.Bin'>, <class 'gi.repository.Gst.Element'>, <class
'gi.repository.Gst.Object'>, <class 'gi.repository.GObject.InitiallyUnowned'>,
<class 'gi.overrides.GObject.Object'>, <class 'gi.repository.GObject.Object'>,
<class 'gi._gi.GObject'>, <class 'gi.repository.Gst.ChildProxy'>, <class
'gobject.GInterface'>, <class 'object'>)
Gst.version_string()
'GStreamer 1.12.4'

python-gi is 3.26.1-2

python-gst-1.0 is not installed
--
You are receiving this mail because:
You are the QA Contact for the bug.
You are the assignee for the bug.
"GStreamer" (GNOME Bugzilla)
2018-01-15 08:39:06 UTC
Permalink
https://bugzilla.gnome.org/show_bug.cgi?id=789055

--- Comment #5 from Andreu N <***@gmail.com> ---
Neither on my labtop or remote machine, python-gst is installed.

Curiously, you are getting same bug on version 1.12 than me on version 1.10.
The problem is in class <class 'gi.overrides.Gst.Bin'>. Looking at code it
looks python-gi is overriding Bin base class (I don't know why it is needed).
https://cgit.freedesktop.org/gstreamer/gst-python/tree/gi/overrides/Gst.py#n65

I guess there was a problem with function `override` from python-gi. But it was
solved in with a refactor
(https://gitlab.gnome.org/GNOME/pygobject/commit/149c31beced944c72fba6ca6e096c81c1100ea2b).

So, in brief, gst-python (gi) was using function override from pygobject but it
wasn't worked properly. Now it works but gst-python implementation prevents to
set construct-only properties in custom Bin classes.

From my point of view, it should be solved on gst-python doing something like:

```
File: gi/overrides/Gst.py
Line: 56

class Bin(Gst.Bin):
def __init__(self, name=None, **kwargs):
Gst.Bin.__init__(self, name=name, **kwargs)

def add(self, *args):
for arg in args:
if not Gst.Bin.add(self, arg):
raise AddError(arg)
```
--
You are receiving this mail because:
You are the QA Contact for the bug.
You are the assignee for the bug.
"GStreamer" (GNOME Bugzilla)
2018-01-15 08:44:50 UTC
Permalink
https://bugzilla.gnome.org/show_bug.cgi?id=789055
import gi
gi.version_info
(3, 26, 1)
import gi
gi.version_info
(3, 18, 2)
--
You are receiving this mail because:
You are the QA Contact for the bug.
You are the assignee for the bug.
"GStreamer" (GNOME Bugzilla)
2018-11-03 15:37:13 UTC
Permalink
https://bugzilla.gnome.org/show_bug.cgi?id=789055

GStreamer system administrator <***@gstreamer.net> changed:

What |Removed |Added
----------------------------------------------------------------------------
Status|NEEDINFO |RESOLVED
Resolution|--- |OBSOLETE

--- Comment #7 from GStreamer system administrator <***@gstreamer.net> ---
-- GitLab Migration Automatic Message --

This bug has been migrated to freedesktop.org's GitLab instance and has been
closed from further activity.

You can subscribe and participate further through the new bug through this link
to our GitLab instance:
https://gitlab.freedesktop.org/gstreamer/gst-python/issues/9.
--
You are receiving this mail because:
You are the QA Contact for the bug.
You are the assignee for the bug.
Loading...