aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--discord/player.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/discord/player.py b/discord/player.py
index 17056e9c..6b0416df 100644
--- a/discord/player.py
+++ b/discord/player.py
@@ -84,6 +84,9 @@ class AudioSource:
"""
pass
+ def __del__(self):
+ self.cleanup()
+
class PCMAudio(AudioSource):
"""Represents raw 16-bit 48KHz stereo PCM audio source.
@@ -169,6 +172,8 @@ class FFmpegPCMAudio(AudioSource):
def cleanup(self):
proc = self._process
+ if proc is None:
+ return
log.info('Preparing to terminate ffmpeg process %s.', proc.pid)
proc.kill()
@@ -179,6 +184,8 @@ class FFmpegPCMAudio(AudioSource):
else:
log.info('ffmpeg process %s successfully terminated with return code of %s.', proc.pid, proc.returncode)
+ self._process = None
+
class PCMVolumeTransformer(AudioSource):
"""Transforms a previous :class:`AudioSource` to have volume controls.