From: Kostya Shishkov Date: Tue, 30 Mar 2021 10:19:24 +0000 (+0200) Subject: sndplayer: free audio device after playback is over X-Git-Url: https://git.nihav.org/?a=commitdiff_plain;h=656062131be9a7cd314bbc6c165edad850afead2;p=nihav-player.git sndplayer: free audio device after playback is over --- 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,