diff options
author | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2022-07-20 14:47:33 +0300 |
---|---|---|
committer | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2022-07-28 14:14:00 +0300 |
commit | f6d6181d3c91efa526b5027319331db9ac75f65b (patch) | |
tree | 080170ea014d5ceb58428f8e573ca6db0d6d599c /src/cam/sdl_texture_mjpg.h | |
parent | dc1f4a91dfefa9f86202ab148e05fb901b6e3e73 (diff) |
cam: sdl_sink: Pass a Span<const uint8_t> to SDLTexture::update()
The SDLTexture::update() function isn't meant to modify the data it
receives. Make the Span type const to ensure this at compile time. While
at it, pass the Span by value instead of reference, as a Span is only a
pointer and size, which will fit in registers and will avoid pointer
dereferences in the callee.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Diffstat (limited to 'src/cam/sdl_texture_mjpg.h')
-rw-r--r-- | src/cam/sdl_texture_mjpg.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/cam/sdl_texture_mjpg.h b/src/cam/sdl_texture_mjpg.h index 328c45a9..5141ed73 100644 --- a/src/cam/sdl_texture_mjpg.h +++ b/src/cam/sdl_texture_mjpg.h @@ -14,10 +14,10 @@ class SDLTextureMJPG : public SDLTexture public: SDLTextureMJPG(const SDL_Rect &rect); - void update(const libcamera::Span<uint8_t> &data) override; + void update(libcamera::Span<const uint8_t> data) override; private: - int decompress(const libcamera::Span<uint8_t> &data); + int decompress(libcamera::Span<const uint8_t> data); std::unique_ptr<unsigned char[]> rgb_; }; |