From 3cdeff30607fed1f5438ce5dd8ecff7d75c63dd5 Mon Sep 17 00:00:00 2001 From: XANTRONIX Development Date: Wed, 23 Feb 2022 20:19:34 -0500 Subject: Ensure xas_bank_record() uses same audio format --- src/bank.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/bank.c b/src/bank.c index 19e3514..2f6151b 100644 --- a/src/bank.c +++ b/src/bank.c @@ -46,6 +46,12 @@ ssize_t xas_bank_record(xas_bank *bank, size_t left = count, index_o = 0; + if (!xas_audio_format_eq(bank->format, input->format)) { + errno = EINVAL; + + goto error_invalid_format; + } + if (count > bank->entry_size) { count = bank->entry_size; } @@ -74,6 +80,7 @@ ssize_t xas_bank_record(xas_bank *bank, return entry->duration = index_o; error_audio_stream_read: +error_invalid_format: return -1; } -- cgit v1.2.3