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}
diff --git a/logging/rtc_event_log/encoder/var_int.h b/logging/rtc_event_log/encoder/var_int.h
index dbe1f11..4624e04 100644
--- a/logging/rtc_event_log/encoder/var_int.h
+++ b/logging/rtc_event_log/encoder/var_int.h
@@ -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::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