Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stop audioplayer properly #1032

Merged
merged 4 commits into from
Jun 13, 2024
Merged

Conversation

MarcoCoreDuo
Copy link
Contributor

@MarcoCoreDuo MarcoCoreDuo commented May 17, 2024

While I migrated muse to play-dl I noticed that the FFmpeg processes that are created when seeking in a video or playing multiple livestreams or non-caching videos will still run and download from YouTube in the background. Now, when a non-caching stream is removed from the player, the corresponding FFmpeg process will also be stopped. Cached streams are still downloaded else the cached audio file will be incomplete.

Edit: Audio player is now stopped properly

  • I updated the changelog

Copy link

github-actions bot commented May 17, 2024

📦 A new release has been made for this pull request.

To play around with this PR, pull codetheweb/muse:pr-1032 or codetheweb/muse:b17e5d87527e5a7e224098ed1404c090b9d08b6d.

Images are available for x86_64 and ARM64.

Latest commit: b17e5d8

@MarcoCoreDuo
Copy link
Contributor Author

I have found that FFmpeg causes a memory leak because the processes that pipe the stream don't get killed by stream.kill() unless a video is finished by the player. So they just eat up memory. I can't seem to find a fix.

@MarcoCoreDuo MarcoCoreDuo changed the title Stop unnecessary FFmpeg processes Stop audioplayer properly May 25, 2024
@MarcoCoreDuo
Copy link
Contributor Author

I've found the issue. When the audioplayer is paused and then stopped, it will not destory the audio resource unless it plays the remaining silence padding frames (but it can't because it is paused). I replaced stop() with stop(true) when the player is paused. stop(true) will ignore the silence padding frames and destroy the resource and also stop ffmpeg.

Copy link
Owner

@codetheweb codetheweb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks!

@codetheweb codetheweb merged commit 29b61cc into codetheweb:master Jun 13, 2024
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants