Mark buffer as cancelled when producer fails
authorMarcel van der Veldt <m.vanderveldt@outlook.com>
Sun, 2 Nov 2025 17:01:26 +0000 (18:01 +0100)
committerMarcel van der Veldt <m.vanderveldt@outlook.com>
Sun, 2 Nov 2025 17:01:26 +0000 (18:01 +0100)
music_assistant/helpers/audio_buffer.py

index f236713172da265be56c9c60759ff4c12d773740..994c4540224f64db00daad9dc684a87725148c92 100644 (file)
@@ -319,6 +319,9 @@ class AudioBuffer:
             exc = t.exception()
             if exc is not None and isinstance(exc, Exception):
                 self._producer_error = exc
+                # Mark buffer as cancelled when producer fails
+                # This prevents reuse of a buffer in error state
+                self._cancelled = True
                 # Wake up any waiting consumers so they can see the error
                 loop = asyncio.get_running_loop()
                 loop.call_soon_threadsafe(self._data_available.notify_all)