Skip to content

GitLab

  • Menu
Projects Groups Snippets
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • gst-plugins-base gst-plugins-base
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 645
    • Issues 645
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 88
    • Merge requests 88
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Monitor
    • Monitor
    • Incidents
  • Packages & Registries
    • Packages & Registries
    • Container Registry
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • GStreamer
  • gst-plugins-basegst-plugins-base
  • Issues
  • #834

Closed
Open
Created Oct 30, 2020 by Jan Alexander Steffens@heftigDeveloper

compositor accepts AYUV64 caps that it can't handle

When reconfiguring the pipeline, the composer can be made to accept AYUV64 caps that it cannot actually handle. When it then tries to aggregate it fails and sends a At least one of the input pads contains alpha, but configured caps don't support alpha error message.

The expectation is that it will reject the caps so upstream can renegotiate for something compatible.

This was fixed by !868 (merged) and then regressed again by !905 (merged).

Reproducer: test.py
#!/usr/bin/env python3

import gi
import time
import threading

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

# harness {{{1
class ClockTime:
    __slots__ = ["value"]

    def __init__(self, value):
        self.value = value

    def __str__(self):
        if self.value == Gst.CLOCK_TIME_NONE:
            return "-:--:--:---------"
        return "%u:%02u:%02u:%09u" % (
            self.value / Gst.SECOND / 60 / 60,
            self.value / Gst.SECOND / 60,
            self.value / Gst.SECOND,
            self.value % Gst.SECOND,
        )


class MainLoop(threading.Thread):
    def __init__(self):
        super().__init__(name="mainloop", daemon=True)
        self.mainloop = GLib.MainLoop.new(None, True)
        self.start()

    def run(self):
        self.mainloop.run()

    def join(self, timeout=None):
        GLib.idle_add(self.mainloop.quit)
        return super().join(timeout)


def handle_message(bus, msg):
    if msg.type == Gst.MessageType.PROPERTY_NOTIFY:
        (obj, name, value) = msg.parse_property_notify()
        try:
            path = obj.get_path_string()
        except AttributeError:
            try:
                path = obj.get_name()
            except AttributeError:
                path = "(NULL)"
        try:
            value = value.to_string()
        except AttributeError:
            try:
                value = str(value)
            except ValueError:
                value = repr(value)
        print(f"{path}: {name} = {value}")
        return

    name = Gst.message_type_get_name(msg.type)
    time = ClockTime(msg.timestamp)
    try:
        element = msg.src.name
    except AttributeError:
        element = "(NONE)"
    try:
        structure = f", {msg.get_structure().to_string()}"
    except AttributeError:
        structure = ""
    print(
        f"{name} message, time {time}, seq-num {msg.seqnum}, element '{element}'{structure}"
    )

    if msg.type == Gst.MessageType.ERROR:
        (error, debug) = msg.parse_error()
        raise error


# }}}

Gst.init()

ml = MainLoop()
pl: Gst.Pipeline = Gst.parse_launch(
    """
        videotestsrc is-live=1
            ! video/x-raw,format=I420
            ! c.

        videotestsrc is-live=1
            ! tee name=t2
            ! queue
            ! fakesink

        compositor name=c
            ! videoconvert
            ! video/x-raw,format=I420
            ! fakesink
    """
)
pl.add_property_deep_notify_watch(None, True)

bus: Gst.Bus = pl.get_bus()
bus.add_signal_watch()
bus.connect("message", handle_message)

t2: Gst.Element = pl.get_by_name("t2")
c: Gst.Element = pl.get_by_name("c")

print("Starting")
pl.set_state(Gst.State.PLAYING)

time.sleep(1)
print("Link 2")
q2: Gst.Element = Gst.ElementFactory.make("queue")
pl.add(q2)
q2.sync_state_with_parent()
q2.link(c)
t2.link(q2)

time.sleep(1)
print("Shutting down")
pl.set_state(Gst.State.NULL)
ml.join()

# vim:set fen fdm=marker fdl=0:
Assignee
Assign to
Time tracking