From 656062131be9a7cd314bbc6c165edad850afead2 Mon Sep 17 00:00:00 2001 From: Kostya Shishkov Date: Tue, 30 Mar 2021 12:19:24 +0200 Subject: [PATCH] sndplayer: free audio device after playback is over --- sndplay/src/main.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/sndplay/src/main.rs b/sndplay/src/main.rs index 43f8fca..e1b8472 100644 --- a/sndplay/src/main.rs +++ b/sndplay/src/main.rs @@ -86,6 +86,12 @@ impl AudioDevice { } } +impl Drop for AudioDevice { + fn drop(&mut self) { + unsafe { sdl2_sys::SDL_CloseAudioDevice(self.device_id); } + } +} + struct Decoder<'a> { demuxer: Demuxer<'a>, decoder: Box, -- 2.39.5