HomeWildfire Games

Fix audio leak that resulted in openAL errors after a while.

Description

Fix audio leak that resulted in openAL errors after a while.

Sound items were only deleted after 'last play' when stopped, but they could also be left in 'paused' or 'initial' states, and were then not cleared until the game exits (effectively a memory leak). This affected particularly music & ambient sounds, which also used the most buffers(/memory).
On MacOS (at least), this resulted in OpenAL errors & sound failures after a while playing the game, because MacOS has a max "in flight buffers" of 1024.

Also clean up some control flow in CStreamItem

Reported by: Eszett

Thanks langbart for the consistent repro'.

Fixes #5265

Differential Revision: https://code.wildfiregames.com/D3445