Skip to content

GitLab

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
pygobject
pygobject
  • Project overview
    • Project overview
    • Details
    • Activity
    • Releases
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 239
    • Issues 239
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
  • Merge Requests 10
    • Merge Requests 10
  • CI / CD
    • CI / CD
    • Pipelines
    • Jobs
    • Schedules
  • Operations
    • Operations
    • Incidents
    • Environments
  • Packages & Registries
    • Packages & Registries
    • Container Registry
  • Analytics
    • Analytics
    • CI / CD
    • Repository
    • Value Stream
  • Members
    • Members
  • Collapse sidebar
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
  • GNOME
  • pygobjectpygobject
  • Issues
  • #385

Closed
Open
Opened Feb 24, 2020 by Gordon Hart@gordonhart

GstVideo.VideoFrame buffer pointer is None

The buffer field in a GstVideo.VideoFrame object appears to unconditionally contain None rather than the expected Gst.Buffer. This is a duplicate of this issue on the gst-python repo where the devs seem confident that this is a gobject-introspection issue.

import gi
gi.require_version("Gst", "1.0")
gi.require_version("GstVideo", "1.0")
from gi.repository import Gst, GObject, GstVideo, GLib

Gst.init(None)

SRC = Gst.PadTemplate.new("src", Gst.PadDirection.SRC, Gst.PadPresence.ALWAYS, Gst.Caps.new_any())
SNK = Gst.PadTemplate.new("sink", Gst.PadDirection.SINK, Gst.PadPresence.ALWAYS, Gst.Caps.new_any())

class MissingBufferDemo(GstVideo.VideoFilter):
    __gstmetadata__ = ("longname", "class", "description", "author")
    __gsttemplates__ = (SRC, SNK)

    def do_transform_frame(
        self,
        inframe: GstVideo.VideoFrame,
        outframe: GstVideo.VideoFrame,
    ) -> Gst.FlowReturn:
        if inframe.buffer is None and outframe.buffer is None:
            Gst.error("both `GstVideo.VideoFrame` buffers missing")
            return Gst.FlowReturn.ERROR
        return Gst.FlowReturn.OK

GObject.type_register(MissingBufferDemo)
__gstelementfactory__ = ("missing_buffer_demo", Gst.Rank.NONE, MissingBufferDemo)

if __name__ == "__main__":
    pipeline = Gst.parse_launch("videotestsrc ! missing_buffer_demo ! fakesink")
    pipeline.set_state(Gst.State.PLAYING)
    loop = GLib.MainLoop()
    loop.run()

To run, locate this script in a python/ directory on the $GST_PLUGIN_PATH and run it with a python3 interpreter.

Results:

$ GST_DEBUG=2 python3 missing_buffer_demo.py 
0:00:00.402949758    26 0x558cc8a788a0 ERROR                 python missing_buffer_demo.py:21:do_transform_frame: both `GstVideo.VideoFrame` buffers missing
0:00:00.404208248    26 0x558cc8a788a0 WARN                 basesrc gstbasesrc.c:3055:gst_base_src_loop:<videotestsrc0> error: Internal data stream error.
0:00:00.405103279    26 0x558cc8a788a0 WARN                 basesrc gstbasesrc.c:3055:gst_base_src_loop:<videotestsrc0> error: streaming stopped, reason error (-5)

Environment:

$ python3 --version
Python 3.7.6

$ python3 -m pip --freeze
pycairo==1.19.1
PyGObject==3.34.0

$ gst-launch-1.0 --version
gst-launch-1.0 version 1.14.4
GStreamer 1.14.4
http://packages.qa.debian.org/gstreamer1.0

$ apt list --installed | grep gst
gir1.2-gst-plugins-bad-1.0/stable,now 1.14.4-1+b1 amd64 [installed]
gir1.2-gst-plugins-base-1.0/stable,now 1.14.4-2 amd64 [installed]
gir1.2-gstreamer-1.0/stable,now 1.14.4-1 amd64 [installed]
gstreamer1.0-gl/stable,now 1.14.4-2 amd64 [installed,automatic]
gstreamer1.0-libav/stable,now 1.15.0.1+git20180723+db823502-2 amd64 [installed]
gstreamer1.0-plugins-bad/stable,now 1.14.4-1+b1 amd64 [installed]
gstreamer1.0-plugins-base/stable,now 1.14.4-2 amd64 [installed]
gstreamer1.0-plugins-good/stable,now 1.14.4-1 amd64 [installed]
gstreamer1.0-plugins-ugly/stable,now 1.14.4-1 amd64 [installed]
gstreamer1.0-tools/stable,now 1.14.4-1 amd64 [installed]
gstreamer1.0-x/stable,now 1.14.4-2 amd64 [installed,automatic]
libgstreamer-gl1.0-0/stable,now 1.14.4-2 amd64 [installed,automatic]
libgstreamer-plugins-bad1.0-0/stable,now 1.14.4-1+b1 amd64 [installed,automatic]
libgstreamer-plugins-base1.0-0/stable,now 1.14.4-2 amd64 [installed,automatic]
libgstreamer1.0-0/stable,now 1.14.4-1 amd64 [installed,automatic]
libgstreamer1.0-dev/stable,now 1.14.4-1 amd64 [installed]

With a self-compiled libgstpython.so checked out on gst-python 1.14.4.

Assignee
Assign to
None
Milestone
None
Assign milestone
Time tracking
None
Due date
None
Reference: GNOME/pygobject#385