mirror of
https://github.com/esphome/esphome.git
synced 2026-09-12 07:47:33 +00:00
RAMAllocator is stateless when using default flags — it's just a dispatch wrapper over heap_caps_malloc/realloc/free. There's no need to store it as a class member. Use stack-local instances at each call site instead, matching the pattern used in audio_transfer_buffer and ring_buffer. Co-Authored-By: J. Nick Koston <nick@koston.org>
25 lines
638 B
C++
25 lines
638 B
C++
#pragma once
|
|
|
|
#include "esphome/components/camera/encoder.h"
|
|
#include "esphome/core/helpers.h"
|
|
|
|
namespace esphome::camera_encoder {
|
|
|
|
class EncoderBufferImpl : public camera::EncoderBuffer {
|
|
public:
|
|
// --- EncoderBuffer ---
|
|
bool set_buffer_size(size_t size) override;
|
|
uint8_t *get_data() const override { return this->data_; }
|
|
size_t get_size() const override { return this->size_; }
|
|
size_t get_max_size() const override { return this->capacity_; }
|
|
// ----------------------
|
|
~EncoderBufferImpl() override;
|
|
|
|
protected:
|
|
size_t capacity_{};
|
|
size_t size_{};
|
|
uint8_t *data_{};
|
|
};
|
|
|
|
} // namespace esphome::camera_encoder
|