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

Unified Diff: media/filters/h264_parser.cc

Issue 1534273002: Switch to standard integer types in media/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: more Created 5 years 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: media/filters/h264_parser.cc
diff --git a/media/filters/h264_parser.cc b/media/filters/h264_parser.cc
index 299f38843a6d285d16248d02ce138e815cedd805..e10b935aa4cd17503e26d114f6b93214d9a01904 100644
--- a/media/filters/h264_parser.cc
+++ b/media/filters/h264_parser.cc
@@ -133,13 +133,14 @@ void H264Parser::Reset() {
encrypted_ranges_.clear();
}
-void H264Parser::SetStream(const uint8* stream, off_t stream_size) {
+void H264Parser::SetStream(const uint8_t* stream, off_t stream_size) {
std::vector<SubsampleEntry> subsamples;
SetEncryptedStream(stream, stream_size, subsamples);
}
void H264Parser::SetEncryptedStream(
- const uint8* stream, off_t stream_size,
+ const uint8_t* stream,
+ off_t stream_size,
const std::vector<SubsampleEntry>& subsamples) {
DCHECK(stream);
DCHECK_GT(stream_size, 0);
@@ -148,12 +149,13 @@ void H264Parser::SetEncryptedStream(
bytes_left_ = stream_size;
encrypted_ranges_.clear();
- const uint8* start = stream;
- const uint8* stream_end = stream_ + bytes_left_;
+ const uint8_t* start = stream;
+ const uint8_t* stream_end = stream_ + bytes_left_;
for (size_t i = 0; i < subsamples.size() && start < stream_end; ++i) {
start += subsamples[i].clear_bytes;
- const uint8* end = std::min(start + subsamples[i].cypher_bytes, stream_end);
+ const uint8_t* end =
+ std::min(start + subsamples[i].cypher_bytes, stream_end);
encrypted_ranges_.Add(start, end);
start = end;
}
@@ -179,13 +181,15 @@ const H264SPS* H264Parser::GetSPS(int sps_id) const {
return it->second;
}
-static inline bool IsStartCode(const uint8* data) {
+static inline bool IsStartCode(const uint8_t* data) {
return data[0] == 0x00 && data[1] == 0x00 && data[2] == 0x01;
}
// static
-bool H264Parser::FindStartCode(const uint8* data, off_t data_size,
- off_t* offset, off_t* start_code_size) {
+bool H264Parser::FindStartCode(const uint8_t* data,
+ off_t data_size,
+ off_t* offset,
+ off_t* start_code_size) {
DCHECK_GE(data_size, 0);
off_t bytes_left = data_size;
@@ -235,7 +239,7 @@ bool H264Parser::LocateNALU(off_t* nalu_size, off_t* start_code_size) {
stream_ += nalu_start_off;
bytes_left_ -= nalu_start_off;
- const uint8* nalu_data = stream_ + annexb_start_code_size;
+ const uint8_t* nalu_data = stream_ + annexb_start_code_size;
off_t max_nalu_data_size = bytes_left_ - annexb_start_code_size;
if (max_nalu_data_size <= 0) {
DVLOG(3) << "End of stream";
@@ -262,16 +266,16 @@ bool H264Parser::LocateNALU(off_t* nalu_size, off_t* start_code_size) {
}
bool H264Parser::FindStartCodeInClearRanges(
- const uint8* data,
+ const uint8_t* data,
off_t data_size,
- const Ranges<const uint8*>& encrypted_ranges,
+ const Ranges<const uint8_t*>& encrypted_ranges,
off_t* offset,
off_t* start_code_size) {
if (encrypted_ranges.size() == 0)
return FindStartCode(data, data_size, offset, start_code_size);
DCHECK_GE(data_size, 0);
- const uint8* start = data;
+ const uint8_t* start = data;
do {
off_t bytes_left = data_size - (start - data);
@@ -280,9 +284,9 @@ bool H264Parser::FindStartCodeInClearRanges(
// Construct a Ranges object that represents the region occupied
// by the start code and the 1 byte needed to read the NAL unit type.
- const uint8* start_code = start + *offset;
- const uint8* start_code_end = start_code + *start_code_size;
- Ranges<const uint8*> start_code_range;
+ const uint8_t* start_code = start + *offset;
+ const uint8_t* start_code_end = start_code + *start_code_size;
+ Ranges<const uint8_t*> start_code_range;
start_code_range.Add(start_code, start_code_end + 1);
if (encrypted_ranges.IntersectionWith(start_code_range).size() > 0) {

Powered by Google App Engine
This is Rietveld 408576698