[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}
This commit is contained in:
Peter Kasting 2024-08-08 11:49:19 -07:00 committed by WebRTC LUCI CQ
parent 7e37e5fd5a
commit b92345615e

View File

@ -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_; }