Hi, I am using this simple python script to play audio files: specifically 85: get_player() 135: play() 172: stop() Any ideas on why I get 2 additional STREAM file descriptors every time I play a new track eventually resulting in "Too many open files" error and segfault? ex. 44u unix 0x000000008179a133 0t0 100262669 type=STREAM -- Patrick Shirkey _______________________________________________ gstreamer-devel mailing list [hidden email] https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel |
Admittedly, I haven't looked at your code too closely, but I've had this happen to me when I forgot to disconnect handlers from the bus when creating multiple GStreamer pipelines. On Fri, Jan 22, 2021 at 8:02 AM Patrick Shirkey <[hidden email]> wrote:
_______________________________________________ gstreamer-devel mailing list [hidden email] https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel |
In reply to this post by Patrick Shirkey
Hey, are you aware of the existence of gst-player?
https://gstreamer.freedesktop.org/documentation/player/gstplayer.html?gi-language=c Cheers, --
Mathieu Duponchelle · https://www.centricular.com On 1/22/21 5:01 PM, Patrick Shirkey
wrote:
_______________________________________________ gstreamer-devel mailing list [hidden email] https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel |
In reply to this post by Tyler Compton
Thanks. The bus is created once on init. The audio file is loaded like this: self.player.get_by_name('urisrc').set_property('uri', file://' + filename) self.player.set_state(Gst.State.PLAYING) self.player.get_state(Gst.CLOCK_TIME_NONE) self.player.get_by_name('removesilence').set_property( 'remove', self.removesilence) self.player.get_by_name('volume').set_property('volume', self.volume) pos = self.player.query_position(Gst.Format.TIME)[1] self.player.seek(self.speed, Gst.Format.TIME, Gst.SeekFlags.FLUSH, Gst.SeekType.SET, pos, Gst.SeekType.NONE, -1) self.status = Status.PLAYING self.emit('started', self.get_position()) -------- Original Message -------- On Jan 22, 2021, 6:56 PM, Tyler Compton < [hidden email]> wrote:
_______________________________________________ gstreamer-devel mailing list [hidden email] https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel |
In reply to this post by Mathieu Duponchelle
Yes, I am using python for this project and this script meets all of my requirements except for the file descriptor leak. Is there a specific step required before/after loading a new audio file with: self.player.get_by_name('urisrc').set_property('uri', 'file://' + filename) -------- Original Message -------- On Jan 22, 2021, 7:04 PM, Mathieu Duponchelle < [hidden email]> wrote:
_______________________________________________ gstreamer-devel mailing list [hidden email] https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel |
GstPlayer can be used from python, and probably fits your use case
:)
meh master ~ devel gst-build ipython3 Python 3.8.6 (default, Sep 25 2020, 00:00:00) Type 'copyright', 'credits' or 'license' for more information IPython 7.12.0 -- An enhanced Interactive Python. Type '?' for help. In [1]: from gi.repository import Gst <ipython-input-1-4132414128eb>:1: PyGIWarning: Gst was imported without specifying a version first. Use gi.require_version('Gst', '1.0') before import to ensure that the right version gets loaded. from gi.repository import Gst In [2]: Gst.init(None) Out[2]: [] In [3]: from gi.repository import GstPlayer <ipython-input-3-b10918504373>:1: PyGIWarning: GstPlayer was imported without specifying a version first. Use gi.require_version('GstPlayer', '1.0') before import to ensure that the right version gets loaded. from gi.repository import GstPlayer In [4]: p = GstPlayer.Player() In [5]: p.set_uri('file:///home/meh/Music/chaplin.wav') In [6]: p.play() In [7]: p.set_uri('file:///home/meh/Music/biggie.wav') In [8]: p.play() On 1/22/21 7:27 PM, Patrick Shirkey
wrote:
_______________________________________________ gstreamer-devel mailing list [hidden email] https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel |
Thanks Mattieu. That was the hint I needed. Seems that the lplayer method with Gst instead of GstPlayer is leaking the stream file descriptor. In case anyone has the inclination to look into it further, I noticed it increments by three at play() and decrements by two at stop(). ‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐ On Friday, January 22, 2021 10:10 PM, Mathieu Duponchelle <[hidden email]> wrote:
_______________________________________________ gstreamer-devel mailing list [hidden email] https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel |
For reference I found that adding the following to the lplayer.py stopped the file descriptor leaks. def set_filename(self, filename, jack_name): if self.player is not None: self.player.set_state(Gst.State.NULL) bus = self.player.get_bus() bus.remove_signal_watch() self.player = self.get_player(jack_name) self.player.get_by_name('urisrc').set_property('uri', 'file://' + filename) ‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐ On Saturday, January 23, 2021 11:10 AM, Patrick Shirkey <[hidden email]> wrote:
_______________________________________________ gstreamer-devel mailing list [hidden email] https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel |
Good :) I strongly advise using GstPlayer anyways, it gets a lot of
tricky things
right. On 1/24/21 11:03 AM, Patrick Shirkey
wrote:
_______________________________________________ gstreamer-devel mailing list [hidden email] https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel |
Free forum by Nabble | Edit this page |