[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 <pkasting@chromium.org> Reviewed-by: Harald Alvestrand <hta@webrtc.org> Commit-Queue: Harald Alvestrand <hta@webrtc.org> Cr-Commit-Position: refs/heads/main@{#42838}
diff --git a/api/video/encoded_image.h b/api/video/encoded_image.h index f3a0eca..f52adc5 100644 --- a/api/video/encoded_image.h +++ b/api/video/encoded_image.h
@@ -43,6 +43,9 @@ // 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 @@ 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_; }