summaryrefslogtreecommitdiff
path: root/src/audio/include/audio_decoder.hpp
diff options
context:
space:
mode:
authorjacqueline <me@jacqueline.id.au>2022-12-07 15:36:47 +1100
committerjacqueline <me@jacqueline.id.au>2022-12-07 15:36:47 +1100
commit01be69eca1fa89c047fc29f5cb0ea8ba0898dad1 (patch)
treed40f749b3ebf6327f13d51d585f7c315a6d864c3 /src/audio/include/audio_decoder.hpp
parentf35bb64c2b8dbb72fd15f1880e4d01d263660910 (diff)
downloadtangara-fw-01be69eca1fa89c047fc29f5cb0ea8ba0898dad1.tar.gz
better handling of chunk buffer
Diffstat (limited to 'src/audio/include/audio_decoder.hpp')
-rw-r--r--src/audio/include/audio_decoder.hpp13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/audio/include/audio_decoder.hpp b/src/audio/include/audio_decoder.hpp
index a6b15d9e..eaef2f8c 100644
--- a/src/audio/include/audio_decoder.hpp
+++ b/src/audio/include/audio_decoder.hpp
@@ -21,11 +21,15 @@ class AudioDecoder : public IAudioElement {
AudioDecoder();
~AudioDecoder();
- auto SetInputBuffer(MessageBufferHandle_t*) -> void;
- auto SetOutputBuffer(MessageBufferHandle_t*) -> void;
-
auto StackSizeBytes() const -> std::size_t override { return 8196; };
+ auto InputMinChunkSize() const -> std::size_t override {
+ // 128 kbps MPEG-1 @ 44.1 kHz is approx. 418 bytes according to the
+ // internet.
+ // TODO(jacqueline): tune as more codecs are added.
+ return 1024;
+ }
+
auto ProcessStreamInfo(const StreamInfo& info)
-> cpp::result<void, AudioProcessingError> override;
auto ProcessChunk(const cpp::span<std::byte>& chunk)
@@ -38,9 +42,6 @@ class AudioDecoder : public IAudioElement {
private:
std::unique_ptr<codecs::ICodec> current_codec_;
std::optional<StreamInfo> stream_info_;
-
- std::byte* raw_chunk_buffer_;
- cpp::span<std::byte> chunk_buffer_;
};
} // namespace audio