serenity-rs / songbird

An async Rust library for the Discord voice API
ISC License
384 stars 110 forks source link

Driver: Prune `SsrcState` after timeout/disconnect #145

Closed FelixMcFelix closed 2 years ago

FelixMcFelix commented 2 years ago

SsrcState objects are created on a per-user basis when "receive" is enabled, but were previously never destroyed. This PR adds some shared dashmaps for the WS task to communicate SSRC-to-ID mappings to the UDP Rx task, as well as any disconnections. Additionally, decoder state is pruned a default 1 minute after a user last speaks.

This was tested using cargo make ready and via examples/serenity/voice_receive/.

Closes #133