]> git.unchartedbackwaters.co.uk Git - francis/winuae.git/commitdiff
sndboard: disable recording if capture setup fails
authorStefan Reinauer <stefan.reinauer@coreboot.org>
Sun, 31 May 2026 07:19:10 +0000 (00:19 -0700)
committerStefan Reinauer <stefan.reinauer@coreboot.org>
Sun, 31 May 2026 07:19:25 +0000 (00:19 -0700)
codec_start() allocated the record buffer even when host capture setup
failed. Treat that as recording unavailable, clear the record bit, free
the buffer, and leave playback running.

sndboard.cpp

index 68ba37066f72ddcabdf18b02492705495aefc003..573d604e3b357187244ade0d3f793920d8caf3b5 100644 (file)
@@ -1679,7 +1679,12 @@ static void codec_start(struct snddev_data *data)
        if (data->snddev_active & STATUS_FIFO_RECORD) {
                data->capture_buffer_size = 48000 * 2 * 2; // 1s at 48000/stereo/16bit
                data->capture_buffer = xcalloc(uae_u8, data->capture_buffer_size);
-               sndboard_init_capture(data->freq_adjusted);
+               if (!sndboard_init_capture(data->freq_adjusted)) {
+                       write_log(_T("SNDDEV capture unavailable, recording disabled\n"));
+                       data->snddev_active &= ~STATUS_FIFO_RECORD;
+                       xfree(data->capture_buffer);
+                       data->capture_buffer = NULL;
+               }
        }
 }