SDL: audio: Don't let simplified audio streams bind to new devices.

From 40fb76196c3f40c3dbfc36e00e30bf9e30ac3de0 Mon Sep 17 00:00:00 2001
From: "Ryan C. Gordon" <[EMAIL REDACTED]>
Date: Tue, 31 Oct 2023 10:52:50 -0400
Subject: [PATCH] audio: Don't let simplified audio streams bind to new
 devices.

This can happen if you close the stream's underlying device directly, which
removes the binding but doesn't destroy the object.

In this case, the stream remains valid until destroyed, but still should not
be able to be bound to a new device.
---
 src/audio/SDL_audio.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/audio/SDL_audio.c b/src/audio/SDL_audio.c
index 46e7449e3954..9c6afb39e7c5 100644
--- a/src/audio/SDL_audio.c
+++ b/src/audio/SDL_audio.c
@@ -1689,6 +1689,8 @@ int SDL_BindAudioStreams(SDL_AudioDeviceID devid, SDL_AudioStream **streams, int
             SDL_assert((stream->bound_device == NULL) == ((stream->prev_binding == NULL) || (stream->next_binding == NULL)));
             if (stream->bound_device) {
                 retval = SDL_SetError("Stream #%d is already bound to a device", i);
+            } else if (stream->simplified) {  // You can get here if you closed the device instead of destroying the stream.
+                retval = SDL_SetError("Cannot change binding on a stream created with SDL_OpenAudioDeviceStream");
             }
         }