Move SPS/PPS/IDR requirement from RtpFrameObject to PacketBuffer.
BUG=webrtc:8423 Change-Id: I0f0d59461afead700c20c9a2ed9b2bc991590b4a Reviewed-on: https://webrtc-review.googlesource.com/15101 Reviewed-by: Stefan Holmer <stefan@webrtc.org> Reviewed-by: Philip Eliasson <philipel@webrtc.org> Commit-Queue: Rasmus Brandt <brandtr@webrtc.org> Cr-Commit-Position: refs/heads/master@{#20559}
This commit is contained in:
committed by
Commit Bot
parent
cdfbcd4068
commit
88f080ae9a
@ -21,6 +21,31 @@ namespace video_coding {
|
||||
|
||||
namespace {
|
||||
const uint8_t start_code[] = {0, 0, 0, 1};
|
||||
|
||||
void ExpectSpsPpsIdr(const RTPVideoHeaderH264& codec_header,
|
||||
uint8_t sps_id,
|
||||
uint8_t pps_id) {
|
||||
bool contains_sps = false;
|
||||
bool contains_pps = false;
|
||||
bool contains_idr = false;
|
||||
for (const auto& nalu : codec_header.nalus) {
|
||||
if (nalu.type == H264::NaluType::kSps) {
|
||||
EXPECT_EQ(sps_id, nalu.sps_id);
|
||||
contains_sps = true;
|
||||
} else if (nalu.type == H264::NaluType::kPps) {
|
||||
EXPECT_EQ(sps_id, nalu.sps_id);
|
||||
EXPECT_EQ(pps_id, nalu.pps_id);
|
||||
contains_pps = true;
|
||||
} else if (nalu.type == H264::NaluType::kIdr) {
|
||||
EXPECT_EQ(pps_id, nalu.pps_id);
|
||||
contains_idr = true;
|
||||
}
|
||||
}
|
||||
EXPECT_TRUE(contains_sps);
|
||||
EXPECT_TRUE(contains_pps);
|
||||
EXPECT_TRUE(contains_idr);
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
class TestH264SpsPpsTracker : public ::testing::Test {
|
||||
@ -264,10 +289,14 @@ TEST_F(TestH264SpsPpsTracker, SpsPpsOutOfBand) {
|
||||
AddIdr(&idr_packet, 0);
|
||||
idr_packet.dataPtr = kData;
|
||||
idr_packet.sizeBytes = sizeof(kData);
|
||||
EXPECT_EQ(1u, idr_packet.video_header.codecHeader.H264.nalus_length);
|
||||
EXPECT_EQ(H264SpsPpsTracker::kInsert,
|
||||
tracker_.CopyAndFixBitstream(&idr_packet));
|
||||
EXPECT_EQ(3u, idr_packet.video_header.codecHeader.H264.nalus_length);
|
||||
EXPECT_EQ(320, idr_packet.width);
|
||||
EXPECT_EQ(240, idr_packet.height);
|
||||
ExpectSpsPpsIdr(idr_packet.video_header.codecHeader.H264, 0, 0);
|
||||
|
||||
if (idr_packet.dataPtr != kData) {
|
||||
// In case CopyAndFixBitStream() prepends SPS/PPS nalus to the packet, it
|
||||
// uses new uint8_t[] to allocate memory. Caller of CopyAndFixBitStream()
|
||||
|
||||
Reference in New Issue
Block a user