pipeline with pipewiresrc doesn't resume when paused
I am not sure if this is a gstreamer of pipewire issue, but everytime I try to pause it, and resume it doesn't work.
It's weird though that it sometimes works when I remove the caps after pipewiresrc and directly connect it to videoconvert.
Here's a minimum code to reproduce it:
""" import gi gi.require_version('Gst', '1.0') gi.require_version('Gtk', '3.0') from gi.repository import Gst, Gtk
Gst.init(None)
class Window(Gtk.ApplicationWindow):
def __init__(self):
Gtk.ApplicationWindow.__init__(self)
box = Gtk.Box()
self.add(box)
start_b = Gtk.Button(label='Start')
box.pack_start(start_b, True, True, 0)
start_b.connect('clicked', self.start)
pause_b = Gtk.Button(label='Pause')
box.pack_start(pause_b, True, True, 0)
pause_b.connect('clicked', self.pause)
resume_b = Gtk.Button(label='Resume')
box.pack_start(resume_b, True, True, 0)
resume_b.connect('clicked', self.resume)
stop_b = Gtk.Button(label='Stop')
box.pack_start(stop_b, True, True, 0)
stop_b.connect('clicked', self.stop)
def _on_message(self, bus, message):
t = message.type
if t == Gst.MessageType.ERROR:
self.player.set_state(Gst.State.NULL)
err, debug = message.parse_error()
print("Error: %s" % err, debug)
def start(self, _):
self.pipeline = Gst.parse_launch('pipewiresrc path=37 ! video/x-raw,max-framerate=30/1 ! videoconvert ! xvimagesink sync=0')
self.record_bus = self.pipeline.get_bus()
self.handler_id = self.record_bus.connect('message', self._on_message)
self.pipeline.set_state(Gst.State.PLAYING)
def pause(self, _):
self.pipeline.set_state(Gst.State.PAUSED)
def resume(self, _):
self.pipeline.set_state(Gst.State.PLAYING)
def stop(self, _):
self.pipeline.set_state(Gst.State.NULL)
self.record_bus.remove_watch()
self.record_bus.disconnect(self.handler_id)
window = Window() window.connect("delete-event", Gtk.main_quit) window.show_all() Gtk.main() """