Call cleanup on AudioSource.__del__.
This commit is contained in:
parent
a7f846b37f
commit
5d75c44651
@ -84,6 +84,9 @@ class AudioSource:
|
|||||||
"""
|
"""
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
def __del__(self):
|
||||||
|
self.cleanup()
|
||||||
|
|
||||||
class PCMAudio(AudioSource):
|
class PCMAudio(AudioSource):
|
||||||
"""Represents raw 16-bit 48KHz stereo PCM audio source.
|
"""Represents raw 16-bit 48KHz stereo PCM audio source.
|
||||||
|
|
||||||
@ -169,6 +172,8 @@ class FFmpegPCMAudio(AudioSource):
|
|||||||
|
|
||||||
def cleanup(self):
|
def cleanup(self):
|
||||||
proc = self._process
|
proc = self._process
|
||||||
|
if proc is None:
|
||||||
|
return
|
||||||
|
|
||||||
log.info('Preparing to terminate ffmpeg process %s.', proc.pid)
|
log.info('Preparing to terminate ffmpeg process %s.', proc.pid)
|
||||||
proc.kill()
|
proc.kill()
|
||||||
@ -179,6 +184,8 @@ class FFmpegPCMAudio(AudioSource):
|
|||||||
else:
|
else:
|
||||||
log.info('ffmpeg process %s successfully terminated with return code of %s.', proc.pid, proc.returncode)
|
log.info('ffmpeg process %s successfully terminated with return code of %s.', proc.pid, proc.returncode)
|
||||||
|
|
||||||
|
self._process = None
|
||||||
|
|
||||||
class PCMVolumeTransformer(AudioSource):
|
class PCMVolumeTransformer(AudioSource):
|
||||||
"""Transforms a previous :class:`AudioSource` to have volume controls.
|
"""Transforms a previous :class:`AudioSource` to have volume controls.
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user