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

Unified Diff: webrtc/modules/rtp_rtcp/source/h264_bitstream_parser.cc

Issue 1821083002: Split ByteBuffer into writer/reader objects. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 4 years, 9 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/media/base/videoengine_unittest.h ('k') | webrtc/modules/rtp_rtcp/source/h264_sps_parser.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/modules/rtp_rtcp/source/h264_bitstream_parser.cc
diff --git a/webrtc/modules/rtp_rtcp/source/h264_bitstream_parser.cc b/webrtc/modules/rtp_rtcp/source/h264_bitstream_parser.cc
index b78b96dc8677ded2560ddcfdcb7d68ad0a9da043..6d8b4074598a1f803d68bf97c365b86e036a474b 100644
--- a/webrtc/modules/rtp_rtcp/source/h264_bitstream_parser.cc
+++ b/webrtc/modules/rtp_rtcp/source/h264_bitstream_parser.cc
@@ -68,9 +68,9 @@ std::vector<size_t> FindNaluStartSequences(const uint8_t* buffer,
// TODO(pbos): Make parsing RBSP something that can be integrated into BitBuffer
// so we don't have to copy the entire frames when only interested in the
// headers.
-rtc::ByteBuffer* ParseRbsp(const uint8_t* bytes, size_t length) {
+rtc::ByteBufferWriter* ParseRbsp(const uint8_t* bytes, size_t length) {
// Copied from webrtc::H264SpsParser::Parse.
- rtc::ByteBuffer* rbsp_buffer = new rtc::ByteBuffer;
+ rtc::ByteBufferWriter* rbsp_buffer = new rtc::ByteBufferWriter();
for (size_t i = 0; i < length;) {
if (length - i >= 3 && bytes[i] == 0 && bytes[i + 1] == 0 &&
bytes[i + 2] == 3) {
@@ -103,7 +103,7 @@ bool H264BitstreamParser::ParseSpsNalu(const uint8_t* sps, size_t length) {
sps_parsed_ = false;
// Parse out the SPS RBSP. It should be small, so it's ok that we create a
// copy. We'll eventually write this back.
- rtc::scoped_ptr<rtc::ByteBuffer> sps_rbsp(
+ rtc::scoped_ptr<rtc::ByteBufferWriter> sps_rbsp(
ParseRbsp(sps + kNaluHeaderAndTypeSize, length - kNaluHeaderAndTypeSize));
rtc::BitBuffer sps_parser(reinterpret_cast<const uint8_t*>(sps_rbsp->Data()),
sps_rbsp->Length());
@@ -209,7 +209,7 @@ bool H264BitstreamParser::ParsePpsNalu(const uint8_t* pps, size_t length) {
// We're starting a new stream, so reset picture type rewriting values.
pps_ = PpsState();
pps_parsed_ = false;
- rtc::scoped_ptr<rtc::ByteBuffer> buffer(
+ rtc::scoped_ptr<rtc::ByteBufferWriter> buffer(
ParseRbsp(pps + kNaluHeaderAndTypeSize, length - kNaluHeaderAndTypeSize));
rtc::BitBuffer parser(reinterpret_cast<const uint8_t*>(buffer->Data()),
buffer->Length());
@@ -317,7 +317,7 @@ bool H264BitstreamParser::ParseNonParameterSetNalu(const uint8_t* source,
RTC_CHECK(sps_parsed_);
RTC_CHECK(pps_parsed_);
last_slice_qp_delta_parsed_ = false;
- rtc::scoped_ptr<rtc::ByteBuffer> slice_rbsp(ParseRbsp(
+ rtc::scoped_ptr<rtc::ByteBufferWriter> slice_rbsp(ParseRbsp(
source + kNaluHeaderAndTypeSize, source_length - kNaluHeaderAndTypeSize));
rtc::BitBuffer slice_reader(
reinterpret_cast<const uint8_t*>(slice_rbsp->Data()),
« no previous file with comments | « webrtc/media/base/videoengine_unittest.h ('k') | webrtc/modules/rtp_rtcp/source/h264_sps_parser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698