From 2cc0a38a1ac7fc54d7333dafa8b99479a7f5dc86 Mon Sep 17 00:00:00 2001 From: jacqueline Date: Fri, 27 Jan 2023 13:28:22 +1100 Subject: pipeline memory management fixes + logging --- src/audio/include/stream_event.hpp | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) (limited to 'src/audio/include/stream_event.hpp') diff --git a/src/audio/include/stream_event.hpp b/src/audio/include/stream_event.hpp index 4dfdab41..4f441fa5 100644 --- a/src/audio/include/stream_event.hpp +++ b/src/audio/include/stream_event.hpp @@ -11,13 +11,11 @@ namespace audio { struct StreamEvent { - static auto CreateStreamInfo(QueueHandle_t source, - std::unique_ptr payload) - -> std::unique_ptr; + static auto CreateStreamInfo(QueueHandle_t source, const StreamInfo& payload) + -> StreamEvent*; static auto CreateChunkData(QueueHandle_t source, std::size_t chunk_size) - -> std::unique_ptr; - static auto CreateChunkNotification(QueueHandle_t source) - -> std::unique_ptr; + -> StreamEvent*; + static auto CreateChunkNotification(QueueHandle_t source) -> StreamEvent*; StreamEvent(); ~StreamEvent(); @@ -33,16 +31,10 @@ struct StreamEvent { } tag; union { - std::unique_ptr stream_info; - - // Scott Meyers says: - // `About the only situation I can conceive of when a std::unique_ptr - // would make sense would be when you’re using a C-like API that returns a - // raw pointer to a heap array that you assume ownership of.` - // :-) + StreamInfo* stream_info; struct { - std::unique_ptr raw_bytes; + std::byte* raw_bytes; cpp::span bytes; } chunk_data; -- cgit v1.2.3