Bug 1876843 - Vendor libwebrtc from ece5cb8371

Upstream commit: https://webrtc.googlesource.com/src/+/ece5cb83715dea85617114b6d4e981fdee2623ba
    Add char-based accessor functions to ByteBufferWriter

    These are added to ease the transition to uint8_t for downstream code.

    Bug: webrtc:15665
    Change-Id: I571805b93ddd19be6f6990ce34f5c248a57f36b3
    Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/329763
    Reviewed-by: Tomas Gunnarsson <tommi@webrtc.org>
    Commit-Queue: Harald Alvestrand <hta@webrtc.org>
    Cr-Commit-Position: refs/heads/main@{#41315}
This commit is contained in:
Jan-Ivar Bruaroey 2024-02-10 18:01:35 -05:00
parent 03f2cde449
commit d87c07ea4d
3 changed files with 17 additions and 1 deletions

View file

@ -27669,3 +27669,6 @@ c176175f01
# MOZ_LIBWEBRTC_SRC=/Users/jan-ivar/moz/elm/.moz-fast-forward/moz-libwebrtc MOZ_LIBWEBRTC_BRANCH=mozpatches bash dom/media/webrtc/third_party_build/fast-forward-libwebrtc.sh
# base of lastest vendoring
c93f4f98a5
# MOZ_LIBWEBRTC_SRC=/Users/jan-ivar/moz/elm/.moz-fast-forward/moz-libwebrtc MOZ_LIBWEBRTC_BRANCH=mozpatches bash dom/media/webrtc/third_party_build/fast-forward-libwebrtc.sh
# base of lastest vendoring
ece5cb8371

View file

@ -18470,3 +18470,5 @@ libwebrtc updated from /Users/jan-ivar/moz/elm/.moz-fast-forward/moz-libwebrtc c
libwebrtc updated from /Users/jan-ivar/moz/elm/.moz-fast-forward/moz-libwebrtc commit mozpatches on 2024-02-10T22:58:51.252021.
# ./mach python dom/media/webrtc/third_party_build/vendor-libwebrtc.py --from-local /Users/jan-ivar/moz/elm/.moz-fast-forward/moz-libwebrtc --commit mozpatches libwebrtc
libwebrtc updated from /Users/jan-ivar/moz/elm/.moz-fast-forward/moz-libwebrtc commit mozpatches on 2024-02-10T22:59:52.445909.
# ./mach python dom/media/webrtc/third_party_build/vendor-libwebrtc.py --from-local /Users/jan-ivar/moz/elm/.moz-fast-forward/moz-libwebrtc --commit mozpatches libwebrtc
libwebrtc updated from /Users/jan-ivar/moz/elm/.moz-fast-forward/moz-libwebrtc commit mozpatches on 2024-02-10T23:01:26.358981.

View file

@ -41,6 +41,17 @@ class ByteBufferWriterT {
const value_type* Data() const { return buffer_.data(); }
size_t Length() const { return buffer_.size(); }
size_t Capacity() const { return buffer_.capacity(); }
rtc::ArrayView<const value_type> DataView() const {
return rtc::MakeArrayView(Data(), Length());
}
// Accessor that returns a string_view, independent of underlying type.
// Intended to provide access for existing users that expect char*
// when the underlying type changes to uint8_t.
// TODO(bugs.webrtc.org/15665): Delete when users are converted.
absl::string_view DataAsStringView() const {
return absl::string_view(reinterpret_cast<const char*>(Data()), Length());
}
char* DataAsCharPointer() const { return reinterpret_cast<char*>(Data()); }
// Write value to the buffer. Resizes the buffer when it is
// neccessary.
@ -152,7 +163,7 @@ class ByteBufferReader {
// Returns number of unprocessed bytes.
size_t Length() const { return end_ - start_; }
// Returns a view of the unprocessed data.
rtc::ArrayView<const uint8_t> DataView() {
rtc::ArrayView<const uint8_t> DataView() const {
return rtc::ArrayView<const uint8_t>(bytes_ + start_, end_ - start_);
}