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

Unified Diff: webrtc/common_video/h264/h264_common.cc

Issue 2356793002: Add support for 3-byte headers in VideoToolbox NALU parser. (Closed)
Patch Set: Created 4 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/common_video/h264/h264_common.cc
diff --git a/webrtc/common_video/h264/h264_common.cc b/webrtc/common_video/h264/h264_common.cc
index c17b118ce0b354e16d2cfab42151a0127f119cf4..1919301d50bb3cabedefee29dcab40347886aca2 100644
--- a/webrtc/common_video/h264/h264_common.cc
+++ b/webrtc/common_video/h264/h264_common.cc
@@ -21,8 +21,10 @@ std::vector<NaluIndex> FindNaluIndices(const uint8_t* buffer,
// given a 3-byte sequence we're looking at, if the 3rd byte isn't 1 or 0,
// skip ahead to the next 3-byte sequence. 0s and 1s are relatively rare, so
// this will skip the majority of reads/checks.
- RTC_CHECK_GE(buffer_size, kNaluShortStartSequenceSize);
std::vector<NaluIndex> sequences;
+ if (buffer_size < kNaluShortStartSequenceSize) {
tommi 2016/09/20 16:34:40 nit: no {} (see the convention below for 2-line co
+ return sequences;
+ }
const size_t end = buffer_size - kNaluShortStartSequenceSize;
for (size_t i = 0; i < end;) {
if (buffer[i + 2] > 1) {

Powered by Google App Engine
This is Rietveld 408576698