Closed adamf closed 2 weeks ago
I wonder if my code is skipping to the next file before https://github.com/cheofusi/just_playback/blob/main/just_playback/ma_playback.c#L128 gets handled by a naturally ended audio stream. That said, what happens in https://github.com/cheofusi/just_playback/blob/main/just_playback/ma_playback.c#L128 when the playback object calls load_file
again before the audio has finished playing? Does this callback keep getting triggered?
calling load_file() / play() / sleep(1)
in a loop reproduces this leak.
Hi @adamf,
Sorry for the late response. I've been away for while.
I'm unable to reproduce this issue. On running the following script and noting the PID,
from just_playback import Playback
from time import sleep
p = Playback()
while True:
p.load_file("test.mp3")
p.play()
sleep(1)
watch -n 1 'sudo ls /proc/$pid/fd/ | wc -l'
stays constant.
Every time you call load_file()
, terminate_audio_stream()
at https://github.com/cheofusi/just_playback/blob/main/just_playback/ma_playback.c#L112 is called and that cleans up any existing file handles, including stopping the audio device.
Thanks for looking into this! I'll see if I can get a better reproducer and re-open if I can. Thanks!
HI! After running https://github.com/adamf/piplayer/blob/main/piplayer.py for a while, the file descriptor counts keeps increasing, gradually exceeding ulimit and crashing the program.
All the open file descriptors are
memfd:pulseaudio
owned by the python process usingjust_playback
:I don't think this is a pulseaudio issue, and it could be my issue (I wrote the referenced code very quickly), but I wonder if this is the intersection of how I'm using
just_playback
with threads and howjust_playback
andminiaudio
are interacting. Would love some thoughts.