summaryrefslogtreecommitdiff
path: root/src/audio/include/audio_element.hpp
diff options
context:
space:
mode:
authorjacqueline <me@jacqueline.id.au>2022-12-03 11:10:06 +1100
committerjacqueline <me@jacqueline.id.au>2022-12-03 11:10:06 +1100
commit16d5d29049c08e21f57f7928ceedf40586a2d294 (patch)
treea4647f951f90b036c58c879ae186fa7e452ed950 /src/audio/include/audio_element.hpp
parent00d4883d3a683eaf9cfaefacdd81434e0974ad13 (diff)
downloadtangara-fw-16d5d29049c08e21f57f7928ceedf40586a2d294.tar.gz
Use std::span (backported) and std::byte to make our buffers safer
Diffstat (limited to 'src/audio/include/audio_element.hpp')
-rw-r--r--src/audio/include/audio_element.hpp7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/audio/include/audio_element.hpp b/src/audio/include/audio_element.hpp
index 5b697784..06e47b35 100644
--- a/src/audio/include/audio_element.hpp
+++ b/src/audio/include/audio_element.hpp
@@ -1,7 +1,5 @@
#pragma once
-#include <stdint.h>
-
#include <cstdint>
#include "freertos/FreeRTOS.h"
@@ -9,6 +7,7 @@
#include "freertos/message_buffer.h"
#include "freertos/portmacro.h"
#include "result.hpp"
+#include "span.hpp"
#include "stream_info.hpp"
#include "types.hpp"
@@ -77,8 +76,8 @@ class IAudioElement {
* bytes in this chunk that were actually used; leftover bytes will be
* prepended to the next call.
*/
- virtual auto ProcessChunk(uint8_t* data, std::size_t length)
- -> cpp::result<size_t, AudioProcessingError> = 0;
+ virtual auto ProcessChunk(cpp::span<std::byte>& chunk)
+ -> cpp::result<std::size_t, AudioProcessingError> = 0;
/*
* Called when there has been no data received over the input buffer for some