From b92345615e95377f76e76f17b8cbff34bd9b808a Mon Sep 17 00:00:00 2001 From: Peter Kasting Date: Thu, 8 Aug 2024 11:49:19 -0700 Subject: [PATCH] [jumbo] Add begin()/end() to EncodedImage[BufferInterface]. This allows these types to meet the requirements of e.g. std::ranges::range, which is necessary for them to work with the std::span range constructor, or the "non-legacy" constructor for Chromium's base::span. Bug: none Change-Id: Ia51c17690c785e0714c36d237094877129e0cbaf Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/358844 Auto-Submit: Peter Kasting Reviewed-by: Harald Alvestrand Commit-Queue: Harald Alvestrand Cr-Commit-Position: refs/heads/main@{#42838} --- api/video/encoded_image.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/api/video/encoded_image.h b/api/video/encoded_image.h index f3a0ecac88..f52adc5272 100644 --- a/api/video/encoded_image.h +++ b/api/video/encoded_image.h @@ -43,6 +43,9 @@ class EncodedImageBufferInterface : public RefCountInterface { // this non-const data method. virtual uint8_t* data() = 0; virtual size_t size() const = 0; + + const uint8_t* begin() const { return data(); } + const uint8_t* end() const { return data() + size(); } }; // Basic implementation of EncodedImageBufferInterface. @@ -191,6 +194,9 @@ class RTC_EXPORT EncodedImage { return encoded_data_ ? encoded_data_->data() : nullptr; } + const uint8_t* begin() const { return data(); } + const uint8_t* end() const { return data() + size(); } + // Returns whether the encoded image can be considered to be of target // quality. bool IsAtTargetQuality() const { return at_target_quality_; }