mirror of
https://github.com/Rapptz/discord.py.git
synced 2025-04-19 15:36:02 +00:00
Call cleanup on AudioSource.__del__.
This commit is contained in:
parent
a7f846b37f
commit
5d75c44651
@ -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.
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user