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

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

Issue 2356793002: Add support for 3-byte headers in VideoToolbox NALU parser. (Closed)
Patch Set: rebase Created 4 years, 2 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 | « no previous file | webrtc/modules/video_coding/codecs/h264/h264_video_toolbox_nalu.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..fe55b02d2cc246bba59da20931d7ff73a1b38626 100644
--- a/webrtc/common_video/h264/h264_common.cc
+++ b/webrtc/common_video/h264/h264_common.cc
@@ -21,8 +21,9 @@ 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)
+ return sequences;
const size_t end = buffer_size - kNaluShortStartSequenceSize;
for (size_t i = 0; i < end;) {
if (buffer[i + 2] > 1) {
« no previous file with comments | « no previous file | webrtc/modules/video_coding/codecs/h264/h264_video_toolbox_nalu.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698