<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
Good :) I strongly advise using GstPlayer anyways, it gets a lot of
tricky things<br>
right.<br>
<br>
<div class="moz-cite-prefix">On 1/24/21 11:03 AM, Patrick Shirkey
wrote:<br>
</div>
<blockquote type="cite"
cite="mid:WfJpEdhqXGv4EH2ZYDnIBARht_Ror8UxtOLoTe6Ek44J4Eo5S0M2fPVcvONQbdGA-DgGCwVNavRmuD8US0qVYCjCfKoSU3uBiXn5eN4ehrs=@protonmail.com">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<div><br>
</div>
<div>For reference I found that adding the following to the
lplayer.py stopped the file descriptor leaks.<br>
</div>
<div><br>
</div>
<div> def set_filename(self, filename, jack_name):<br>
</div>
<div> if self.player is not None:<br>
</div>
<div> self.player.set_state(Gst.State.NULL)<br>
</div>
<div><br>
</div>
<div> bus = self.player.get_bus()<br>
</div>
<div> bus.remove_signal_watch()<br>
</div>
<div> self.player = self.get_player(jack_name)<br>
</div>
<div> self.player.get_by_name('urisrc').set_property('uri',
'<a class="moz-txt-link-freetext" href="file://">file://</a>' + filename)<br>
</div>
<div><br>
</div>
<div><br>
</div>
<div>‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐<br>
</div>
<div> On Saturday, January 23, 2021 11:10 AM, Patrick Shirkey
<a class="moz-txt-link-rfc2396E" href="mailto:patrickshirkey@protonmail.com"><patrickshirkey@protonmail.com></a> wrote:<br>
</div>
<div> <br>
</div>
<blockquote class="protonmail_quote" type="cite">
<div>Thanks Mattieu. <br>
</div>
<div><br>
</div>
<div>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(). <br>
</div>
<div><br>
</div>
<div><a
href="https://github.com/atareao/lplayer/blob/master/src/lplayer/player.py"
moz-do-not-send="true">https://github.com/atareao/lplayer/blob/master/src/lplayer/player.py</a><br>
</div>
<div><br>
</div>
<div><br>
</div>
<div><br>
</div>
<div>‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐<br>
</div>
<div>On Friday, January 22, 2021 10:10 PM, Mathieu Duponchelle
<a class="moz-txt-link-rfc2396E" href="mailto:mathieu@centricular.com"><mathieu@centricular.com></a> wrote:<br>
</div>
<div><br>
</div>
<blockquote class="protonmail_quote" type="cite">
<div>GstPlayer can be used from python, and probably fits your
use case :)<br>
</div>
<div><br>
</div>
<pre> meh master ~ devel gst-build ipython3
</pre>
<pre>Python 3.8.6 (default, Sep 25 2020, 00:00:00)
</pre>
<pre>Type 'copyright', 'credits' or 'license' for more information
</pre>
<pre>IPython 7.12.0 -- An enhanced Interactive Python. Type '?' for help.
</pre>
<pre>In [1]: from gi.repository import Gst
</pre>
<pre><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.
</pre>
<pre> from gi.repository import Gst
</pre>
<pre>In [2]: Gst.init(None)
</pre>
<pre>Out[2]: []
</pre>
<pre>In [3]: from gi.repository import GstPlayer
</pre>
<pre><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.
</pre>
<pre> from gi.repository import GstPlayer
</pre>
<pre>In [4]: p = GstPlayer.Player()
</pre>
<pre>In [5]: p.set_uri('<a moz-do-not-send="true">file:///home/meh/Music/chaplin.wav</a>')
</pre>
<pre>In [6]: p.play()
</pre>
<pre>In [7]: p.set_uri('<a moz-do-not-send="true">file:///home/meh/Music/biggie.wav</a>')
</pre>
<pre>In [8]: p.play()
</pre>
<pre>
</pre>
<div class="moz-cite-prefix">On 1/22/21 7:27 PM, Patrick
Shirkey wrote:<br>
</div>
<blockquote type="cite">
<div><br>
</div>
<div>Yes, I am using python for this project and this script
meets all of my requirements except for the file
descriptor leak.<br>
</div>
<div><br>
</div>
<div>Is there a specific step required before/after loading
a new audio file with:<br>
</div>
<div>self.player.get_by_name('urisrc').set_property('uri', '<a
moz-do-not-send="true">file://</a>' + filename)<br>
</div>
<div><br>
</div>
<div><br>
</div>
<div><br>
</div>
<div><br>
</div>
<div>-------- Original Message --------<br>
</div>
<div>On Jan 22, 2021, 7:04 PM, Mathieu Duponchelle < <a
href="mailto:mathieu@centricular.com"
moz-do-not-send="true">mathieu@centricular.com</a>>
wrote: <br>
</div>
<blockquote class="protonmail_quote">
<div><br>
</div>
<div>Hey, are you aware of the existence of gst-player?<br>
</div>
<div><br>
</div>
<div><a
href="https://gstreamer.freedesktop.org/documentation/player/gstplayer.html?gi-language=c"
moz-do-not-send="true">https://gstreamer.freedesktop.org/documentation/player/gstplayer.html?gi-language=c</a><br>
</div>
<div><br>
</div>
<div>Cheers,<br>
</div>
<div><br>
</div>
<div><br>
</div>
<div>
<div>-- <br>
</div>
<div>Mathieu Duponchelle · <a
href="https://www.centricular.com"
moz-do-not-send="true">https://www.centricular.com</a><br>
</div>
</div>
<div><br>
</div>
<div class="moz-cite-prefix">On 1/22/21 5:01 PM, Patrick
Shirkey wrote:<br>
</div>
<blockquote type="cite">
<div>Hi,<br>
</div>
<div><br>
</div>
<div>I am using this simple python script to play audio
files:<br>
</div>
<div><br>
</div>
<div><a
href="https://github.com/atareao/lplayer/blob/master/src/lplayer/player.py"
moz-do-not-send="true">https://github.com/atareao/lplayer/blob/master/src/lplayer/player.py</a><br>
</div>
<div><br>
</div>
<div>specifically <br>
</div>
<div><br>
</div>
<div>85: get_player()<br>
</div>
<div>135: play()<br>
</div>
<div>172: stop()<br>
</div>
<div><br>
</div>
<div><br>
</div>
<div>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?<br>
</div>
<div><br>
</div>
<div>ex. 44u unix 0x000000008179a133 0t0
100262669 type=STREAM<br>
</div>
<div><br>
</div>
<div><br>
</div>
<div>--<br>
</div>
<div>Patrick Shirkey<br>
</div>
<div><br>
</div>
<div><br>
</div>
<div><br>
</div>
<pre wrap="">_______________________________________________
gstreamer-devel mailing list
<a href="mailto:gstreamer-devel@lists.freedesktop.org" moz-do-not-send="true">gstreamer-devel@lists.freedesktop.org</a>
<a href="https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel" moz-do-not-send="true">https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel</a>
</pre>
</blockquote>
</blockquote>
<div><br>
</div>
<pre wrap="">_______________________________________________
gstreamer-devel mailing list
<a href="mailto:gstreamer-devel@lists.freedesktop.org" moz-do-not-send="true">gstreamer-devel@lists.freedesktop.org</a>
<a href="https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel" moz-do-not-send="true">https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel</a>
</pre>
</blockquote>
</blockquote>
<div><br>
</div>
</blockquote>
<div><br>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<pre class="moz-quote-pre" wrap="">_______________________________________________
gstreamer-devel mailing list
<a class="moz-txt-link-abbreviated" href="mailto:gstreamer-devel@lists.freedesktop.org">gstreamer-devel@lists.freedesktop.org</a>
<a class="moz-txt-link-freetext" href="https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel">https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel</a>
</pre>
</blockquote>
</body>
</html>