Migrate rtc event log from rtc::BitBuffer to BitstreamReader

BitstreamReader allows to write easier to reader parser

Bug: None
Change-Id: I9da88c86ee04be4c0b06e181e409a915ba1a5123
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/231232
Commit-Queue: Danil Chapovalov <danilchap@webrtc.org>
Reviewed-by: Björn Terelius <terelius@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#34939}
This commit is contained in:
Danil Chapovalov
2021-09-07 15:19:16 +02:00
committed by WebRTC LUCI CQ
parent 74158ff761
commit 707e3d187c
4 changed files with 47 additions and 138 deletions

View File

@ -18,7 +18,7 @@
#include <utility>
#include "absl/strings/string_view.h"
#include "rtc_base/bit_buffer.h"
#include "rtc_base/bitstream_reader.h"
namespace webrtc {
@ -39,13 +39,11 @@ std::string EncodeVarInt(uint64_t input);
std::pair<bool, absl::string_view> DecodeVarInt(absl::string_view input,
uint64_t* output);
// Same as other version, but uses a rtc::BitBuffer for input.
// If decoding is successful, a non-zero number is returned, indicating the
// number of bytes read from `input`, and the decoded varint is written
// into `output`.
// If not successful, 0 is returned, and `output` is not modified.
// Some bits may be consumed even if a varint fails to be read.
size_t DecodeVarInt(rtc::BitBuffer* input, uint64_t* output);
// Same as other version, but uses a BitstreamReader for input.
// If decoding is successful returns the decoded varint.
// If not successful, `input` reader is set into the failure state, return value
// is unspecified.
uint64_t DecodeVarInt(BitstreamReader& input);
} // namespace webrtc