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

Unified Diff: webrtc/base/bitbuffer.cc

Issue 1979443004: Add H264 bitstream rewriting to limit frame reordering marker in header (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Addressed comments Created 4 years, 7 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
« no previous file with comments | « webrtc/base/bitbuffer.h ('k') | webrtc/base/buffer.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/base/bitbuffer.cc
diff --git a/webrtc/base/bitbuffer.cc b/webrtc/base/bitbuffer.cc
index 1aa245e78c7932309c8f8aa313a0177847cdd8c8..48a1d0ccdbcc8b3ed04099f095f029f8c3065b08 100644
--- a/webrtc/base/bitbuffer.cc
+++ b/webrtc/base/bitbuffer.cc
@@ -293,4 +293,18 @@ bool BitBufferWriter::WriteExponentialGolomb(uint32_t val) {
return WriteBits(val_to_encode, CountBits(val_to_encode) * 2 - 1);
}
+bool BitBufferWriter::WriteSignedExponentialGolomb(int32_t val) {
+ if (val == 0) {
+ return WriteExponentialGolomb(0);
+ } else if (val > 0) {
+ uint32_t signed_val = val;
+ return WriteExponentialGolomb((signed_val * 2) - 1);
+ } else {
+ if (val == std::numeric_limits<int32_t>::min())
+ return false; // Not supported, would cause overflow.
+ uint32_t signed_val = -val;
+ return WriteExponentialGolomb(signed_val * 2);
+ }
+}
+
} // namespace rtc
« no previous file with comments | « webrtc/base/bitbuffer.h ('k') | webrtc/base/buffer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698