Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(313)

Unified Diff: webrtc/base/bitbuffer.cc

Issue 1314473008: H264 bitstream parser. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: remove DCHECK_GT Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: webrtc/base/bitbuffer.cc
diff --git a/webrtc/base/bitbuffer.cc b/webrtc/base/bitbuffer.cc
index cd3661343b290ae25aed1e34a04a7390643c5ead..bbd1047f901df16974e3d0322713f814a8cda0dc 100644
--- a/webrtc/base/bitbuffer.cc
+++ b/webrtc/base/bitbuffer.cc
@@ -187,6 +187,17 @@ bool BitBuffer::ReadExponentialGolomb(uint32_t* val) {
return true;
}
+bool BitBuffer::ReadSignedExponentialGolomb(int32_t* val) {
+ // TODO(pbos): Is there a corner case I'm missing here?
+ uint32_t unsigned_val;
+ if (!ReadExponentialGolomb(&unsigned_val))
noahric 2015/09/03 17:48:58 Brackets to match the rest of the file :-p
pbos-webrtc 2015/09/04 10:01:20 Done.
+ return false;
+ if ((unsigned_val & 1) == 0)
noahric 2015/09/03 17:48:58 This if just falls through and overwrites val, so
pbos-webrtc 2015/09/04 10:01:20 Done, which also uncovered additional bugs. That a
+ *val = (unsigned_val + 1) / 2;
+ *val = -(unsigned_val / 2);
+ return true;
+}
+
void BitBuffer::GetCurrentOffset(
size_t* out_byte_offset, size_t* out_bit_offset) {
CHECK(out_byte_offset != NULL);

Powered by Google App Engine
This is Rietveld 408576698