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

Unified Diff: webrtc/modules/video_coding/h264_sps_pps_tracker_unittest.cc

Issue 2945853002: Only append SPS/PPS to bitstream if supplied out of bound. (Closed)
Patch Set: delete[] sps/pps data in unittests Created 3 years, 6 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/modules/video_coding/h264_sps_pps_tracker_unittest.cc
diff --git a/webrtc/modules/video_coding/h264_sps_pps_tracker_unittest.cc b/webrtc/modules/video_coding/h264_sps_pps_tracker_unittest.cc
index 37ab4eed10e40acae85aebfa90e4813f935c94b0..0aa1351440ac2907a949402a76e6ff23882683cb 100644
--- a/webrtc/modules/video_coding/h264_sps_pps_tracker_unittest.cc
+++ b/webrtc/modules/video_coding/h264_sps_pps_tracker_unittest.cc
@@ -35,13 +35,11 @@ class TestH264SpsPpsTracker : public ::testing::Test {
return packet;
}
- void AddSps(VCMPacket* packet, int sps_id, std::vector<uint8_t>* data) {
+ void AddSps(VCMPacket* packet, uint8_t sps_id, std::vector<uint8_t>* data) {
NaluInfo info;
info.type = H264::NaluType::kSps;
info.sps_id = sps_id;
info.pps_id = -1;
- info.offset = data->size();
- info.size = 2;
data->push_back(H264::NaluType::kSps);
data->push_back(sps_id); // The sps data, just a single byte.
@@ -50,15 +48,13 @@ class TestH264SpsPpsTracker : public ::testing::Test {
}
void AddPps(VCMPacket* packet,
- int sps_id,
- int pps_id,
+ uint8_t sps_id,
+ uint8_t pps_id,
std::vector<uint8_t>* data) {
NaluInfo info;
info.type = H264::NaluType::kPps;
info.sps_id = sps_id;
info.pps_id = pps_id;
- info.offset = data->size();
- info.size = 2;
data->push_back(H264::NaluType::kPps);
data->push_back(pps_id); // The pps data, just a single byte.
@@ -200,6 +196,7 @@ TEST_F(TestH264SpsPpsTracker, SpsPpsPacketThenIdrFirstPacket) {
sps_pps_packet.sizeBytes = data.size();
EXPECT_EQ(H264SpsPpsTracker::kInsert,
tracker_.CopyAndFixBitstream(&sps_pps_packet));
+ delete[] sps_pps_packet.dataPtr;
data.clear();
// Insert first packet of the IDR
@@ -214,10 +211,6 @@ TEST_F(TestH264SpsPpsTracker, SpsPpsPacketThenIdrFirstPacket) {
std::vector<uint8_t> expected;
expected.insert(expected.end(), start_code, start_code + sizeof(start_code));
- expected.insert(expected.end(), {H264::NaluType::kSps, 0});
- expected.insert(expected.end(), start_code, start_code + sizeof(start_code));
- expected.insert(expected.end(), {H264::NaluType::kPps, 1});
- expected.insert(expected.end(), start_code, start_code + sizeof(start_code));
expected.insert(expected.end(), {1, 2, 3});
EXPECT_EQ(memcmp(idr_packet.dataPtr, expected.data(), expected.size()), 0);
delete[] idr_packet.dataPtr;
@@ -243,13 +236,6 @@ TEST_F(TestH264SpsPpsTracker, SpsPpsIdrInStapA) {
EXPECT_EQ(H264SpsPpsTracker::kInsert, tracker_.CopyAndFixBitstream(&packet));
std::vector<uint8_t> expected;
- // The SPS/PPS is repeated because this packet both contains the SPS/PPS
- // and it is the first packet of an IDR, which will cause the SPS/PPS to be
- // prepended to the bitstream.
- expected.insert(expected.end(), start_code, start_code + sizeof(start_code));
- expected.insert(expected.end(), {H264::NaluType::kSps, 13});
- expected.insert(expected.end(), start_code, start_code + sizeof(start_code));
- expected.insert(expected.end(), {H264::NaluType::kPps, 27});
expected.insert(expected.end(), start_code, start_code + sizeof(start_code));
expected.insert(expected.end(), {H264::NaluType::kSps, 13});
expected.insert(expected.end(), start_code, start_code + sizeof(start_code));
@@ -344,6 +330,7 @@ TEST_F(TestH264SpsPpsTracker, SaveRestoreWidthHeight) {
sps_pps_packet.height = 240;
EXPECT_EQ(H264SpsPpsTracker::kInsert,
tracker_.CopyAndFixBitstream(&sps_pps_packet));
+ delete[] sps_pps_packet.dataPtr;
VCMPacket idr_packet = GetDefaultPacket();
idr_packet.video_header.is_first_packet_in_frame = true;
« no previous file with comments | « webrtc/modules/video_coding/h264_sps_pps_tracker.cc ('k') | webrtc/video/rtp_video_stream_receiver_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698