Delete redundant members from VCMPacket.
The values are available as part of the RTPVideoHeader member. Bug: None Change-Id: I832fffc449929badec3796d7096c9cdc0d43d344 Reviewed-on: https://webrtc-review.googlesource.com/c/123234 Reviewed-by: Åsa Persson <asapersson@webrtc.org> Reviewed-by: Philip Eliasson <philipel@webrtc.org> Commit-Queue: Niels Moller <nisse@webrtc.org> Cr-Commit-Position: refs/heads/master@{#26773}
This commit is contained in:
@ -35,7 +35,7 @@ TEST(TestDecodingState, FrameContinuity) {
|
|||||||
VCMFrameBuffer frame;
|
VCMFrameBuffer frame;
|
||||||
VCMFrameBuffer frame_key;
|
VCMFrameBuffer frame_key;
|
||||||
VCMPacket packet;
|
VCMPacket packet;
|
||||||
packet.is_first_packet_in_frame = true;
|
packet.video_header.is_first_packet_in_frame = true;
|
||||||
packet.timestamp = 1;
|
packet.timestamp = 1;
|
||||||
packet.seqNum = 0xffff;
|
packet.seqNum = 0xffff;
|
||||||
packet.frameType = kVideoFrameDelta;
|
packet.frameType = kVideoFrameDelta;
|
||||||
@ -57,7 +57,7 @@ TEST(TestDecodingState, FrameContinuity) {
|
|||||||
frame.Reset();
|
frame.Reset();
|
||||||
packet.frameType = kVideoFrameDelta;
|
packet.frameType = kVideoFrameDelta;
|
||||||
// Use pictureId
|
// Use pictureId
|
||||||
packet.is_first_packet_in_frame = false;
|
packet.video_header.is_first_packet_in_frame = false;
|
||||||
vp8_header.pictureId = 0x0002;
|
vp8_header.pictureId = 0x0002;
|
||||||
EXPECT_LE(0, frame.InsertPacket(packet, 0, frame_data));
|
EXPECT_LE(0, frame.InsertPacket(packet, 0, frame_data));
|
||||||
EXPECT_FALSE(dec_state.ContinuousFrame(&frame));
|
EXPECT_FALSE(dec_state.ContinuousFrame(&frame));
|
||||||
@ -267,7 +267,7 @@ TEST(TestDecodingState, MultiLayerBehavior) {
|
|||||||
// A key frame is always a base layer.
|
// A key frame is always a base layer.
|
||||||
frame.Reset();
|
frame.Reset();
|
||||||
packet.frameType = kVideoFrameKey;
|
packet.frameType = kVideoFrameKey;
|
||||||
packet.is_first_packet_in_frame = 1;
|
packet.video_header.is_first_packet_in_frame = true;
|
||||||
packet.timestamp = 5;
|
packet.timestamp = 5;
|
||||||
packet.seqNum = 5;
|
packet.seqNum = 5;
|
||||||
vp8_header.tl0PicIdx = 2;
|
vp8_header.tl0PicIdx = 2;
|
||||||
@ -291,7 +291,7 @@ TEST(TestDecodingState, MultiLayerBehavior) {
|
|||||||
EXPECT_TRUE(dec_state.full_sync());
|
EXPECT_TRUE(dec_state.full_sync());
|
||||||
frame.Reset();
|
frame.Reset();
|
||||||
packet.frameType = kVideoFrameDelta;
|
packet.frameType = kVideoFrameDelta;
|
||||||
packet.is_first_packet_in_frame = 1;
|
packet.video_header.is_first_packet_in_frame = true;
|
||||||
packet.timestamp = 8;
|
packet.timestamp = 8;
|
||||||
packet.seqNum = 8;
|
packet.seqNum = 8;
|
||||||
vp8_header.tl0PicIdx = 4;
|
vp8_header.tl0PicIdx = 4;
|
||||||
@ -306,7 +306,7 @@ TEST(TestDecodingState, MultiLayerBehavior) {
|
|||||||
// Insert a non-ref frame - should update sync value.
|
// Insert a non-ref frame - should update sync value.
|
||||||
frame.Reset();
|
frame.Reset();
|
||||||
packet.frameType = kVideoFrameDelta;
|
packet.frameType = kVideoFrameDelta;
|
||||||
packet.is_first_packet_in_frame = 1;
|
packet.video_header.is_first_packet_in_frame = true;
|
||||||
packet.timestamp = 9;
|
packet.timestamp = 9;
|
||||||
packet.seqNum = 9;
|
packet.seqNum = 9;
|
||||||
vp8_header.tl0PicIdx = 4;
|
vp8_header.tl0PicIdx = 4;
|
||||||
@ -326,7 +326,7 @@ TEST(TestDecodingState, MultiLayerBehavior) {
|
|||||||
frame.Reset();
|
frame.Reset();
|
||||||
dec_state.Reset();
|
dec_state.Reset();
|
||||||
packet.frameType = kVideoFrameDelta;
|
packet.frameType = kVideoFrameDelta;
|
||||||
packet.is_first_packet_in_frame = 1;
|
packet.video_header.is_first_packet_in_frame = true;
|
||||||
packet.markerBit = 1;
|
packet.markerBit = 1;
|
||||||
packet.timestamp = 0;
|
packet.timestamp = 0;
|
||||||
packet.seqNum = 0;
|
packet.seqNum = 0;
|
||||||
@ -340,7 +340,7 @@ TEST(TestDecodingState, MultiLayerBehavior) {
|
|||||||
// Layer 2 - 2 packets (insert one, lose one).
|
// Layer 2 - 2 packets (insert one, lose one).
|
||||||
frame.Reset();
|
frame.Reset();
|
||||||
packet.frameType = kVideoFrameDelta;
|
packet.frameType = kVideoFrameDelta;
|
||||||
packet.is_first_packet_in_frame = 1;
|
packet.video_header.is_first_packet_in_frame = true;
|
||||||
packet.markerBit = 0;
|
packet.markerBit = 0;
|
||||||
packet.timestamp = 1;
|
packet.timestamp = 1;
|
||||||
packet.seqNum = 1;
|
packet.seqNum = 1;
|
||||||
@ -353,7 +353,7 @@ TEST(TestDecodingState, MultiLayerBehavior) {
|
|||||||
// Layer 1
|
// Layer 1
|
||||||
frame.Reset();
|
frame.Reset();
|
||||||
packet.frameType = kVideoFrameDelta;
|
packet.frameType = kVideoFrameDelta;
|
||||||
packet.is_first_packet_in_frame = 1;
|
packet.video_header.is_first_packet_in_frame = true;
|
||||||
packet.markerBit = 1;
|
packet.markerBit = 1;
|
||||||
packet.timestamp = 2;
|
packet.timestamp = 2;
|
||||||
packet.seqNum = 3;
|
packet.seqNum = 3;
|
||||||
@ -461,7 +461,7 @@ TEST(TestDecodingState, FrameContinuityFlexibleModeKeyFrame) {
|
|||||||
VCMDecodingState dec_state;
|
VCMDecodingState dec_state;
|
||||||
VCMFrameBuffer frame;
|
VCMFrameBuffer frame;
|
||||||
VCMPacket packet;
|
VCMPacket packet;
|
||||||
packet.is_first_packet_in_frame = true;
|
packet.video_header.is_first_packet_in_frame = true;
|
||||||
packet.timestamp = 1;
|
packet.timestamp = 1;
|
||||||
packet.seqNum = 0xffff;
|
packet.seqNum = 0xffff;
|
||||||
uint8_t data[] = "I need a data pointer for this test!";
|
uint8_t data[] = "I need a data pointer for this test!";
|
||||||
@ -505,7 +505,7 @@ TEST(TestDecodingState, FrameContinuityFlexibleModeOutOfOrderFrames) {
|
|||||||
VCMDecodingState dec_state;
|
VCMDecodingState dec_state;
|
||||||
VCMFrameBuffer frame;
|
VCMFrameBuffer frame;
|
||||||
VCMPacket packet;
|
VCMPacket packet;
|
||||||
packet.is_first_packet_in_frame = true;
|
packet.video_header.is_first_packet_in_frame = true;
|
||||||
packet.timestamp = 1;
|
packet.timestamp = 1;
|
||||||
packet.seqNum = 0xffff;
|
packet.seqNum = 0xffff;
|
||||||
uint8_t data[] = "I need a data pointer for this test!";
|
uint8_t data[] = "I need a data pointer for this test!";
|
||||||
@ -561,7 +561,7 @@ TEST(TestDecodingState, FrameContinuityFlexibleModeGeneral) {
|
|||||||
VCMDecodingState dec_state;
|
VCMDecodingState dec_state;
|
||||||
VCMFrameBuffer frame;
|
VCMFrameBuffer frame;
|
||||||
VCMPacket packet;
|
VCMPacket packet;
|
||||||
packet.is_first_packet_in_frame = true;
|
packet.video_header.is_first_packet_in_frame = true;
|
||||||
packet.timestamp = 1;
|
packet.timestamp = 1;
|
||||||
packet.seqNum = 0xffff;
|
packet.seqNum = 0xffff;
|
||||||
uint8_t data[] = "I need a data pointer for this test!";
|
uint8_t data[] = "I need a data pointer for this test!";
|
||||||
|
|||||||
@ -93,7 +93,7 @@ VCMFrameBufferEnum VCMFrameBuffer::InsertPacket(
|
|||||||
SetTimestamp(packet.timestamp);
|
SetTimestamp(packet.timestamp);
|
||||||
// We only take the ntp timestamp of the first packet of a frame.
|
// We only take the ntp timestamp of the first packet of a frame.
|
||||||
ntp_time_ms_ = packet.ntp_time_ms_;
|
ntp_time_ms_ = packet.ntp_time_ms_;
|
||||||
_codec = packet.codec;
|
_codec = packet.codec();
|
||||||
if (packet.frameType != kEmptyFrame) {
|
if (packet.frameType != kEmptyFrame) {
|
||||||
// first media packet
|
// first media packet
|
||||||
SetState(kStateIncomplete);
|
SetState(kStateIncomplete);
|
||||||
@ -103,7 +103,7 @@ VCMFrameBufferEnum VCMFrameBuffer::InsertPacket(
|
|||||||
uint32_t requiredSizeBytes =
|
uint32_t requiredSizeBytes =
|
||||||
size() + packet.sizeBytes +
|
size() + packet.sizeBytes +
|
||||||
(packet.insertStartCode ? kH264StartCodeLengthBytes : 0) +
|
(packet.insertStartCode ? kH264StartCodeLengthBytes : 0) +
|
||||||
EncodedImage::GetBufferPaddingBytes(packet.codec);
|
EncodedImage::GetBufferPaddingBytes(packet.codec());
|
||||||
if (requiredSizeBytes >= capacity()) {
|
if (requiredSizeBytes >= capacity()) {
|
||||||
const uint8_t* prevBuffer = data();
|
const uint8_t* prevBuffer = data();
|
||||||
const uint32_t increments =
|
const uint32_t increments =
|
||||||
@ -119,9 +119,9 @@ VCMFrameBufferEnum VCMFrameBuffer::InsertPacket(
|
|||||||
_sessionInfo.UpdateDataPointers(prevBuffer, data());
|
_sessionInfo.UpdateDataPointers(prevBuffer, data());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (packet.width > 0 && packet.height > 0) {
|
if (packet.width() > 0 && packet.height() > 0) {
|
||||||
_encodedWidth = packet.width;
|
_encodedWidth = packet.width();
|
||||||
_encodedHeight = packet.height;
|
_encodedHeight = packet.height();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Don't copy payload specific data for empty packets (e.g padding packets).
|
// Don't copy payload specific data for empty packets (e.g padding packets).
|
||||||
@ -173,7 +173,7 @@ VCMFrameBufferEnum VCMFrameBuffer::InsertPacket(
|
|||||||
timing_.flags = packet.video_header.video_timing.flags;
|
timing_.flags = packet.video_header.video_timing.flags;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (packet.is_first_packet_in_frame) {
|
if (packet.is_first_packet_in_frame()) {
|
||||||
playout_delay_ = packet.video_header.playout_delay;
|
playout_delay_ = packet.video_header.playout_delay;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -39,7 +39,7 @@ RtpFrameObject::RtpFrameObject(PacketBuffer* packet_buffer,
|
|||||||
|
|
||||||
// EncodedFrame members
|
// EncodedFrame members
|
||||||
frame_type_ = first_packet->frameType;
|
frame_type_ = first_packet->frameType;
|
||||||
codec_type_ = first_packet->codec;
|
codec_type_ = first_packet->codec();
|
||||||
|
|
||||||
// TODO(philipel): Remove when encoded image is replaced by EncodedFrame.
|
// TODO(philipel): Remove when encoded image is replaced by EncodedFrame.
|
||||||
// VCMEncodedFrame members
|
// VCMEncodedFrame members
|
||||||
@ -57,15 +57,15 @@ RtpFrameObject::RtpFrameObject(PacketBuffer* packet_buffer,
|
|||||||
AllocateBitstreamBuffer(frame_size);
|
AllocateBitstreamBuffer(frame_size);
|
||||||
bool bitstream_copied = packet_buffer_->GetBitstream(*this, data());
|
bool bitstream_copied = packet_buffer_->GetBitstream(*this, data());
|
||||||
RTC_DCHECK(bitstream_copied);
|
RTC_DCHECK(bitstream_copied);
|
||||||
_encodedWidth = first_packet->width;
|
_encodedWidth = first_packet->width();
|
||||||
_encodedHeight = first_packet->height;
|
_encodedHeight = first_packet->height();
|
||||||
|
|
||||||
// EncodedFrame members
|
// EncodedFrame members
|
||||||
SetTimestamp(first_packet->timestamp);
|
SetTimestamp(first_packet->timestamp);
|
||||||
|
|
||||||
VCMPacket* last_packet = packet_buffer_->GetPacket(last_seq_num);
|
VCMPacket* last_packet = packet_buffer_->GetPacket(last_seq_num);
|
||||||
RTC_CHECK(last_packet);
|
RTC_CHECK(last_packet);
|
||||||
RTC_CHECK(last_packet->is_last_packet_in_frame);
|
RTC_CHECK(last_packet->is_last_packet_in_frame());
|
||||||
// http://www.etsi.org/deliver/etsi_ts/126100_126199/126114/12.07.00_60/
|
// http://www.etsi.org/deliver/etsi_ts/126100_126199/126114/12.07.00_60/
|
||||||
// ts_126114v120700p.pdf Section 7.4.5.
|
// ts_126114v120700p.pdf Section 7.4.5.
|
||||||
// The MTSI client shall add the payload bytes as defined in this clause
|
// The MTSI client shall add the payload bytes as defined in this clause
|
||||||
|
|||||||
@ -46,7 +46,7 @@ H264SpsPpsTracker::SpsInfo::~SpsInfo() = default;
|
|||||||
|
|
||||||
H264SpsPpsTracker::PacketAction H264SpsPpsTracker::CopyAndFixBitstream(
|
H264SpsPpsTracker::PacketAction H264SpsPpsTracker::CopyAndFixBitstream(
|
||||||
VCMPacket* packet) {
|
VCMPacket* packet) {
|
||||||
RTC_DCHECK(packet->codec == kVideoCodecH264);
|
RTC_DCHECK(packet->codec() == kVideoCodecH264);
|
||||||
|
|
||||||
const uint8_t* data = packet->dataPtr;
|
const uint8_t* data = packet->dataPtr;
|
||||||
const size_t data_size = packet->sizeBytes;
|
const size_t data_size = packet->sizeBytes;
|
||||||
@ -62,8 +62,8 @@ H264SpsPpsTracker::PacketAction H264SpsPpsTracker::CopyAndFixBitstream(
|
|||||||
const NaluInfo& nalu = h264_header.nalus[i];
|
const NaluInfo& nalu = h264_header.nalus[i];
|
||||||
switch (nalu.type) {
|
switch (nalu.type) {
|
||||||
case H264::NaluType::kSps: {
|
case H264::NaluType::kSps: {
|
||||||
sps_data_[nalu.sps_id].width = packet->width;
|
sps_data_[nalu.sps_id].width = packet->width();
|
||||||
sps_data_[nalu.sps_id].height = packet->height;
|
sps_data_[nalu.sps_id].height = packet->height();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case H264::NaluType::kPps: {
|
case H264::NaluType::kPps: {
|
||||||
@ -97,8 +97,8 @@ H264SpsPpsTracker::PacketAction H264SpsPpsTracker::CopyAndFixBitstream(
|
|||||||
// Since the first packet of every keyframe should have its width and
|
// Since the first packet of every keyframe should have its width and
|
||||||
// height set we set it here in the case of it being supplied out of
|
// height set we set it here in the case of it being supplied out of
|
||||||
// band.
|
// band.
|
||||||
packet->width = sps->second.width;
|
packet->video_header.width = sps->second.width;
|
||||||
packet->height = sps->second.height;
|
packet->video_header.height = sps->second.height;
|
||||||
|
|
||||||
// If the SPS/PPS was supplied out of band then we will have saved
|
// If the SPS/PPS was supplied out of band then we will have saved
|
||||||
// the actual bitstream in |data|.
|
// the actual bitstream in |data|.
|
||||||
|
|||||||
@ -54,7 +54,7 @@ void ExpectSpsPpsIdr(const RTPVideoHeaderH264& codec_header,
|
|||||||
class H264VcmPacket : public VCMPacket {
|
class H264VcmPacket : public VCMPacket {
|
||||||
public:
|
public:
|
||||||
H264VcmPacket() {
|
H264VcmPacket() {
|
||||||
codec = kVideoCodecH264;
|
video_header.codec = kVideoCodecH264;
|
||||||
video_header.is_first_packet_in_frame = false;
|
video_header.is_first_packet_in_frame = false;
|
||||||
auto& type_header =
|
auto& type_header =
|
||||||
video_header.video_type_header.emplace<RTPVideoHeaderH264>();
|
video_header.video_type_header.emplace<RTPVideoHeaderH264>();
|
||||||
@ -303,8 +303,8 @@ TEST_F(TestH264SpsPpsTracker, SpsPpsOutOfBand) {
|
|||||||
EXPECT_EQ(H264SpsPpsTracker::kInsert,
|
EXPECT_EQ(H264SpsPpsTracker::kInsert,
|
||||||
tracker_.CopyAndFixBitstream(&idr_packet));
|
tracker_.CopyAndFixBitstream(&idr_packet));
|
||||||
EXPECT_EQ(3u, idr_packet.h264().nalus_length);
|
EXPECT_EQ(3u, idr_packet.h264().nalus_length);
|
||||||
EXPECT_EQ(320, idr_packet.width);
|
EXPECT_EQ(320, idr_packet.width());
|
||||||
EXPECT_EQ(240, idr_packet.height);
|
EXPECT_EQ(240, idr_packet.height());
|
||||||
ExpectSpsPpsIdr(idr_packet.h264(), 0, 0);
|
ExpectSpsPpsIdr(idr_packet.h264(), 0, 0);
|
||||||
|
|
||||||
if (idr_packet.dataPtr != kData) {
|
if (idr_packet.dataPtr != kData) {
|
||||||
@ -365,8 +365,8 @@ TEST_F(TestH264SpsPpsTracker, SaveRestoreWidthHeight) {
|
|||||||
AddPps(&sps_pps_packet, 0, 1, &data);
|
AddPps(&sps_pps_packet, 0, 1, &data);
|
||||||
sps_pps_packet.dataPtr = data.data();
|
sps_pps_packet.dataPtr = data.data();
|
||||||
sps_pps_packet.sizeBytes = data.size();
|
sps_pps_packet.sizeBytes = data.size();
|
||||||
sps_pps_packet.width = 320;
|
sps_pps_packet.video_header.width = 320;
|
||||||
sps_pps_packet.height = 240;
|
sps_pps_packet.video_header.height = 240;
|
||||||
EXPECT_EQ(H264SpsPpsTracker::kInsert,
|
EXPECT_EQ(H264SpsPpsTracker::kInsert,
|
||||||
tracker_.CopyAndFixBitstream(&sps_pps_packet));
|
tracker_.CopyAndFixBitstream(&sps_pps_packet));
|
||||||
delete[] sps_pps_packet.dataPtr;
|
delete[] sps_pps_packet.dataPtr;
|
||||||
@ -380,8 +380,8 @@ TEST_F(TestH264SpsPpsTracker, SaveRestoreWidthHeight) {
|
|||||||
EXPECT_EQ(H264SpsPpsTracker::kInsert,
|
EXPECT_EQ(H264SpsPpsTracker::kInsert,
|
||||||
tracker_.CopyAndFixBitstream(&idr_packet));
|
tracker_.CopyAndFixBitstream(&idr_packet));
|
||||||
|
|
||||||
EXPECT_EQ(320, idr_packet.width);
|
EXPECT_EQ(320, idr_packet.width());
|
||||||
EXPECT_EQ(240, idr_packet.height);
|
EXPECT_EQ(240, idr_packet.height());
|
||||||
delete[] idr_packet.dataPtr;
|
delete[] idr_packet.dataPtr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -41,14 +41,14 @@ class Vp9SsMapTest : public ::testing::Test {
|
|||||||
virtual void SetUp() {
|
virtual void SetUp() {
|
||||||
auto& vp9_header =
|
auto& vp9_header =
|
||||||
packet_.video_header.video_type_header.emplace<RTPVideoHeaderVP9>();
|
packet_.video_header.video_type_header.emplace<RTPVideoHeaderVP9>();
|
||||||
packet_.is_first_packet_in_frame = true;
|
packet_.video_header.is_first_packet_in_frame = true;
|
||||||
packet_.dataPtr = data_;
|
packet_.dataPtr = data_;
|
||||||
packet_.sizeBytes = 1400;
|
packet_.sizeBytes = 1400;
|
||||||
packet_.seqNum = 1234;
|
packet_.seqNum = 1234;
|
||||||
packet_.timestamp = 1;
|
packet_.timestamp = 1;
|
||||||
packet_.markerBit = true;
|
packet_.markerBit = true;
|
||||||
packet_.frameType = kVideoFrameKey;
|
packet_.frameType = kVideoFrameKey;
|
||||||
packet_.codec = kVideoCodecVP9;
|
packet_.video_header.codec = kVideoCodecVP9;
|
||||||
packet_.video_header.codec = kVideoCodecVP9;
|
packet_.video_header.codec = kVideoCodecVP9;
|
||||||
vp9_header.flexible_mode = false;
|
vp9_header.flexible_mode = false;
|
||||||
vp9_header.gof_idx = 0;
|
vp9_header.gof_idx = 0;
|
||||||
@ -435,7 +435,7 @@ TEST_F(TestBasicJitterBuffer, StopRunning) {
|
|||||||
TEST_F(TestBasicJitterBuffer, SinglePacketFrame) {
|
TEST_F(TestBasicJitterBuffer, SinglePacketFrame) {
|
||||||
// Always start with a complete key frame when not allowing errors.
|
// Always start with a complete key frame when not allowing errors.
|
||||||
packet_->frameType = kVideoFrameKey;
|
packet_->frameType = kVideoFrameKey;
|
||||||
packet_->is_first_packet_in_frame = true;
|
packet_->video_header.is_first_packet_in_frame = true;
|
||||||
packet_->markerBit = true;
|
packet_->markerBit = true;
|
||||||
packet_->timestamp += 123 * 90;
|
packet_->timestamp += 123 * 90;
|
||||||
|
|
||||||
@ -453,7 +453,7 @@ TEST_F(TestBasicJitterBuffer, VerifyHistogramStats) {
|
|||||||
metrics::Reset();
|
metrics::Reset();
|
||||||
// Always start with a complete key frame when not allowing errors.
|
// Always start with a complete key frame when not allowing errors.
|
||||||
packet_->frameType = kVideoFrameKey;
|
packet_->frameType = kVideoFrameKey;
|
||||||
packet_->is_first_packet_in_frame = true;
|
packet_->video_header.is_first_packet_in_frame = true;
|
||||||
packet_->markerBit = true;
|
packet_->markerBit = true;
|
||||||
packet_->timestamp += 123 * 90;
|
packet_->timestamp += 123 * 90;
|
||||||
|
|
||||||
@ -488,7 +488,7 @@ TEST_F(TestBasicJitterBuffer, VerifyHistogramStats) {
|
|||||||
|
|
||||||
TEST_F(TestBasicJitterBuffer, DualPacketFrame) {
|
TEST_F(TestBasicJitterBuffer, DualPacketFrame) {
|
||||||
packet_->frameType = kVideoFrameKey;
|
packet_->frameType = kVideoFrameKey;
|
||||||
packet_->is_first_packet_in_frame = true;
|
packet_->video_header.is_first_packet_in_frame = true;
|
||||||
packet_->markerBit = false;
|
packet_->markerBit = false;
|
||||||
|
|
||||||
bool retransmitted = false;
|
bool retransmitted = false;
|
||||||
@ -499,7 +499,7 @@ TEST_F(TestBasicJitterBuffer, DualPacketFrame) {
|
|||||||
EXPECT_TRUE(frame_out == NULL);
|
EXPECT_TRUE(frame_out == NULL);
|
||||||
|
|
||||||
++seq_num_;
|
++seq_num_;
|
||||||
packet_->is_first_packet_in_frame = false;
|
packet_->video_header.is_first_packet_in_frame = false;
|
||||||
packet_->markerBit = true;
|
packet_->markerBit = true;
|
||||||
packet_->seqNum = seq_num_;
|
packet_->seqNum = seq_num_;
|
||||||
|
|
||||||
@ -515,7 +515,7 @@ TEST_F(TestBasicJitterBuffer, DualPacketFrame) {
|
|||||||
|
|
||||||
TEST_F(TestBasicJitterBuffer, 100PacketKeyFrame) {
|
TEST_F(TestBasicJitterBuffer, 100PacketKeyFrame) {
|
||||||
packet_->frameType = kVideoFrameKey;
|
packet_->frameType = kVideoFrameKey;
|
||||||
packet_->is_first_packet_in_frame = true;
|
packet_->video_header.is_first_packet_in_frame = true;
|
||||||
packet_->markerBit = false;
|
packet_->markerBit = false;
|
||||||
|
|
||||||
bool retransmitted = false;
|
bool retransmitted = false;
|
||||||
@ -531,7 +531,7 @@ TEST_F(TestBasicJitterBuffer, 100PacketKeyFrame) {
|
|||||||
int loop = 0;
|
int loop = 0;
|
||||||
do {
|
do {
|
||||||
seq_num_++;
|
seq_num_++;
|
||||||
packet_->is_first_packet_in_frame = false;
|
packet_->video_header.is_first_packet_in_frame = false;
|
||||||
packet_->markerBit = false;
|
packet_->markerBit = false;
|
||||||
packet_->seqNum = seq_num_;
|
packet_->seqNum = seq_num_;
|
||||||
|
|
||||||
@ -542,7 +542,7 @@ TEST_F(TestBasicJitterBuffer, 100PacketKeyFrame) {
|
|||||||
|
|
||||||
// Insert last packet.
|
// Insert last packet.
|
||||||
++seq_num_;
|
++seq_num_;
|
||||||
packet_->is_first_packet_in_frame = false;
|
packet_->video_header.is_first_packet_in_frame = false;
|
||||||
packet_->markerBit = true;
|
packet_->markerBit = true;
|
||||||
packet_->seqNum = seq_num_;
|
packet_->seqNum = seq_num_;
|
||||||
|
|
||||||
@ -559,7 +559,7 @@ TEST_F(TestBasicJitterBuffer, 100PacketKeyFrame) {
|
|||||||
TEST_F(TestBasicJitterBuffer, 100PacketDeltaFrame) {
|
TEST_F(TestBasicJitterBuffer, 100PacketDeltaFrame) {
|
||||||
// Always start with a complete key frame.
|
// Always start with a complete key frame.
|
||||||
packet_->frameType = kVideoFrameKey;
|
packet_->frameType = kVideoFrameKey;
|
||||||
packet_->is_first_packet_in_frame = true;
|
packet_->video_header.is_first_packet_in_frame = true;
|
||||||
packet_->markerBit = true;
|
packet_->markerBit = true;
|
||||||
|
|
||||||
bool retransmitted = false;
|
bool retransmitted = false;
|
||||||
@ -583,7 +583,7 @@ TEST_F(TestBasicJitterBuffer, 100PacketDeltaFrame) {
|
|||||||
// Frame should not be complete.
|
// Frame should not be complete.
|
||||||
EXPECT_TRUE(frame_out == NULL);
|
EXPECT_TRUE(frame_out == NULL);
|
||||||
|
|
||||||
packet_->is_first_packet_in_frame = false;
|
packet_->video_header.is_first_packet_in_frame = false;
|
||||||
// Insert 98 frames.
|
// Insert 98 frames.
|
||||||
int loop = 0;
|
int loop = 0;
|
||||||
do {
|
do {
|
||||||
@ -598,7 +598,7 @@ TEST_F(TestBasicJitterBuffer, 100PacketDeltaFrame) {
|
|||||||
|
|
||||||
// Insert the last packet.
|
// Insert the last packet.
|
||||||
++seq_num_;
|
++seq_num_;
|
||||||
packet_->is_first_packet_in_frame = false;
|
packet_->video_header.is_first_packet_in_frame = false;
|
||||||
packet_->markerBit = true;
|
packet_->markerBit = true;
|
||||||
packet_->seqNum = seq_num_;
|
packet_->seqNum = seq_num_;
|
||||||
|
|
||||||
@ -616,7 +616,7 @@ TEST_F(TestBasicJitterBuffer, PacketReorderingReverseOrder) {
|
|||||||
// Insert the "first" packet last.
|
// Insert the "first" packet last.
|
||||||
seq_num_ += 100;
|
seq_num_ += 100;
|
||||||
packet_->frameType = kVideoFrameKey;
|
packet_->frameType = kVideoFrameKey;
|
||||||
packet_->is_first_packet_in_frame = false;
|
packet_->video_header.is_first_packet_in_frame = false;
|
||||||
packet_->markerBit = true;
|
packet_->markerBit = true;
|
||||||
packet_->seqNum = seq_num_;
|
packet_->seqNum = seq_num_;
|
||||||
packet_->timestamp = timestamp_;
|
packet_->timestamp = timestamp_;
|
||||||
@ -633,7 +633,7 @@ TEST_F(TestBasicJitterBuffer, PacketReorderingReverseOrder) {
|
|||||||
int loop = 0;
|
int loop = 0;
|
||||||
do {
|
do {
|
||||||
seq_num_--;
|
seq_num_--;
|
||||||
packet_->is_first_packet_in_frame = false;
|
packet_->video_header.is_first_packet_in_frame = false;
|
||||||
packet_->markerBit = false;
|
packet_->markerBit = false;
|
||||||
packet_->seqNum = seq_num_;
|
packet_->seqNum = seq_num_;
|
||||||
|
|
||||||
@ -644,7 +644,7 @@ TEST_F(TestBasicJitterBuffer, PacketReorderingReverseOrder) {
|
|||||||
|
|
||||||
// Insert the last packet.
|
// Insert the last packet.
|
||||||
seq_num_--;
|
seq_num_--;
|
||||||
packet_->is_first_packet_in_frame = true;
|
packet_->video_header.is_first_packet_in_frame = true;
|
||||||
packet_->markerBit = false;
|
packet_->markerBit = false;
|
||||||
packet_->seqNum = seq_num_;
|
packet_->seqNum = seq_num_;
|
||||||
|
|
||||||
@ -661,7 +661,7 @@ TEST_F(TestBasicJitterBuffer, PacketReorderingReverseOrder) {
|
|||||||
|
|
||||||
TEST_F(TestBasicJitterBuffer, FrameReordering2Frames2PacketsEach) {
|
TEST_F(TestBasicJitterBuffer, FrameReordering2Frames2PacketsEach) {
|
||||||
packet_->frameType = kVideoFrameDelta;
|
packet_->frameType = kVideoFrameDelta;
|
||||||
packet_->is_first_packet_in_frame = true;
|
packet_->video_header.is_first_packet_in_frame = true;
|
||||||
packet_->markerBit = false;
|
packet_->markerBit = false;
|
||||||
|
|
||||||
bool retransmitted = false;
|
bool retransmitted = false;
|
||||||
@ -673,7 +673,7 @@ TEST_F(TestBasicJitterBuffer, FrameReordering2Frames2PacketsEach) {
|
|||||||
EXPECT_TRUE(frame_out == NULL);
|
EXPECT_TRUE(frame_out == NULL);
|
||||||
|
|
||||||
seq_num_++;
|
seq_num_++;
|
||||||
packet_->is_first_packet_in_frame = false;
|
packet_->video_header.is_first_packet_in_frame = false;
|
||||||
packet_->markerBit = true;
|
packet_->markerBit = true;
|
||||||
packet_->seqNum = seq_num_;
|
packet_->seqNum = seq_num_;
|
||||||
|
|
||||||
@ -687,7 +687,7 @@ TEST_F(TestBasicJitterBuffer, FrameReordering2Frames2PacketsEach) {
|
|||||||
seq_num_ -= 3;
|
seq_num_ -= 3;
|
||||||
timestamp_ -= 33 * 90;
|
timestamp_ -= 33 * 90;
|
||||||
packet_->frameType = kVideoFrameKey;
|
packet_->frameType = kVideoFrameKey;
|
||||||
packet_->is_first_packet_in_frame = true;
|
packet_->video_header.is_first_packet_in_frame = true;
|
||||||
packet_->markerBit = false;
|
packet_->markerBit = false;
|
||||||
packet_->seqNum = seq_num_;
|
packet_->seqNum = seq_num_;
|
||||||
packet_->timestamp = timestamp_;
|
packet_->timestamp = timestamp_;
|
||||||
@ -701,7 +701,7 @@ TEST_F(TestBasicJitterBuffer, FrameReordering2Frames2PacketsEach) {
|
|||||||
EXPECT_TRUE(frame_out == NULL);
|
EXPECT_TRUE(frame_out == NULL);
|
||||||
|
|
||||||
seq_num_++;
|
seq_num_++;
|
||||||
packet_->is_first_packet_in_frame = false;
|
packet_->video_header.is_first_packet_in_frame = false;
|
||||||
packet_->markerBit = true;
|
packet_->markerBit = true;
|
||||||
packet_->seqNum = seq_num_;
|
packet_->seqNum = seq_num_;
|
||||||
|
|
||||||
@ -721,7 +721,7 @@ TEST_F(TestBasicJitterBuffer, FrameReordering2Frames2PacketsEach) {
|
|||||||
|
|
||||||
TEST_F(TestBasicJitterBuffer, TestReorderingWithPadding) {
|
TEST_F(TestBasicJitterBuffer, TestReorderingWithPadding) {
|
||||||
packet_->frameType = kVideoFrameKey;
|
packet_->frameType = kVideoFrameKey;
|
||||||
packet_->is_first_packet_in_frame = true;
|
packet_->video_header.is_first_packet_in_frame = true;
|
||||||
packet_->markerBit = true;
|
packet_->markerBit = true;
|
||||||
|
|
||||||
// Send in an initial good packet/frame (Frame A) to start things off.
|
// Send in an initial good packet/frame (Frame A) to start things off.
|
||||||
@ -784,7 +784,7 @@ TEST_F(TestBasicJitterBuffer, TestReorderingWithPadding) {
|
|||||||
|
|
||||||
TEST_F(TestBasicJitterBuffer, DuplicatePackets) {
|
TEST_F(TestBasicJitterBuffer, DuplicatePackets) {
|
||||||
packet_->frameType = kVideoFrameKey;
|
packet_->frameType = kVideoFrameKey;
|
||||||
packet_->is_first_packet_in_frame = true;
|
packet_->video_header.is_first_packet_in_frame = true;
|
||||||
packet_->markerBit = false;
|
packet_->markerBit = false;
|
||||||
packet_->seqNum = seq_num_;
|
packet_->seqNum = seq_num_;
|
||||||
packet_->timestamp = timestamp_;
|
packet_->timestamp = timestamp_;
|
||||||
@ -810,7 +810,7 @@ TEST_F(TestBasicJitterBuffer, DuplicatePackets) {
|
|||||||
seq_num_++;
|
seq_num_++;
|
||||||
packet_->seqNum = seq_num_;
|
packet_->seqNum = seq_num_;
|
||||||
packet_->markerBit = true;
|
packet_->markerBit = true;
|
||||||
packet_->is_first_packet_in_frame = false;
|
packet_->video_header.is_first_packet_in_frame = false;
|
||||||
|
|
||||||
EXPECT_EQ(kCompleteSession,
|
EXPECT_EQ(kCompleteSession,
|
||||||
jitter_buffer_->InsertPacket(*packet_, &retransmitted));
|
jitter_buffer_->InsertPacket(*packet_, &retransmitted));
|
||||||
@ -827,7 +827,7 @@ TEST_F(TestBasicJitterBuffer, DuplicatePackets) {
|
|||||||
|
|
||||||
TEST_F(TestBasicJitterBuffer, DuplicatePreviousDeltaFramePacket) {
|
TEST_F(TestBasicJitterBuffer, DuplicatePreviousDeltaFramePacket) {
|
||||||
packet_->frameType = kVideoFrameKey;
|
packet_->frameType = kVideoFrameKey;
|
||||||
packet_->is_first_packet_in_frame = true;
|
packet_->video_header.is_first_packet_in_frame = true;
|
||||||
packet_->markerBit = true;
|
packet_->markerBit = true;
|
||||||
packet_->seqNum = seq_num_;
|
packet_->seqNum = seq_num_;
|
||||||
packet_->timestamp = timestamp_;
|
packet_->timestamp = timestamp_;
|
||||||
@ -890,9 +890,8 @@ TEST_F(TestBasicJitterBuffer, TestSkipForwardVp9) {
|
|||||||
packet_->video_header.video_type_header.emplace<RTPVideoHeaderVP9>();
|
packet_->video_header.video_type_header.emplace<RTPVideoHeaderVP9>();
|
||||||
|
|
||||||
bool re = false;
|
bool re = false;
|
||||||
packet_->codec = kVideoCodecVP9;
|
|
||||||
packet_->video_header.codec = kVideoCodecVP9;
|
packet_->video_header.codec = kVideoCodecVP9;
|
||||||
packet_->is_first_packet_in_frame = true;
|
packet_->video_header.is_first_packet_in_frame = true;
|
||||||
packet_->markerBit = true;
|
packet_->markerBit = true;
|
||||||
vp9_header.flexible_mode = false;
|
vp9_header.flexible_mode = false;
|
||||||
vp9_header.spatial_idx = 0;
|
vp9_header.spatial_idx = 0;
|
||||||
@ -946,9 +945,8 @@ TEST_F(TestBasicJitterBuffer, ReorderedVp9SsData_3TlLayers) {
|
|||||||
packet_->video_header.video_type_header.emplace<RTPVideoHeaderVP9>();
|
packet_->video_header.video_type_header.emplace<RTPVideoHeaderVP9>();
|
||||||
|
|
||||||
bool re = false;
|
bool re = false;
|
||||||
packet_->codec = kVideoCodecVP9;
|
|
||||||
packet_->video_header.codec = kVideoCodecVP9;
|
packet_->video_header.codec = kVideoCodecVP9;
|
||||||
packet_->is_first_packet_in_frame = true;
|
packet_->video_header.is_first_packet_in_frame = true;
|
||||||
packet_->markerBit = true;
|
packet_->markerBit = true;
|
||||||
vp9_header.flexible_mode = false;
|
vp9_header.flexible_mode = false;
|
||||||
vp9_header.spatial_idx = 0;
|
vp9_header.spatial_idx = 0;
|
||||||
@ -976,8 +974,8 @@ TEST_F(TestBasicJitterBuffer, ReorderedVp9SsData_3TlLayers) {
|
|||||||
packet_->seqNum = 65485;
|
packet_->seqNum = 65485;
|
||||||
packet_->timestamp = 3000;
|
packet_->timestamp = 3000;
|
||||||
packet_->frameType = kVideoFrameKey;
|
packet_->frameType = kVideoFrameKey;
|
||||||
packet_->width = 352;
|
packet_->video_header.width = 352;
|
||||||
packet_->height = 288;
|
packet_->video_header.height = 288;
|
||||||
vp9_header.picture_id = 5;
|
vp9_header.picture_id = 5;
|
||||||
vp9_header.temporal_idx = 0;
|
vp9_header.temporal_idx = 0;
|
||||||
vp9_header.temporal_up_switch = false;
|
vp9_header.temporal_up_switch = false;
|
||||||
@ -1025,14 +1023,13 @@ TEST_F(TestBasicJitterBuffer, ReorderedVp9SsData_2Tl2SLayers) {
|
|||||||
packet_->video_header.video_type_header.emplace<RTPVideoHeaderVP9>();
|
packet_->video_header.video_type_header.emplace<RTPVideoHeaderVP9>();
|
||||||
|
|
||||||
bool re = false;
|
bool re = false;
|
||||||
packet_->codec = kVideoCodecVP9;
|
|
||||||
packet_->video_header.codec = kVideoCodecVP9;
|
packet_->video_header.codec = kVideoCodecVP9;
|
||||||
vp9_header.flexible_mode = false;
|
vp9_header.flexible_mode = false;
|
||||||
vp9_header.beginning_of_frame = true;
|
vp9_header.beginning_of_frame = true;
|
||||||
vp9_header.end_of_frame = true;
|
vp9_header.end_of_frame = true;
|
||||||
vp9_header.tl0_pic_idx = 200;
|
vp9_header.tl0_pic_idx = 200;
|
||||||
|
|
||||||
packet_->is_first_packet_in_frame = true;
|
packet_->video_header.is_first_packet_in_frame = true;
|
||||||
packet_->markerBit = false;
|
packet_->markerBit = false;
|
||||||
packet_->seqNum = 65486;
|
packet_->seqNum = 65486;
|
||||||
packet_->timestamp = 6000;
|
packet_->timestamp = 6000;
|
||||||
@ -1043,7 +1040,7 @@ TEST_F(TestBasicJitterBuffer, ReorderedVp9SsData_2Tl2SLayers) {
|
|||||||
vp9_header.temporal_up_switch = true;
|
vp9_header.temporal_up_switch = true;
|
||||||
EXPECT_EQ(kIncomplete, jitter_buffer_->InsertPacket(*packet_, &re));
|
EXPECT_EQ(kIncomplete, jitter_buffer_->InsertPacket(*packet_, &re));
|
||||||
|
|
||||||
packet_->is_first_packet_in_frame = false;
|
packet_->video_header.is_first_packet_in_frame = false;
|
||||||
packet_->markerBit = true;
|
packet_->markerBit = true;
|
||||||
packet_->seqNum = 65487;
|
packet_->seqNum = 65487;
|
||||||
packet_->frameType = kVideoFrameDelta;
|
packet_->frameType = kVideoFrameDelta;
|
||||||
@ -1053,7 +1050,7 @@ TEST_F(TestBasicJitterBuffer, ReorderedVp9SsData_2Tl2SLayers) {
|
|||||||
vp9_header.temporal_up_switch = true;
|
vp9_header.temporal_up_switch = true;
|
||||||
EXPECT_EQ(kCompleteSession, jitter_buffer_->InsertPacket(*packet_, &re));
|
EXPECT_EQ(kCompleteSession, jitter_buffer_->InsertPacket(*packet_, &re));
|
||||||
|
|
||||||
packet_->is_first_packet_in_frame = false;
|
packet_->video_header.is_first_packet_in_frame = false;
|
||||||
packet_->markerBit = true;
|
packet_->markerBit = true;
|
||||||
packet_->seqNum = 65485;
|
packet_->seqNum = 65485;
|
||||||
packet_->timestamp = 3000;
|
packet_->timestamp = 3000;
|
||||||
@ -1065,12 +1062,12 @@ TEST_F(TestBasicJitterBuffer, ReorderedVp9SsData_2Tl2SLayers) {
|
|||||||
EXPECT_EQ(kIncomplete, jitter_buffer_->InsertPacket(*packet_, &re));
|
EXPECT_EQ(kIncomplete, jitter_buffer_->InsertPacket(*packet_, &re));
|
||||||
|
|
||||||
// Insert first frame with SS data.
|
// Insert first frame with SS data.
|
||||||
packet_->is_first_packet_in_frame = true;
|
packet_->video_header.is_first_packet_in_frame = true;
|
||||||
packet_->markerBit = false;
|
packet_->markerBit = false;
|
||||||
packet_->seqNum = 65484;
|
packet_->seqNum = 65484;
|
||||||
packet_->frameType = kVideoFrameKey;
|
packet_->frameType = kVideoFrameKey;
|
||||||
packet_->width = 352;
|
packet_->video_header.width = 352;
|
||||||
packet_->height = 288;
|
packet_->video_header.height = 288;
|
||||||
vp9_header.spatial_idx = 0;
|
vp9_header.spatial_idx = 0;
|
||||||
vp9_header.picture_id = 5;
|
vp9_header.picture_id = 5;
|
||||||
vp9_header.temporal_idx = 0;
|
vp9_header.temporal_idx = 0;
|
||||||
@ -1098,7 +1095,7 @@ TEST_F(TestBasicJitterBuffer, ReorderedVp9SsData_2Tl2SLayers) {
|
|||||||
|
|
||||||
TEST_F(TestBasicJitterBuffer, H264InsertStartCode) {
|
TEST_F(TestBasicJitterBuffer, H264InsertStartCode) {
|
||||||
packet_->frameType = kVideoFrameKey;
|
packet_->frameType = kVideoFrameKey;
|
||||||
packet_->is_first_packet_in_frame = true;
|
packet_->video_header.is_first_packet_in_frame = true;
|
||||||
packet_->markerBit = false;
|
packet_->markerBit = false;
|
||||||
packet_->seqNum = seq_num_;
|
packet_->seqNum = seq_num_;
|
||||||
packet_->timestamp = timestamp_;
|
packet_->timestamp = timestamp_;
|
||||||
@ -1114,7 +1111,7 @@ TEST_F(TestBasicJitterBuffer, H264InsertStartCode) {
|
|||||||
EXPECT_TRUE(frame_out == NULL);
|
EXPECT_TRUE(frame_out == NULL);
|
||||||
|
|
||||||
seq_num_++;
|
seq_num_++;
|
||||||
packet_->is_first_packet_in_frame = false;
|
packet_->video_header.is_first_packet_in_frame = false;
|
||||||
packet_->markerBit = true;
|
packet_->markerBit = true;
|
||||||
packet_->seqNum = seq_num_;
|
packet_->seqNum = seq_num_;
|
||||||
|
|
||||||
@ -1132,9 +1129,8 @@ TEST_F(TestBasicJitterBuffer, SpsAndPpsHandling) {
|
|||||||
packet_->video_header.video_type_header.emplace<RTPVideoHeaderH264>();
|
packet_->video_header.video_type_header.emplace<RTPVideoHeaderH264>();
|
||||||
packet_->timestamp = timestamp_;
|
packet_->timestamp = timestamp_;
|
||||||
packet_->frameType = kVideoFrameKey;
|
packet_->frameType = kVideoFrameKey;
|
||||||
packet_->is_first_packet_in_frame = true;
|
packet_->video_header.is_first_packet_in_frame = true;
|
||||||
packet_->markerBit = true;
|
packet_->markerBit = true;
|
||||||
packet_->codec = kVideoCodecH264;
|
|
||||||
packet_->video_header.codec = kVideoCodecH264;
|
packet_->video_header.codec = kVideoCodecH264;
|
||||||
h264_header.nalu_type = H264::NaluType::kIdr;
|
h264_header.nalu_type = H264::NaluType::kIdr;
|
||||||
h264_header.nalus[0].type = H264::NaluType::kIdr;
|
h264_header.nalus[0].type = H264::NaluType::kIdr;
|
||||||
@ -1152,9 +1148,8 @@ TEST_F(TestBasicJitterBuffer, SpsAndPpsHandling) {
|
|||||||
++seq_num_;
|
++seq_num_;
|
||||||
packet_->seqNum = seq_num_;
|
packet_->seqNum = seq_num_;
|
||||||
packet_->frameType = kVideoFrameKey;
|
packet_->frameType = kVideoFrameKey;
|
||||||
packet_->is_first_packet_in_frame = true;
|
packet_->video_header.is_first_packet_in_frame = true;
|
||||||
packet_->markerBit = false;
|
packet_->markerBit = false;
|
||||||
packet_->codec = kVideoCodecH264;
|
|
||||||
packet_->video_header.codec = kVideoCodecH264;
|
packet_->video_header.codec = kVideoCodecH264;
|
||||||
h264_header.nalu_type = H264::NaluType::kStapA;
|
h264_header.nalu_type = H264::NaluType::kStapA;
|
||||||
h264_header.nalus[0].type = H264::NaluType::kSps;
|
h264_header.nalus[0].type = H264::NaluType::kSps;
|
||||||
@ -1171,9 +1166,8 @@ TEST_F(TestBasicJitterBuffer, SpsAndPpsHandling) {
|
|||||||
++seq_num_;
|
++seq_num_;
|
||||||
packet_->seqNum = seq_num_;
|
packet_->seqNum = seq_num_;
|
||||||
packet_->frameType = kVideoFrameKey;
|
packet_->frameType = kVideoFrameKey;
|
||||||
packet_->is_first_packet_in_frame = false;
|
packet_->video_header.is_first_packet_in_frame = false;
|
||||||
packet_->markerBit = true;
|
packet_->markerBit = true;
|
||||||
packet_->codec = kVideoCodecH264;
|
|
||||||
packet_->video_header.codec = kVideoCodecH264;
|
packet_->video_header.codec = kVideoCodecH264;
|
||||||
h264_header.nalu_type = H264::NaluType::kIdr;
|
h264_header.nalu_type = H264::NaluType::kIdr;
|
||||||
h264_header.nalus[0].type = H264::NaluType::kIdr;
|
h264_header.nalus[0].type = H264::NaluType::kIdr;
|
||||||
@ -1193,9 +1187,8 @@ TEST_F(TestBasicJitterBuffer, SpsAndPpsHandling) {
|
|||||||
++seq_num_;
|
++seq_num_;
|
||||||
packet_->seqNum = seq_num_;
|
packet_->seqNum = seq_num_;
|
||||||
packet_->frameType = kVideoFrameDelta;
|
packet_->frameType = kVideoFrameDelta;
|
||||||
packet_->is_first_packet_in_frame = true;
|
packet_->video_header.is_first_packet_in_frame = true;
|
||||||
packet_->markerBit = true;
|
packet_->markerBit = true;
|
||||||
packet_->codec = kVideoCodecH264;
|
|
||||||
packet_->video_header.codec = kVideoCodecH264;
|
packet_->video_header.codec = kVideoCodecH264;
|
||||||
h264_header.nalu_type = H264::NaluType::kSlice;
|
h264_header.nalu_type = H264::NaluType::kSlice;
|
||||||
h264_header.nalus[0].type = H264::NaluType::kSlice;
|
h264_header.nalus[0].type = H264::NaluType::kSlice;
|
||||||
@ -1213,7 +1206,7 @@ TEST_F(TestBasicJitterBuffer, SpsAndPpsHandling) {
|
|||||||
TEST_F(TestBasicJitterBuffer, DeltaFrame100PacketsWithSeqNumWrap) {
|
TEST_F(TestBasicJitterBuffer, DeltaFrame100PacketsWithSeqNumWrap) {
|
||||||
seq_num_ = 0xfff0;
|
seq_num_ = 0xfff0;
|
||||||
packet_->frameType = kVideoFrameKey;
|
packet_->frameType = kVideoFrameKey;
|
||||||
packet_->is_first_packet_in_frame = true;
|
packet_->video_header.is_first_packet_in_frame = true;
|
||||||
packet_->markerBit = false;
|
packet_->markerBit = false;
|
||||||
packet_->seqNum = seq_num_;
|
packet_->seqNum = seq_num_;
|
||||||
packet_->timestamp = timestamp_;
|
packet_->timestamp = timestamp_;
|
||||||
@ -1229,7 +1222,7 @@ TEST_F(TestBasicJitterBuffer, DeltaFrame100PacketsWithSeqNumWrap) {
|
|||||||
int loop = 0;
|
int loop = 0;
|
||||||
do {
|
do {
|
||||||
seq_num_++;
|
seq_num_++;
|
||||||
packet_->is_first_packet_in_frame = false;
|
packet_->video_header.is_first_packet_in_frame = false;
|
||||||
packet_->markerBit = false;
|
packet_->markerBit = false;
|
||||||
packet_->seqNum = seq_num_;
|
packet_->seqNum = seq_num_;
|
||||||
|
|
||||||
@ -1244,7 +1237,7 @@ TEST_F(TestBasicJitterBuffer, DeltaFrame100PacketsWithSeqNumWrap) {
|
|||||||
} while (loop < 98);
|
} while (loop < 98);
|
||||||
|
|
||||||
seq_num_++;
|
seq_num_++;
|
||||||
packet_->is_first_packet_in_frame = false;
|
packet_->video_header.is_first_packet_in_frame = false;
|
||||||
packet_->markerBit = true;
|
packet_->markerBit = true;
|
||||||
packet_->seqNum = seq_num_;
|
packet_->seqNum = seq_num_;
|
||||||
|
|
||||||
@ -1263,7 +1256,7 @@ TEST_F(TestBasicJitterBuffer, PacketReorderingReverseWithNegSeqNumWrap) {
|
|||||||
// Insert "first" packet last seqnum.
|
// Insert "first" packet last seqnum.
|
||||||
seq_num_ = 10;
|
seq_num_ = 10;
|
||||||
packet_->frameType = kVideoFrameKey;
|
packet_->frameType = kVideoFrameKey;
|
||||||
packet_->is_first_packet_in_frame = false;
|
packet_->video_header.is_first_packet_in_frame = false;
|
||||||
packet_->markerBit = true;
|
packet_->markerBit = true;
|
||||||
packet_->seqNum = seq_num_;
|
packet_->seqNum = seq_num_;
|
||||||
|
|
||||||
@ -1279,7 +1272,7 @@ TEST_F(TestBasicJitterBuffer, PacketReorderingReverseWithNegSeqNumWrap) {
|
|||||||
int loop = 0;
|
int loop = 0;
|
||||||
do {
|
do {
|
||||||
seq_num_--;
|
seq_num_--;
|
||||||
packet_->is_first_packet_in_frame = false;
|
packet_->video_header.is_first_packet_in_frame = false;
|
||||||
packet_->markerBit = false;
|
packet_->markerBit = false;
|
||||||
packet_->seqNum = seq_num_;
|
packet_->seqNum = seq_num_;
|
||||||
|
|
||||||
@ -1295,7 +1288,7 @@ TEST_F(TestBasicJitterBuffer, PacketReorderingReverseWithNegSeqNumWrap) {
|
|||||||
|
|
||||||
// Insert last packet.
|
// Insert last packet.
|
||||||
seq_num_--;
|
seq_num_--;
|
||||||
packet_->is_first_packet_in_frame = true;
|
packet_->video_header.is_first_packet_in_frame = true;
|
||||||
packet_->markerBit = false;
|
packet_->markerBit = false;
|
||||||
packet_->seqNum = seq_num_;
|
packet_->seqNum = seq_num_;
|
||||||
|
|
||||||
@ -1316,7 +1309,7 @@ TEST_F(TestBasicJitterBuffer, TestInsertOldFrame) {
|
|||||||
seq_num_ = 2;
|
seq_num_ = 2;
|
||||||
timestamp_ = 3000;
|
timestamp_ = 3000;
|
||||||
packet_->frameType = kVideoFrameKey;
|
packet_->frameType = kVideoFrameKey;
|
||||||
packet_->is_first_packet_in_frame = true;
|
packet_->video_header.is_first_packet_in_frame = true;
|
||||||
packet_->markerBit = true;
|
packet_->markerBit = true;
|
||||||
packet_->timestamp = timestamp_;
|
packet_->timestamp = timestamp_;
|
||||||
packet_->seqNum = seq_num_;
|
packet_->seqNum = seq_num_;
|
||||||
@ -1334,7 +1327,7 @@ TEST_F(TestBasicJitterBuffer, TestInsertOldFrame) {
|
|||||||
seq_num_--;
|
seq_num_--;
|
||||||
timestamp_ = 2000;
|
timestamp_ = 2000;
|
||||||
packet_->frameType = kVideoFrameDelta;
|
packet_->frameType = kVideoFrameDelta;
|
||||||
packet_->is_first_packet_in_frame = true;
|
packet_->video_header.is_first_packet_in_frame = true;
|
||||||
packet_->markerBit = true;
|
packet_->markerBit = true;
|
||||||
packet_->seqNum = seq_num_;
|
packet_->seqNum = seq_num_;
|
||||||
packet_->timestamp = timestamp_;
|
packet_->timestamp = timestamp_;
|
||||||
@ -1351,7 +1344,7 @@ TEST_F(TestBasicJitterBuffer, TestInsertOldFrameWithSeqNumWrap) {
|
|||||||
seq_num_ = 2;
|
seq_num_ = 2;
|
||||||
timestamp_ = 3000;
|
timestamp_ = 3000;
|
||||||
packet_->frameType = kVideoFrameKey;
|
packet_->frameType = kVideoFrameKey;
|
||||||
packet_->is_first_packet_in_frame = true;
|
packet_->video_header.is_first_packet_in_frame = true;
|
||||||
packet_->markerBit = true;
|
packet_->markerBit = true;
|
||||||
packet_->seqNum = seq_num_;
|
packet_->seqNum = seq_num_;
|
||||||
packet_->timestamp = timestamp_;
|
packet_->timestamp = timestamp_;
|
||||||
@ -1372,7 +1365,7 @@ TEST_F(TestBasicJitterBuffer, TestInsertOldFrameWithSeqNumWrap) {
|
|||||||
seq_num_--;
|
seq_num_--;
|
||||||
timestamp_ = 0xffffff00;
|
timestamp_ = 0xffffff00;
|
||||||
packet_->frameType = kVideoFrameDelta;
|
packet_->frameType = kVideoFrameDelta;
|
||||||
packet_->is_first_packet_in_frame = true;
|
packet_->video_header.is_first_packet_in_frame = true;
|
||||||
packet_->markerBit = true;
|
packet_->markerBit = true;
|
||||||
packet_->seqNum = seq_num_;
|
packet_->seqNum = seq_num_;
|
||||||
packet_->timestamp = timestamp_;
|
packet_->timestamp = timestamp_;
|
||||||
@ -1389,7 +1382,7 @@ TEST_F(TestBasicJitterBuffer, TimestampWrap) {
|
|||||||
|
|
||||||
timestamp_ = 0xffffff00;
|
timestamp_ = 0xffffff00;
|
||||||
packet_->frameType = kVideoFrameKey;
|
packet_->frameType = kVideoFrameKey;
|
||||||
packet_->is_first_packet_in_frame = true;
|
packet_->video_header.is_first_packet_in_frame = true;
|
||||||
packet_->markerBit = false;
|
packet_->markerBit = false;
|
||||||
packet_->seqNum = seq_num_;
|
packet_->seqNum = seq_num_;
|
||||||
packet_->timestamp = timestamp_;
|
packet_->timestamp = timestamp_;
|
||||||
@ -1402,7 +1395,7 @@ TEST_F(TestBasicJitterBuffer, TimestampWrap) {
|
|||||||
EXPECT_TRUE(frame_out == NULL);
|
EXPECT_TRUE(frame_out == NULL);
|
||||||
|
|
||||||
seq_num_++;
|
seq_num_++;
|
||||||
packet_->is_first_packet_in_frame = false;
|
packet_->video_header.is_first_packet_in_frame = false;
|
||||||
packet_->markerBit = true;
|
packet_->markerBit = true;
|
||||||
packet_->seqNum = seq_num_;
|
packet_->seqNum = seq_num_;
|
||||||
|
|
||||||
@ -1416,7 +1409,7 @@ TEST_F(TestBasicJitterBuffer, TimestampWrap) {
|
|||||||
seq_num_++;
|
seq_num_++;
|
||||||
timestamp_ += 33 * 90;
|
timestamp_ += 33 * 90;
|
||||||
packet_->frameType = kVideoFrameDelta;
|
packet_->frameType = kVideoFrameDelta;
|
||||||
packet_->is_first_packet_in_frame = true;
|
packet_->video_header.is_first_packet_in_frame = true;
|
||||||
packet_->markerBit = false;
|
packet_->markerBit = false;
|
||||||
packet_->seqNum = seq_num_;
|
packet_->seqNum = seq_num_;
|
||||||
packet_->timestamp = timestamp_;
|
packet_->timestamp = timestamp_;
|
||||||
@ -1428,7 +1421,7 @@ TEST_F(TestBasicJitterBuffer, TimestampWrap) {
|
|||||||
EXPECT_TRUE(frame_out == NULL);
|
EXPECT_TRUE(frame_out == NULL);
|
||||||
|
|
||||||
seq_num_++;
|
seq_num_++;
|
||||||
packet_->is_first_packet_in_frame = false;
|
packet_->video_header.is_first_packet_in_frame = false;
|
||||||
packet_->markerBit = true;
|
packet_->markerBit = true;
|
||||||
packet_->seqNum = seq_num_;
|
packet_->seqNum = seq_num_;
|
||||||
|
|
||||||
@ -1449,7 +1442,7 @@ TEST_F(TestBasicJitterBuffer, 2FrameWithTimestampWrap) {
|
|||||||
|
|
||||||
timestamp_ = 0xffffff00;
|
timestamp_ = 0xffffff00;
|
||||||
packet_->frameType = kVideoFrameKey;
|
packet_->frameType = kVideoFrameKey;
|
||||||
packet_->is_first_packet_in_frame = true;
|
packet_->video_header.is_first_packet_in_frame = true;
|
||||||
packet_->markerBit = true;
|
packet_->markerBit = true;
|
||||||
packet_->timestamp = timestamp_;
|
packet_->timestamp = timestamp_;
|
||||||
|
|
||||||
@ -1462,7 +1455,7 @@ TEST_F(TestBasicJitterBuffer, 2FrameWithTimestampWrap) {
|
|||||||
seq_num_++;
|
seq_num_++;
|
||||||
timestamp_ = 2700;
|
timestamp_ = 2700;
|
||||||
packet_->frameType = kVideoFrameDelta;
|
packet_->frameType = kVideoFrameDelta;
|
||||||
packet_->is_first_packet_in_frame = true;
|
packet_->video_header.is_first_packet_in_frame = true;
|
||||||
packet_->markerBit = true;
|
packet_->markerBit = true;
|
||||||
packet_->seqNum = seq_num_;
|
packet_->seqNum = seq_num_;
|
||||||
packet_->timestamp = timestamp_;
|
packet_->timestamp = timestamp_;
|
||||||
@ -1492,7 +1485,7 @@ TEST_F(TestBasicJitterBuffer, Insert2FramesReOrderedWithTimestampWrap) {
|
|||||||
seq_num_ = 2;
|
seq_num_ = 2;
|
||||||
timestamp_ = 2700;
|
timestamp_ = 2700;
|
||||||
packet_->frameType = kVideoFrameDelta;
|
packet_->frameType = kVideoFrameDelta;
|
||||||
packet_->is_first_packet_in_frame = true;
|
packet_->video_header.is_first_packet_in_frame = true;
|
||||||
packet_->markerBit = true;
|
packet_->markerBit = true;
|
||||||
packet_->seqNum = seq_num_;
|
packet_->seqNum = seq_num_;
|
||||||
packet_->timestamp = timestamp_;
|
packet_->timestamp = timestamp_;
|
||||||
@ -1505,7 +1498,7 @@ TEST_F(TestBasicJitterBuffer, Insert2FramesReOrderedWithTimestampWrap) {
|
|||||||
seq_num_--;
|
seq_num_--;
|
||||||
timestamp_ = 0xffffff00;
|
timestamp_ = 0xffffff00;
|
||||||
packet_->frameType = kVideoFrameKey;
|
packet_->frameType = kVideoFrameKey;
|
||||||
packet_->is_first_packet_in_frame = true;
|
packet_->video_header.is_first_packet_in_frame = true;
|
||||||
packet_->markerBit = true;
|
packet_->markerBit = true;
|
||||||
packet_->seqNum = seq_num_;
|
packet_->seqNum = seq_num_;
|
||||||
packet_->timestamp = timestamp_;
|
packet_->timestamp = timestamp_;
|
||||||
@ -1533,7 +1526,7 @@ TEST_F(TestBasicJitterBuffer, DeltaFrameWithMoreThanMaxNumberOfPackets) {
|
|||||||
// Insert kMaxPacketsInJitterBuffer into frame.
|
// Insert kMaxPacketsInJitterBuffer into frame.
|
||||||
do {
|
do {
|
||||||
seq_num_++;
|
seq_num_++;
|
||||||
packet_->is_first_packet_in_frame = false;
|
packet_->video_header.is_first_packet_in_frame = false;
|
||||||
packet_->markerBit = false;
|
packet_->markerBit = false;
|
||||||
packet_->seqNum = seq_num_;
|
packet_->seqNum = seq_num_;
|
||||||
|
|
||||||
@ -1552,7 +1545,7 @@ TEST_F(TestBasicJitterBuffer, DeltaFrameWithMoreThanMaxNumberOfPackets) {
|
|||||||
// Max number of packets inserted.
|
// Max number of packets inserted.
|
||||||
// Insert one more packet.
|
// Insert one more packet.
|
||||||
seq_num_++;
|
seq_num_++;
|
||||||
packet_->is_first_packet_in_frame = false;
|
packet_->video_header.is_first_packet_in_frame = false;
|
||||||
packet_->markerBit = true;
|
packet_->markerBit = true;
|
||||||
packet_->seqNum = seq_num_;
|
packet_->seqNum = seq_num_;
|
||||||
|
|
||||||
@ -1583,7 +1576,7 @@ TEST_F(TestBasicJitterBuffer, ExceedNumOfFrameWithSeqNumWrap) {
|
|||||||
do {
|
do {
|
||||||
timestamp_ += 33 * 90;
|
timestamp_ += 33 * 90;
|
||||||
seq_num_++;
|
seq_num_++;
|
||||||
packet_->is_first_packet_in_frame = true;
|
packet_->video_header.is_first_packet_in_frame = true;
|
||||||
packet_->markerBit = true;
|
packet_->markerBit = true;
|
||||||
packet_->seqNum = seq_num_;
|
packet_->seqNum = seq_num_;
|
||||||
packet_->timestamp = timestamp_;
|
packet_->timestamp = timestamp_;
|
||||||
@ -1605,7 +1598,7 @@ TEST_F(TestBasicJitterBuffer, ExceedNumOfFrameWithSeqNumWrap) {
|
|||||||
// Insert one more frame.
|
// Insert one more frame.
|
||||||
timestamp_ += 33 * 90;
|
timestamp_ += 33 * 90;
|
||||||
seq_num_++;
|
seq_num_++;
|
||||||
packet_->is_first_packet_in_frame = true;
|
packet_->video_header.is_first_packet_in_frame = true;
|
||||||
packet_->markerBit = true;
|
packet_->markerBit = true;
|
||||||
packet_->seqNum = seq_num_;
|
packet_->seqNum = seq_num_;
|
||||||
packet_->timestamp = timestamp_;
|
packet_->timestamp = timestamp_;
|
||||||
@ -1630,7 +1623,7 @@ TEST_F(TestBasicJitterBuffer, EmptyLastFrame) {
|
|||||||
for (int i = 0; i < maxSize + 10; i++) {
|
for (int i = 0; i < maxSize + 10; i++) {
|
||||||
timestamp_ += 33 * 90;
|
timestamp_ += 33 * 90;
|
||||||
seq_num_++;
|
seq_num_++;
|
||||||
packet_->is_first_packet_in_frame = false;
|
packet_->video_header.is_first_packet_in_frame = false;
|
||||||
packet_->markerBit = false;
|
packet_->markerBit = false;
|
||||||
packet_->seqNum = seq_num_;
|
packet_->seqNum = seq_num_;
|
||||||
packet_->timestamp = timestamp_;
|
packet_->timestamp = timestamp_;
|
||||||
@ -1646,7 +1639,7 @@ TEST_F(TestBasicJitterBuffer, NextFrameWhenIncomplete) {
|
|||||||
// timestamp.
|
// timestamp.
|
||||||
// Start with a complete key frame - insert and decode.
|
// Start with a complete key frame - insert and decode.
|
||||||
packet_->frameType = kVideoFrameKey;
|
packet_->frameType = kVideoFrameKey;
|
||||||
packet_->is_first_packet_in_frame = true;
|
packet_->video_header.is_first_packet_in_frame = true;
|
||||||
packet_->markerBit = true;
|
packet_->markerBit = true;
|
||||||
bool retransmitted = false;
|
bool retransmitted = false;
|
||||||
|
|
||||||
@ -1659,7 +1652,7 @@ TEST_F(TestBasicJitterBuffer, NextFrameWhenIncomplete) {
|
|||||||
packet_->seqNum += 2;
|
packet_->seqNum += 2;
|
||||||
packet_->timestamp += 33 * 90;
|
packet_->timestamp += 33 * 90;
|
||||||
packet_->frameType = kVideoFrameDelta;
|
packet_->frameType = kVideoFrameDelta;
|
||||||
packet_->is_first_packet_in_frame = false;
|
packet_->video_header.is_first_packet_in_frame = false;
|
||||||
packet_->markerBit = false;
|
packet_->markerBit = false;
|
||||||
|
|
||||||
EXPECT_EQ(kIncomplete,
|
EXPECT_EQ(kIncomplete,
|
||||||
@ -1667,7 +1660,7 @@ TEST_F(TestBasicJitterBuffer, NextFrameWhenIncomplete) {
|
|||||||
|
|
||||||
packet_->seqNum += 2;
|
packet_->seqNum += 2;
|
||||||
packet_->timestamp += 33 * 90;
|
packet_->timestamp += 33 * 90;
|
||||||
packet_->is_first_packet_in_frame = true;
|
packet_->video_header.is_first_packet_in_frame = true;
|
||||||
|
|
||||||
EXPECT_EQ(kIncomplete,
|
EXPECT_EQ(kIncomplete,
|
||||||
jitter_buffer_->InsertPacket(*packet_, &retransmitted));
|
jitter_buffer_->InsertPacket(*packet_, &retransmitted));
|
||||||
|
|||||||
@ -25,13 +25,8 @@ VCMPacket::VCMPacket()
|
|||||||
markerBit(false),
|
markerBit(false),
|
||||||
timesNacked(-1),
|
timesNacked(-1),
|
||||||
frameType(kEmptyFrame),
|
frameType(kEmptyFrame),
|
||||||
codec(kVideoCodecGeneric),
|
|
||||||
is_first_packet_in_frame(false),
|
|
||||||
is_last_packet_in_frame(false),
|
|
||||||
completeNALU(kNaluUnset),
|
completeNALU(kNaluUnset),
|
||||||
insertStartCode(false),
|
insertStartCode(false),
|
||||||
width(0),
|
|
||||||
height(0),
|
|
||||||
video_header(),
|
video_header(),
|
||||||
receive_time_ms(0) {
|
receive_time_ms(0) {
|
||||||
video_header.playout_delay = {-1, -1};
|
video_header.playout_delay = {-1, -1};
|
||||||
@ -49,19 +44,13 @@ VCMPacket::VCMPacket(const uint8_t* ptr,
|
|||||||
markerBit(rtpHeader.header.markerBit),
|
markerBit(rtpHeader.header.markerBit),
|
||||||
timesNacked(-1),
|
timesNacked(-1),
|
||||||
frameType(rtpHeader.frameType),
|
frameType(rtpHeader.frameType),
|
||||||
codec(rtpHeader.video_header().codec),
|
|
||||||
is_first_packet_in_frame(
|
|
||||||
rtpHeader.video_header().is_first_packet_in_frame),
|
|
||||||
is_last_packet_in_frame(rtpHeader.video_header().is_last_packet_in_frame),
|
|
||||||
completeNALU(kNaluIncomplete),
|
completeNALU(kNaluIncomplete),
|
||||||
insertStartCode(rtpHeader.video_header().codec == kVideoCodecH264 &&
|
insertStartCode(rtpHeader.video_header().codec == kVideoCodecH264 &&
|
||||||
rtpHeader.video_header().is_first_packet_in_frame),
|
rtpHeader.video_header().is_first_packet_in_frame),
|
||||||
width(rtpHeader.video_header().width),
|
|
||||||
height(rtpHeader.video_header().height),
|
|
||||||
video_header(rtpHeader.video_header()) {
|
video_header(rtpHeader.video_header()) {
|
||||||
if (is_first_packet_in_frame && markerBit) {
|
if (is_first_packet_in_frame() && markerBit) {
|
||||||
completeNALU = kNaluComplete;
|
completeNALU = kNaluComplete;
|
||||||
} else if (is_first_packet_in_frame) {
|
} else if (is_first_packet_in_frame()) {
|
||||||
completeNALU = kNaluStart;
|
completeNALU = kNaluStart;
|
||||||
} else if (markerBit) {
|
} else if (markerBit) {
|
||||||
completeNALU = kNaluEnd;
|
completeNALU = kNaluEnd;
|
||||||
@ -69,13 +58,9 @@ VCMPacket::VCMPacket(const uint8_t* ptr,
|
|||||||
completeNALU = kNaluIncomplete;
|
completeNALU = kNaluIncomplete;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (markerBit) {
|
// TODO(nisse): Delete?
|
||||||
video_header.rotation = rtpHeader.video_header().rotation;
|
|
||||||
}
|
|
||||||
// Playout decisions are made entirely based on first packet in a frame.
|
// Playout decisions are made entirely based on first packet in a frame.
|
||||||
if (is_first_packet_in_frame) {
|
if (!is_first_packet_in_frame()) {
|
||||||
video_header.playout_delay = rtpHeader.video_header().playout_delay;
|
|
||||||
} else {
|
|
||||||
video_header.playout_delay = {-1, -1};
|
video_header.playout_delay = {-1, -1};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -31,6 +31,17 @@ class VCMPacket {
|
|||||||
|
|
||||||
~VCMPacket();
|
~VCMPacket();
|
||||||
|
|
||||||
|
VideoCodecType codec() const { return video_header.codec; }
|
||||||
|
int width() const { return video_header.width; }
|
||||||
|
int height() const { return video_header.height; }
|
||||||
|
|
||||||
|
bool is_first_packet_in_frame() const {
|
||||||
|
return video_header.is_first_packet_in_frame;
|
||||||
|
}
|
||||||
|
bool is_last_packet_in_frame() const {
|
||||||
|
return video_header.is_last_packet_in_frame;
|
||||||
|
}
|
||||||
|
|
||||||
uint8_t payloadType;
|
uint8_t payloadType;
|
||||||
uint32_t timestamp;
|
uint32_t timestamp;
|
||||||
// NTP time of the capture time in local timebase in milliseconds.
|
// NTP time of the capture time in local timebase in milliseconds.
|
||||||
@ -42,15 +53,10 @@ class VCMPacket {
|
|||||||
int timesNacked;
|
int timesNacked;
|
||||||
|
|
||||||
FrameType frameType;
|
FrameType frameType;
|
||||||
VideoCodecType codec;
|
|
||||||
|
|
||||||
bool is_first_packet_in_frame;
|
|
||||||
bool is_last_packet_in_frame;
|
|
||||||
VCMNaluCompleteness completeNALU; // Default is kNaluIncomplete.
|
VCMNaluCompleteness completeNALU; // Default is kNaluIncomplete.
|
||||||
bool insertStartCode; // True if a start code should be inserted before this
|
bool insertStartCode; // True if a start code should be inserted before this
|
||||||
// packet.
|
// packet.
|
||||||
int width;
|
|
||||||
int height;
|
|
||||||
RTPVideoHeader video_header;
|
RTPVideoHeader video_header;
|
||||||
absl::optional<RtpGenericFrameDescriptor> generic_descriptor;
|
absl::optional<RtpGenericFrameDescriptor> generic_descriptor;
|
||||||
|
|
||||||
|
|||||||
@ -113,8 +113,8 @@ bool PacketBuffer::InsertPacket(VCMPacket* packet) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sequence_buffer_[index].frame_begin = packet->is_first_packet_in_frame;
|
sequence_buffer_[index].frame_begin = packet->is_first_packet_in_frame();
|
||||||
sequence_buffer_[index].frame_end = packet->is_last_packet_in_frame;
|
sequence_buffer_[index].frame_end = packet->is_last_packet_in_frame();
|
||||||
sequence_buffer_[index].seq_num = packet->seqNum;
|
sequence_buffer_[index].seq_num = packet->seqNum;
|
||||||
sequence_buffer_[index].continuous = false;
|
sequence_buffer_[index].continuous = false;
|
||||||
sequence_buffer_[index].frame_created = false;
|
sequence_buffer_[index].frame_created = false;
|
||||||
@ -297,7 +297,7 @@ std::vector<std::unique_ptr<RtpFrameObject>> PacketBuffer::FindFrames(
|
|||||||
int64_t frame_timestamp = data_buffer_[start_index].timestamp;
|
int64_t frame_timestamp = data_buffer_[start_index].timestamp;
|
||||||
|
|
||||||
// Identify H.264 keyframes by means of SPS, PPS, and IDR.
|
// Identify H.264 keyframes by means of SPS, PPS, and IDR.
|
||||||
bool is_h264 = data_buffer_[start_index].codec == kVideoCodecH264;
|
bool is_h264 = data_buffer_[start_index].codec() == kVideoCodecH264;
|
||||||
bool has_h264_sps = false;
|
bool has_h264_sps = false;
|
||||||
bool has_h264_pps = false;
|
bool has_h264_pps = false;
|
||||||
bool has_h264_idr = false;
|
bool has_h264_idr = false;
|
||||||
|
|||||||
@ -82,13 +82,13 @@ class TestRtpFrameReferenceFinder : public ::testing::Test,
|
|||||||
uint16_t seq_num_end,
|
uint16_t seq_num_end,
|
||||||
bool keyframe) {
|
bool keyframe) {
|
||||||
VCMPacket packet;
|
VCMPacket packet;
|
||||||
packet.codec = kVideoCodecGeneric;
|
packet.video_header.codec = kVideoCodecGeneric;
|
||||||
packet.seqNum = seq_num_start;
|
packet.seqNum = seq_num_start;
|
||||||
packet.frameType = keyframe ? kVideoFrameKey : kVideoFrameDelta;
|
packet.frameType = keyframe ? kVideoFrameKey : kVideoFrameDelta;
|
||||||
ref_packet_buffer_->InsertPacket(&packet);
|
ref_packet_buffer_->InsertPacket(&packet);
|
||||||
|
|
||||||
packet.seqNum = seq_num_end;
|
packet.seqNum = seq_num_end;
|
||||||
packet.is_last_packet_in_frame = true;
|
packet.video_header.is_last_packet_in_frame = true;
|
||||||
ref_packet_buffer_->InsertPacket(&packet);
|
ref_packet_buffer_->InsertPacket(&packet);
|
||||||
|
|
||||||
std::unique_ptr<RtpFrameObject> frame(new RtpFrameObject(
|
std::unique_ptr<RtpFrameObject> frame(new RtpFrameObject(
|
||||||
@ -104,9 +104,10 @@ class TestRtpFrameReferenceFinder : public ::testing::Test,
|
|||||||
int32_t tl0 = kNoTl0PicIdx,
|
int32_t tl0 = kNoTl0PicIdx,
|
||||||
bool sync = false) {
|
bool sync = false) {
|
||||||
VCMPacket packet;
|
VCMPacket packet;
|
||||||
packet.codec = kVideoCodecVP8;
|
packet.video_header.codec = kVideoCodecVP8;
|
||||||
packet.seqNum = seq_num_start;
|
packet.seqNum = seq_num_start;
|
||||||
packet.is_last_packet_in_frame = (seq_num_start == seq_num_end);
|
packet.video_header.is_last_packet_in_frame =
|
||||||
|
(seq_num_start == seq_num_end);
|
||||||
packet.frameType = keyframe ? kVideoFrameKey : kVideoFrameDelta;
|
packet.frameType = keyframe ? kVideoFrameKey : kVideoFrameDelta;
|
||||||
auto& vp8_header =
|
auto& vp8_header =
|
||||||
packet.video_header.video_type_header.emplace<RTPVideoHeaderVP8>();
|
packet.video_header.video_type_header.emplace<RTPVideoHeaderVP8>();
|
||||||
@ -118,7 +119,7 @@ class TestRtpFrameReferenceFinder : public ::testing::Test,
|
|||||||
|
|
||||||
if (seq_num_start != seq_num_end) {
|
if (seq_num_start != seq_num_end) {
|
||||||
packet.seqNum = seq_num_end;
|
packet.seqNum = seq_num_end;
|
||||||
packet.is_last_packet_in_frame = true;
|
packet.video_header.is_last_packet_in_frame = true;
|
||||||
ref_packet_buffer_->InsertPacket(&packet);
|
ref_packet_buffer_->InsertPacket(&packet);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -141,9 +142,10 @@ class TestRtpFrameReferenceFinder : public ::testing::Test,
|
|||||||
auto& vp9_header =
|
auto& vp9_header =
|
||||||
packet.video_header.video_type_header.emplace<RTPVideoHeaderVP9>();
|
packet.video_header.video_type_header.emplace<RTPVideoHeaderVP9>();
|
||||||
packet.timestamp = pid;
|
packet.timestamp = pid;
|
||||||
packet.codec = kVideoCodecVP9;
|
packet.video_header.codec = kVideoCodecVP9;
|
||||||
packet.seqNum = seq_num_start;
|
packet.seqNum = seq_num_start;
|
||||||
packet.is_last_packet_in_frame = (seq_num_start == seq_num_end);
|
packet.video_header.is_last_packet_in_frame =
|
||||||
|
(seq_num_start == seq_num_end);
|
||||||
packet.frameType = keyframe ? kVideoFrameKey : kVideoFrameDelta;
|
packet.frameType = keyframe ? kVideoFrameKey : kVideoFrameDelta;
|
||||||
vp9_header.flexible_mode = false;
|
vp9_header.flexible_mode = false;
|
||||||
vp9_header.picture_id = pid % (1 << 15);
|
vp9_header.picture_id = pid % (1 << 15);
|
||||||
@ -159,7 +161,7 @@ class TestRtpFrameReferenceFinder : public ::testing::Test,
|
|||||||
ref_packet_buffer_->InsertPacket(&packet);
|
ref_packet_buffer_->InsertPacket(&packet);
|
||||||
|
|
||||||
if (seq_num_start != seq_num_end) {
|
if (seq_num_start != seq_num_end) {
|
||||||
packet.is_last_packet_in_frame = true;
|
packet.video_header.is_last_packet_in_frame = true;
|
||||||
vp9_header.ss_data_available = false;
|
vp9_header.ss_data_available = false;
|
||||||
packet.seqNum = seq_num_end;
|
packet.seqNum = seq_num_end;
|
||||||
ref_packet_buffer_->InsertPacket(&packet);
|
ref_packet_buffer_->InsertPacket(&packet);
|
||||||
@ -182,9 +184,10 @@ class TestRtpFrameReferenceFinder : public ::testing::Test,
|
|||||||
auto& vp9_header =
|
auto& vp9_header =
|
||||||
packet.video_header.video_type_header.emplace<RTPVideoHeaderVP9>();
|
packet.video_header.video_type_header.emplace<RTPVideoHeaderVP9>();
|
||||||
packet.timestamp = pid;
|
packet.timestamp = pid;
|
||||||
packet.codec = kVideoCodecVP9;
|
packet.video_header.codec = kVideoCodecVP9;
|
||||||
packet.seqNum = seq_num_start;
|
packet.seqNum = seq_num_start;
|
||||||
packet.is_last_packet_in_frame = (seq_num_start == seq_num_end);
|
packet.video_header.is_last_packet_in_frame =
|
||||||
|
(seq_num_start == seq_num_end);
|
||||||
packet.frameType = keyframe ? kVideoFrameKey : kVideoFrameDelta;
|
packet.frameType = keyframe ? kVideoFrameKey : kVideoFrameDelta;
|
||||||
vp9_header.inter_layer_predicted = inter;
|
vp9_header.inter_layer_predicted = inter;
|
||||||
vp9_header.flexible_mode = true;
|
vp9_header.flexible_mode = true;
|
||||||
@ -199,7 +202,7 @@ class TestRtpFrameReferenceFinder : public ::testing::Test,
|
|||||||
|
|
||||||
if (seq_num_start != seq_num_end) {
|
if (seq_num_start != seq_num_end) {
|
||||||
packet.seqNum = seq_num_end;
|
packet.seqNum = seq_num_end;
|
||||||
packet.is_last_packet_in_frame = true;
|
packet.video_header.is_last_packet_in_frame = true;
|
||||||
ref_packet_buffer_->InsertPacket(&packet);
|
ref_packet_buffer_->InsertPacket(&packet);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -354,7 +354,7 @@ VCMSessionInfo::PacketIterator VCMSessionInfo::FindNextPartitionBeginning(
|
|||||||
|
|
||||||
VCMSessionInfo::PacketIterator VCMSessionInfo::FindPartitionEnd(
|
VCMSessionInfo::PacketIterator VCMSessionInfo::FindPartitionEnd(
|
||||||
PacketIterator it) const {
|
PacketIterator it) const {
|
||||||
assert((*it).codec == kVideoCodecVP8);
|
assert((*it).codec() == kVideoCodecVP8);
|
||||||
PacketIterator prev_it = it;
|
PacketIterator prev_it = it;
|
||||||
const int partition_id =
|
const int partition_id =
|
||||||
absl::get<RTPVideoHeaderVP8>((*it).video_header.video_type_header)
|
absl::get<RTPVideoHeaderVP8>((*it).video_header.video_type_header)
|
||||||
@ -450,9 +450,9 @@ int VCMSessionInfo::InsertPacket(const VCMPacket& packet,
|
|||||||
(*rit).sizeBytes > 0)
|
(*rit).sizeBytes > 0)
|
||||||
return -2;
|
return -2;
|
||||||
|
|
||||||
if (packet.codec == kVideoCodecH264) {
|
if (packet.codec() == kVideoCodecH264) {
|
||||||
frame_type_ = packet.frameType;
|
frame_type_ = packet.frameType;
|
||||||
if (packet.is_first_packet_in_frame &&
|
if (packet.is_first_packet_in_frame() &&
|
||||||
(first_packet_seq_num_ == -1 ||
|
(first_packet_seq_num_ == -1 ||
|
||||||
IsNewerSequenceNumber(first_packet_seq_num_, packet.seqNum))) {
|
IsNewerSequenceNumber(first_packet_seq_num_, packet.seqNum))) {
|
||||||
first_packet_seq_num_ = packet.seqNum;
|
first_packet_seq_num_ = packet.seqNum;
|
||||||
@ -468,7 +468,7 @@ int VCMSessionInfo::InsertPacket(const VCMPacket& packet,
|
|||||||
// Placing check here, as to properly account for duplicate packets.
|
// Placing check here, as to properly account for duplicate packets.
|
||||||
// Check if this is first packet (only valid for some codecs)
|
// Check if this is first packet (only valid for some codecs)
|
||||||
// Should only be set for one packet per session.
|
// Should only be set for one packet per session.
|
||||||
if (packet.is_first_packet_in_frame && first_packet_seq_num_ == -1) {
|
if (packet.is_first_packet_in_frame() && first_packet_seq_num_ == -1) {
|
||||||
// The first packet in a frame signals the frame type.
|
// The first packet in a frame signals the frame type.
|
||||||
frame_type_ = packet.frameType;
|
frame_type_ = packet.frameType;
|
||||||
// Store the sequence number for the first packet.
|
// Store the sequence number for the first packet.
|
||||||
|
|||||||
@ -64,7 +64,7 @@ class TestNalUnits : public TestSessionInfo {
|
|||||||
protected:
|
protected:
|
||||||
virtual void SetUp() {
|
virtual void SetUp() {
|
||||||
TestSessionInfo::SetUp();
|
TestSessionInfo::SetUp();
|
||||||
packet_.codec = kVideoCodecVP8;
|
packet_.video_header.codec = kVideoCodecVP8;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool VerifyNalu(int offset, int packets_expected, int start_value) {
|
bool VerifyNalu(int offset, int packets_expected, int start_value) {
|
||||||
@ -113,7 +113,7 @@ class TestNackList : public TestSessionInfo {
|
|||||||
};
|
};
|
||||||
|
|
||||||
TEST_F(TestSessionInfo, TestSimpleAPIs) {
|
TEST_F(TestSessionInfo, TestSimpleAPIs) {
|
||||||
packet_.is_first_packet_in_frame = true;
|
packet_.video_header.is_first_packet_in_frame = true;
|
||||||
packet_.seqNum = 0xFFFE;
|
packet_.seqNum = 0xFFFE;
|
||||||
packet_.sizeBytes = packet_buffer_size();
|
packet_.sizeBytes = packet_buffer_size();
|
||||||
packet_.frameType = kVideoFrameKey;
|
packet_.frameType = kVideoFrameKey;
|
||||||
@ -123,7 +123,7 @@ TEST_F(TestSessionInfo, TestSimpleAPIs) {
|
|||||||
EXPECT_FALSE(session_.HaveLastPacket());
|
EXPECT_FALSE(session_.HaveLastPacket());
|
||||||
EXPECT_EQ(kVideoFrameKey, session_.FrameType());
|
EXPECT_EQ(kVideoFrameKey, session_.FrameType());
|
||||||
|
|
||||||
packet_.is_first_packet_in_frame = false;
|
packet_.video_header.is_first_packet_in_frame = false;
|
||||||
packet_.markerBit = true;
|
packet_.markerBit = true;
|
||||||
packet_.seqNum += 1;
|
packet_.seqNum += 1;
|
||||||
EXPECT_EQ(packet_buffer_size(), static_cast<size_t>(session_.InsertPacket(
|
EXPECT_EQ(packet_buffer_size(), static_cast<size_t>(session_.InsertPacket(
|
||||||
@ -134,7 +134,7 @@ TEST_F(TestSessionInfo, TestSimpleAPIs) {
|
|||||||
|
|
||||||
// Insert empty packet which will be the new high sequence number.
|
// Insert empty packet which will be the new high sequence number.
|
||||||
// To make things more difficult we will make sure to have a wrap here.
|
// To make things more difficult we will make sure to have a wrap here.
|
||||||
packet_.is_first_packet_in_frame = false;
|
packet_.video_header.is_first_packet_in_frame = false;
|
||||||
packet_.markerBit = true;
|
packet_.markerBit = true;
|
||||||
packet_.seqNum = 2;
|
packet_.seqNum = 2;
|
||||||
packet_.sizeBytes = 0;
|
packet_.sizeBytes = 0;
|
||||||
@ -145,13 +145,13 @@ TEST_F(TestSessionInfo, TestSimpleAPIs) {
|
|||||||
|
|
||||||
TEST_F(TestSessionInfo, NormalOperation) {
|
TEST_F(TestSessionInfo, NormalOperation) {
|
||||||
packet_.seqNum = 0xFFFF;
|
packet_.seqNum = 0xFFFF;
|
||||||
packet_.is_first_packet_in_frame = true;
|
packet_.video_header.is_first_packet_in_frame = true;
|
||||||
packet_.markerBit = false;
|
packet_.markerBit = false;
|
||||||
FillPacket(0);
|
FillPacket(0);
|
||||||
EXPECT_EQ(packet_buffer_size(), static_cast<size_t>(session_.InsertPacket(
|
EXPECT_EQ(packet_buffer_size(), static_cast<size_t>(session_.InsertPacket(
|
||||||
packet_, frame_buffer_, frame_data)));
|
packet_, frame_buffer_, frame_data)));
|
||||||
|
|
||||||
packet_.is_first_packet_in_frame = false;
|
packet_.video_header.is_first_packet_in_frame = false;
|
||||||
for (int i = 1; i < 9; ++i) {
|
for (int i = 1; i < 9; ++i) {
|
||||||
packet_.seqNum += 1;
|
packet_.seqNum += 1;
|
||||||
FillPacket(i);
|
FillPacket(i);
|
||||||
@ -174,19 +174,19 @@ TEST_F(TestSessionInfo, NormalOperation) {
|
|||||||
|
|
||||||
TEST_F(TestSessionInfo, OutOfBoundsPackets1PacketFrame) {
|
TEST_F(TestSessionInfo, OutOfBoundsPackets1PacketFrame) {
|
||||||
packet_.seqNum = 0x0001;
|
packet_.seqNum = 0x0001;
|
||||||
packet_.is_first_packet_in_frame = true;
|
packet_.video_header.is_first_packet_in_frame = true;
|
||||||
packet_.markerBit = true;
|
packet_.markerBit = true;
|
||||||
FillPacket(1);
|
FillPacket(1);
|
||||||
EXPECT_EQ(packet_buffer_size(), static_cast<size_t>(session_.InsertPacket(
|
EXPECT_EQ(packet_buffer_size(), static_cast<size_t>(session_.InsertPacket(
|
||||||
packet_, frame_buffer_, frame_data)));
|
packet_, frame_buffer_, frame_data)));
|
||||||
|
|
||||||
packet_.seqNum = 0x0004;
|
packet_.seqNum = 0x0004;
|
||||||
packet_.is_first_packet_in_frame = true;
|
packet_.video_header.is_first_packet_in_frame = true;
|
||||||
packet_.markerBit = true;
|
packet_.markerBit = true;
|
||||||
FillPacket(1);
|
FillPacket(1);
|
||||||
EXPECT_EQ(-3, session_.InsertPacket(packet_, frame_buffer_, frame_data));
|
EXPECT_EQ(-3, session_.InsertPacket(packet_, frame_buffer_, frame_data));
|
||||||
packet_.seqNum = 0x0000;
|
packet_.seqNum = 0x0000;
|
||||||
packet_.is_first_packet_in_frame = false;
|
packet_.video_header.is_first_packet_in_frame = false;
|
||||||
packet_.markerBit = false;
|
packet_.markerBit = false;
|
||||||
FillPacket(1);
|
FillPacket(1);
|
||||||
EXPECT_EQ(-3, session_.InsertPacket(packet_, frame_buffer_, frame_data));
|
EXPECT_EQ(-3, session_.InsertPacket(packet_, frame_buffer_, frame_data));
|
||||||
@ -194,13 +194,13 @@ TEST_F(TestSessionInfo, OutOfBoundsPackets1PacketFrame) {
|
|||||||
|
|
||||||
TEST_F(TestSessionInfo, SetMarkerBitOnce) {
|
TEST_F(TestSessionInfo, SetMarkerBitOnce) {
|
||||||
packet_.seqNum = 0x0005;
|
packet_.seqNum = 0x0005;
|
||||||
packet_.is_first_packet_in_frame = false;
|
packet_.video_header.is_first_packet_in_frame = false;
|
||||||
packet_.markerBit = true;
|
packet_.markerBit = true;
|
||||||
FillPacket(1);
|
FillPacket(1);
|
||||||
EXPECT_EQ(packet_buffer_size(), static_cast<size_t>(session_.InsertPacket(
|
EXPECT_EQ(packet_buffer_size(), static_cast<size_t>(session_.InsertPacket(
|
||||||
packet_, frame_buffer_, frame_data)));
|
packet_, frame_buffer_, frame_data)));
|
||||||
++packet_.seqNum;
|
++packet_.seqNum;
|
||||||
packet_.is_first_packet_in_frame = true;
|
packet_.video_header.is_first_packet_in_frame = true;
|
||||||
packet_.markerBit = true;
|
packet_.markerBit = true;
|
||||||
FillPacket(1);
|
FillPacket(1);
|
||||||
EXPECT_EQ(-3, session_.InsertPacket(packet_, frame_buffer_, frame_data));
|
EXPECT_EQ(-3, session_.InsertPacket(packet_, frame_buffer_, frame_data));
|
||||||
@ -209,25 +209,25 @@ TEST_F(TestSessionInfo, SetMarkerBitOnce) {
|
|||||||
TEST_F(TestSessionInfo, OutOfBoundsPacketsBase) {
|
TEST_F(TestSessionInfo, OutOfBoundsPacketsBase) {
|
||||||
// Allow packets in the range 5-6.
|
// Allow packets in the range 5-6.
|
||||||
packet_.seqNum = 0x0005;
|
packet_.seqNum = 0x0005;
|
||||||
packet_.is_first_packet_in_frame = true;
|
packet_.video_header.is_first_packet_in_frame = true;
|
||||||
packet_.markerBit = false;
|
packet_.markerBit = false;
|
||||||
FillPacket(1);
|
FillPacket(1);
|
||||||
EXPECT_EQ(packet_buffer_size(), static_cast<size_t>(session_.InsertPacket(
|
EXPECT_EQ(packet_buffer_size(), static_cast<size_t>(session_.InsertPacket(
|
||||||
packet_, frame_buffer_, frame_data)));
|
packet_, frame_buffer_, frame_data)));
|
||||||
// Insert an older packet with a first packet set.
|
// Insert an older packet with a first packet set.
|
||||||
packet_.seqNum = 0x0004;
|
packet_.seqNum = 0x0004;
|
||||||
packet_.is_first_packet_in_frame = true;
|
packet_.video_header.is_first_packet_in_frame = true;
|
||||||
packet_.markerBit = true;
|
packet_.markerBit = true;
|
||||||
FillPacket(1);
|
FillPacket(1);
|
||||||
EXPECT_EQ(-3, session_.InsertPacket(packet_, frame_buffer_, frame_data));
|
EXPECT_EQ(-3, session_.InsertPacket(packet_, frame_buffer_, frame_data));
|
||||||
packet_.seqNum = 0x0006;
|
packet_.seqNum = 0x0006;
|
||||||
packet_.is_first_packet_in_frame = true;
|
packet_.video_header.is_first_packet_in_frame = true;
|
||||||
packet_.markerBit = true;
|
packet_.markerBit = true;
|
||||||
FillPacket(1);
|
FillPacket(1);
|
||||||
EXPECT_EQ(packet_buffer_size(), static_cast<size_t>(session_.InsertPacket(
|
EXPECT_EQ(packet_buffer_size(), static_cast<size_t>(session_.InsertPacket(
|
||||||
packet_, frame_buffer_, frame_data)));
|
packet_, frame_buffer_, frame_data)));
|
||||||
packet_.seqNum = 0x0008;
|
packet_.seqNum = 0x0008;
|
||||||
packet_.is_first_packet_in_frame = false;
|
packet_.video_header.is_first_packet_in_frame = false;
|
||||||
packet_.markerBit = true;
|
packet_.markerBit = true;
|
||||||
FillPacket(1);
|
FillPacket(1);
|
||||||
EXPECT_EQ(-3, session_.InsertPacket(packet_, frame_buffer_, frame_data));
|
EXPECT_EQ(-3, session_.InsertPacket(packet_, frame_buffer_, frame_data));
|
||||||
@ -235,31 +235,31 @@ TEST_F(TestSessionInfo, OutOfBoundsPacketsBase) {
|
|||||||
|
|
||||||
TEST_F(TestSessionInfo, OutOfBoundsPacketsWrap) {
|
TEST_F(TestSessionInfo, OutOfBoundsPacketsWrap) {
|
||||||
packet_.seqNum = 0xFFFE;
|
packet_.seqNum = 0xFFFE;
|
||||||
packet_.is_first_packet_in_frame = true;
|
packet_.video_header.is_first_packet_in_frame = true;
|
||||||
packet_.markerBit = false;
|
packet_.markerBit = false;
|
||||||
FillPacket(1);
|
FillPacket(1);
|
||||||
EXPECT_EQ(packet_buffer_size(), static_cast<size_t>(session_.InsertPacket(
|
EXPECT_EQ(packet_buffer_size(), static_cast<size_t>(session_.InsertPacket(
|
||||||
packet_, frame_buffer_, frame_data)));
|
packet_, frame_buffer_, frame_data)));
|
||||||
|
|
||||||
packet_.seqNum = 0x0004;
|
packet_.seqNum = 0x0004;
|
||||||
packet_.is_first_packet_in_frame = false;
|
packet_.video_header.is_first_packet_in_frame = false;
|
||||||
packet_.markerBit = true;
|
packet_.markerBit = true;
|
||||||
FillPacket(1);
|
FillPacket(1);
|
||||||
EXPECT_EQ(packet_buffer_size(), static_cast<size_t>(session_.InsertPacket(
|
EXPECT_EQ(packet_buffer_size(), static_cast<size_t>(session_.InsertPacket(
|
||||||
packet_, frame_buffer_, frame_data)));
|
packet_, frame_buffer_, frame_data)));
|
||||||
packet_.seqNum = 0x0002;
|
packet_.seqNum = 0x0002;
|
||||||
packet_.is_first_packet_in_frame = false;
|
packet_.video_header.is_first_packet_in_frame = false;
|
||||||
packet_.markerBit = false;
|
packet_.markerBit = false;
|
||||||
FillPacket(1);
|
FillPacket(1);
|
||||||
ASSERT_EQ(packet_buffer_size(), static_cast<size_t>(session_.InsertPacket(
|
ASSERT_EQ(packet_buffer_size(), static_cast<size_t>(session_.InsertPacket(
|
||||||
packet_, frame_buffer_, frame_data)));
|
packet_, frame_buffer_, frame_data)));
|
||||||
packet_.seqNum = 0xFFF0;
|
packet_.seqNum = 0xFFF0;
|
||||||
packet_.is_first_packet_in_frame = false;
|
packet_.video_header.is_first_packet_in_frame = false;
|
||||||
packet_.markerBit = false;
|
packet_.markerBit = false;
|
||||||
FillPacket(1);
|
FillPacket(1);
|
||||||
EXPECT_EQ(-3, session_.InsertPacket(packet_, frame_buffer_, frame_data));
|
EXPECT_EQ(-3, session_.InsertPacket(packet_, frame_buffer_, frame_data));
|
||||||
packet_.seqNum = 0x0006;
|
packet_.seqNum = 0x0006;
|
||||||
packet_.is_first_packet_in_frame = false;
|
packet_.video_header.is_first_packet_in_frame = false;
|
||||||
packet_.markerBit = false;
|
packet_.markerBit = false;
|
||||||
FillPacket(1);
|
FillPacket(1);
|
||||||
EXPECT_EQ(-3, session_.InsertPacket(packet_, frame_buffer_, frame_data));
|
EXPECT_EQ(-3, session_.InsertPacket(packet_, frame_buffer_, frame_data));
|
||||||
@ -269,45 +269,45 @@ TEST_F(TestSessionInfo, OutOfBoundsOutOfOrder) {
|
|||||||
// Insert out of bound regular packets, and then the first and last packet.
|
// Insert out of bound regular packets, and then the first and last packet.
|
||||||
// Verify that correct bounds are maintained.
|
// Verify that correct bounds are maintained.
|
||||||
packet_.seqNum = 0x0003;
|
packet_.seqNum = 0x0003;
|
||||||
packet_.is_first_packet_in_frame = false;
|
packet_.video_header.is_first_packet_in_frame = false;
|
||||||
packet_.markerBit = false;
|
packet_.markerBit = false;
|
||||||
FillPacket(1);
|
FillPacket(1);
|
||||||
EXPECT_EQ(packet_buffer_size(), static_cast<size_t>(session_.InsertPacket(
|
EXPECT_EQ(packet_buffer_size(), static_cast<size_t>(session_.InsertPacket(
|
||||||
packet_, frame_buffer_, frame_data)));
|
packet_, frame_buffer_, frame_data)));
|
||||||
// Insert an older packet with a first packet set.
|
// Insert an older packet with a first packet set.
|
||||||
packet_.seqNum = 0x0005;
|
packet_.seqNum = 0x0005;
|
||||||
packet_.is_first_packet_in_frame = true;
|
packet_.video_header.is_first_packet_in_frame = true;
|
||||||
packet_.markerBit = false;
|
packet_.markerBit = false;
|
||||||
FillPacket(1);
|
FillPacket(1);
|
||||||
EXPECT_EQ(packet_buffer_size(), static_cast<size_t>(session_.InsertPacket(
|
EXPECT_EQ(packet_buffer_size(), static_cast<size_t>(session_.InsertPacket(
|
||||||
packet_, frame_buffer_, frame_data)));
|
packet_, frame_buffer_, frame_data)));
|
||||||
packet_.seqNum = 0x0004;
|
packet_.seqNum = 0x0004;
|
||||||
packet_.is_first_packet_in_frame = false;
|
packet_.video_header.is_first_packet_in_frame = false;
|
||||||
packet_.markerBit = false;
|
packet_.markerBit = false;
|
||||||
FillPacket(1);
|
FillPacket(1);
|
||||||
EXPECT_EQ(-3, session_.InsertPacket(packet_, frame_buffer_, frame_data));
|
EXPECT_EQ(-3, session_.InsertPacket(packet_, frame_buffer_, frame_data));
|
||||||
packet_.seqNum = 0x0010;
|
packet_.seqNum = 0x0010;
|
||||||
packet_.is_first_packet_in_frame = false;
|
packet_.video_header.is_first_packet_in_frame = false;
|
||||||
packet_.markerBit = false;
|
packet_.markerBit = false;
|
||||||
FillPacket(1);
|
FillPacket(1);
|
||||||
EXPECT_EQ(packet_buffer_size(), static_cast<size_t>(session_.InsertPacket(
|
EXPECT_EQ(packet_buffer_size(), static_cast<size_t>(session_.InsertPacket(
|
||||||
packet_, frame_buffer_, frame_data)));
|
packet_, frame_buffer_, frame_data)));
|
||||||
packet_.seqNum = 0x0008;
|
packet_.seqNum = 0x0008;
|
||||||
packet_.is_first_packet_in_frame = false;
|
packet_.video_header.is_first_packet_in_frame = false;
|
||||||
packet_.markerBit = true;
|
packet_.markerBit = true;
|
||||||
FillPacket(1);
|
FillPacket(1);
|
||||||
EXPECT_EQ(packet_buffer_size(), static_cast<size_t>(session_.InsertPacket(
|
EXPECT_EQ(packet_buffer_size(), static_cast<size_t>(session_.InsertPacket(
|
||||||
packet_, frame_buffer_, frame_data)));
|
packet_, frame_buffer_, frame_data)));
|
||||||
|
|
||||||
packet_.seqNum = 0x0009;
|
packet_.seqNum = 0x0009;
|
||||||
packet_.is_first_packet_in_frame = false;
|
packet_.video_header.is_first_packet_in_frame = false;
|
||||||
packet_.markerBit = false;
|
packet_.markerBit = false;
|
||||||
FillPacket(1);
|
FillPacket(1);
|
||||||
EXPECT_EQ(-3, session_.InsertPacket(packet_, frame_buffer_, frame_data));
|
EXPECT_EQ(-3, session_.InsertPacket(packet_, frame_buffer_, frame_data));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(TestNalUnits, OnlyReceivedEmptyPacket) {
|
TEST_F(TestNalUnits, OnlyReceivedEmptyPacket) {
|
||||||
packet_.is_first_packet_in_frame = false;
|
packet_.video_header.is_first_packet_in_frame = false;
|
||||||
packet_.completeNALU = kNaluComplete;
|
packet_.completeNALU = kNaluComplete;
|
||||||
packet_.frameType = kEmptyFrame;
|
packet_.frameType = kEmptyFrame;
|
||||||
packet_.sizeBytes = 0;
|
packet_.sizeBytes = 0;
|
||||||
@ -320,7 +320,7 @@ TEST_F(TestNalUnits, OnlyReceivedEmptyPacket) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(TestNalUnits, OneIsolatedNaluLoss) {
|
TEST_F(TestNalUnits, OneIsolatedNaluLoss) {
|
||||||
packet_.is_first_packet_in_frame = true;
|
packet_.video_header.is_first_packet_in_frame = true;
|
||||||
packet_.completeNALU = kNaluComplete;
|
packet_.completeNALU = kNaluComplete;
|
||||||
packet_.seqNum = 0;
|
packet_.seqNum = 0;
|
||||||
packet_.markerBit = false;
|
packet_.markerBit = false;
|
||||||
@ -328,7 +328,7 @@ TEST_F(TestNalUnits, OneIsolatedNaluLoss) {
|
|||||||
EXPECT_EQ(packet_buffer_size(), static_cast<size_t>(session_.InsertPacket(
|
EXPECT_EQ(packet_buffer_size(), static_cast<size_t>(session_.InsertPacket(
|
||||||
packet_, frame_buffer_, frame_data)));
|
packet_, frame_buffer_, frame_data)));
|
||||||
|
|
||||||
packet_.is_first_packet_in_frame = false;
|
packet_.video_header.is_first_packet_in_frame = false;
|
||||||
packet_.completeNALU = kNaluComplete;
|
packet_.completeNALU = kNaluComplete;
|
||||||
packet_.seqNum += 2;
|
packet_.seqNum += 2;
|
||||||
packet_.markerBit = true;
|
packet_.markerBit = true;
|
||||||
@ -345,7 +345,7 @@ TEST_F(TestNalUnits, OneIsolatedNaluLoss) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(TestNalUnits, LossInMiddleOfNalu) {
|
TEST_F(TestNalUnits, LossInMiddleOfNalu) {
|
||||||
packet_.is_first_packet_in_frame = true;
|
packet_.video_header.is_first_packet_in_frame = true;
|
||||||
packet_.completeNALU = kNaluComplete;
|
packet_.completeNALU = kNaluComplete;
|
||||||
packet_.seqNum = 0;
|
packet_.seqNum = 0;
|
||||||
packet_.markerBit = false;
|
packet_.markerBit = false;
|
||||||
@ -353,7 +353,7 @@ TEST_F(TestNalUnits, LossInMiddleOfNalu) {
|
|||||||
EXPECT_EQ(packet_buffer_size(), static_cast<size_t>(session_.InsertPacket(
|
EXPECT_EQ(packet_buffer_size(), static_cast<size_t>(session_.InsertPacket(
|
||||||
packet_, frame_buffer_, frame_data)));
|
packet_, frame_buffer_, frame_data)));
|
||||||
|
|
||||||
packet_.is_first_packet_in_frame = false;
|
packet_.video_header.is_first_packet_in_frame = false;
|
||||||
packet_.completeNALU = kNaluEnd;
|
packet_.completeNALU = kNaluEnd;
|
||||||
packet_.seqNum += 2;
|
packet_.seqNum += 2;
|
||||||
packet_.markerBit = true;
|
packet_.markerBit = true;
|
||||||
@ -368,7 +368,7 @@ TEST_F(TestNalUnits, LossInMiddleOfNalu) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(TestNalUnits, StartAndEndOfLastNalUnitLost) {
|
TEST_F(TestNalUnits, StartAndEndOfLastNalUnitLost) {
|
||||||
packet_.is_first_packet_in_frame = true;
|
packet_.video_header.is_first_packet_in_frame = true;
|
||||||
packet_.completeNALU = kNaluComplete;
|
packet_.completeNALU = kNaluComplete;
|
||||||
packet_.seqNum = 0;
|
packet_.seqNum = 0;
|
||||||
packet_.markerBit = false;
|
packet_.markerBit = false;
|
||||||
@ -376,7 +376,7 @@ TEST_F(TestNalUnits, StartAndEndOfLastNalUnitLost) {
|
|||||||
EXPECT_EQ(packet_buffer_size(), static_cast<size_t>(session_.InsertPacket(
|
EXPECT_EQ(packet_buffer_size(), static_cast<size_t>(session_.InsertPacket(
|
||||||
packet_, frame_buffer_, frame_data)));
|
packet_, frame_buffer_, frame_data)));
|
||||||
|
|
||||||
packet_.is_first_packet_in_frame = false;
|
packet_.video_header.is_first_packet_in_frame = false;
|
||||||
packet_.completeNALU = kNaluIncomplete;
|
packet_.completeNALU = kNaluIncomplete;
|
||||||
packet_.seqNum += 2;
|
packet_.seqNum += 2;
|
||||||
packet_.markerBit = false;
|
packet_.markerBit = false;
|
||||||
@ -392,7 +392,7 @@ TEST_F(TestNalUnits, StartAndEndOfLastNalUnitLost) {
|
|||||||
|
|
||||||
TEST_F(TestNalUnits, ReorderWrapNoLoss) {
|
TEST_F(TestNalUnits, ReorderWrapNoLoss) {
|
||||||
packet_.seqNum = 0xFFFF;
|
packet_.seqNum = 0xFFFF;
|
||||||
packet_.is_first_packet_in_frame = false;
|
packet_.video_header.is_first_packet_in_frame = false;
|
||||||
packet_.completeNALU = kNaluIncomplete;
|
packet_.completeNALU = kNaluIncomplete;
|
||||||
packet_.seqNum += 1;
|
packet_.seqNum += 1;
|
||||||
packet_.markerBit = false;
|
packet_.markerBit = false;
|
||||||
@ -400,7 +400,7 @@ TEST_F(TestNalUnits, ReorderWrapNoLoss) {
|
|||||||
EXPECT_EQ(packet_buffer_size(), static_cast<size_t>(session_.InsertPacket(
|
EXPECT_EQ(packet_buffer_size(), static_cast<size_t>(session_.InsertPacket(
|
||||||
packet_, frame_buffer_, frame_data)));
|
packet_, frame_buffer_, frame_data)));
|
||||||
|
|
||||||
packet_.is_first_packet_in_frame = true;
|
packet_.video_header.is_first_packet_in_frame = true;
|
||||||
packet_.completeNALU = kNaluComplete;
|
packet_.completeNALU = kNaluComplete;
|
||||||
packet_.seqNum -= 1;
|
packet_.seqNum -= 1;
|
||||||
packet_.markerBit = false;
|
packet_.markerBit = false;
|
||||||
@ -408,7 +408,7 @@ TEST_F(TestNalUnits, ReorderWrapNoLoss) {
|
|||||||
EXPECT_EQ(packet_buffer_size(), static_cast<size_t>(session_.InsertPacket(
|
EXPECT_EQ(packet_buffer_size(), static_cast<size_t>(session_.InsertPacket(
|
||||||
packet_, frame_buffer_, frame_data)));
|
packet_, frame_buffer_, frame_data)));
|
||||||
|
|
||||||
packet_.is_first_packet_in_frame = false;
|
packet_.video_header.is_first_packet_in_frame = false;
|
||||||
packet_.completeNALU = kNaluEnd;
|
packet_.completeNALU = kNaluEnd;
|
||||||
packet_.seqNum += 2;
|
packet_.seqNum += 2;
|
||||||
packet_.markerBit = true;
|
packet_.markerBit = true;
|
||||||
@ -424,14 +424,14 @@ TEST_F(TestNalUnits, ReorderWrapNoLoss) {
|
|||||||
|
|
||||||
TEST_F(TestNalUnits, WrapLosses) {
|
TEST_F(TestNalUnits, WrapLosses) {
|
||||||
packet_.seqNum = 0xFFFF;
|
packet_.seqNum = 0xFFFF;
|
||||||
packet_.is_first_packet_in_frame = false;
|
packet_.video_header.is_first_packet_in_frame = false;
|
||||||
packet_.completeNALU = kNaluIncomplete;
|
packet_.completeNALU = kNaluIncomplete;
|
||||||
packet_.markerBit = false;
|
packet_.markerBit = false;
|
||||||
FillPacket(1);
|
FillPacket(1);
|
||||||
EXPECT_EQ(packet_buffer_size(), static_cast<size_t>(session_.InsertPacket(
|
EXPECT_EQ(packet_buffer_size(), static_cast<size_t>(session_.InsertPacket(
|
||||||
packet_, frame_buffer_, frame_data)));
|
packet_, frame_buffer_, frame_data)));
|
||||||
|
|
||||||
packet_.is_first_packet_in_frame = false;
|
packet_.video_header.is_first_packet_in_frame = false;
|
||||||
packet_.completeNALU = kNaluEnd;
|
packet_.completeNALU = kNaluEnd;
|
||||||
packet_.seqNum += 2;
|
packet_.seqNum += 2;
|
||||||
packet_.markerBit = true;
|
packet_.markerBit = true;
|
||||||
@ -446,7 +446,7 @@ TEST_F(TestNalUnits, WrapLosses) {
|
|||||||
TEST_F(TestNalUnits, ReorderWrapLosses) {
|
TEST_F(TestNalUnits, ReorderWrapLosses) {
|
||||||
packet_.seqNum = 0xFFFF;
|
packet_.seqNum = 0xFFFF;
|
||||||
|
|
||||||
packet_.is_first_packet_in_frame = false;
|
packet_.video_header.is_first_packet_in_frame = false;
|
||||||
packet_.completeNALU = kNaluEnd;
|
packet_.completeNALU = kNaluEnd;
|
||||||
packet_.seqNum += 2;
|
packet_.seqNum += 2;
|
||||||
packet_.markerBit = true;
|
packet_.markerBit = true;
|
||||||
@ -455,7 +455,7 @@ TEST_F(TestNalUnits, ReorderWrapLosses) {
|
|||||||
packet_, frame_buffer_, frame_data)));
|
packet_, frame_buffer_, frame_data)));
|
||||||
|
|
||||||
packet_.seqNum -= 2;
|
packet_.seqNum -= 2;
|
||||||
packet_.is_first_packet_in_frame = false;
|
packet_.video_header.is_first_packet_in_frame = false;
|
||||||
packet_.completeNALU = kNaluIncomplete;
|
packet_.completeNALU = kNaluIncomplete;
|
||||||
packet_.markerBit = false;
|
packet_.markerBit = false;
|
||||||
FillPacket(1);
|
FillPacket(1);
|
||||||
|
|||||||
@ -60,11 +60,11 @@ VCMPacket StreamGenerator::GeneratePacket(uint16_t sequence_number,
|
|||||||
packet.seqNum = sequence_number;
|
packet.seqNum = sequence_number;
|
||||||
packet.timestamp = timestamp;
|
packet.timestamp = timestamp;
|
||||||
packet.frameType = type;
|
packet.frameType = type;
|
||||||
packet.is_first_packet_in_frame = first_packet;
|
packet.video_header.is_first_packet_in_frame = first_packet;
|
||||||
packet.markerBit = marker_bit;
|
packet.markerBit = marker_bit;
|
||||||
packet.sizeBytes = size;
|
packet.sizeBytes = size;
|
||||||
packet.dataPtr = packet_buffer_;
|
packet.dataPtr = packet_buffer_;
|
||||||
if (packet.is_first_packet_in_frame)
|
if (packet.is_first_packet_in_frame())
|
||||||
packet.completeNALU = kNaluStart;
|
packet.completeNALU = kNaluStart;
|
||||||
else if (packet.markerBit)
|
else if (packet.markerBit)
|
||||||
packet.completeNALU = kNaluEnd;
|
packet.completeNALU = kNaluEnd;
|
||||||
|
|||||||
@ -62,13 +62,13 @@ class TestPacketBuffer : public ::testing::Test,
|
|||||||
uint8_t* data = nullptr, // data pointer
|
uint8_t* data = nullptr, // data pointer
|
||||||
uint32_t timestamp = 123u) { // rtp timestamp
|
uint32_t timestamp = 123u) { // rtp timestamp
|
||||||
VCMPacket packet;
|
VCMPacket packet;
|
||||||
packet.codec = kVideoCodecGeneric;
|
packet.video_header.codec = kVideoCodecGeneric;
|
||||||
packet.timestamp = timestamp;
|
packet.timestamp = timestamp;
|
||||||
packet.seqNum = seq_num;
|
packet.seqNum = seq_num;
|
||||||
packet.frameType =
|
packet.frameType =
|
||||||
keyframe == kKeyFrame ? kVideoFrameKey : kVideoFrameDelta;
|
keyframe == kKeyFrame ? kVideoFrameKey : kVideoFrameDelta;
|
||||||
packet.is_first_packet_in_frame = first == kFirst;
|
packet.video_header.is_first_packet_in_frame = first == kFirst;
|
||||||
packet.is_last_packet_in_frame = last == kLast;
|
packet.video_header.is_last_packet_in_frame = last == kLast;
|
||||||
packet.sizeBytes = data_size;
|
packet.sizeBytes = data_size;
|
||||||
packet.dataPtr = data;
|
packet.dataPtr = data;
|
||||||
|
|
||||||
@ -161,17 +161,17 @@ TEST_F(TestPacketBuffer, NackCount) {
|
|||||||
const uint16_t seq_num = Rand();
|
const uint16_t seq_num = Rand();
|
||||||
|
|
||||||
VCMPacket packet;
|
VCMPacket packet;
|
||||||
packet.codec = kVideoCodecGeneric;
|
packet.video_header.codec = kVideoCodecGeneric;
|
||||||
packet.seqNum = seq_num;
|
packet.seqNum = seq_num;
|
||||||
packet.frameType = kVideoFrameKey;
|
packet.frameType = kVideoFrameKey;
|
||||||
packet.is_first_packet_in_frame = true;
|
packet.video_header.is_first_packet_in_frame = true;
|
||||||
packet.is_last_packet_in_frame = false;
|
packet.video_header.is_last_packet_in_frame = false;
|
||||||
packet.timesNacked = 0;
|
packet.timesNacked = 0;
|
||||||
|
|
||||||
packet_buffer_->InsertPacket(&packet);
|
packet_buffer_->InsertPacket(&packet);
|
||||||
|
|
||||||
packet.seqNum++;
|
packet.seqNum++;
|
||||||
packet.is_first_packet_in_frame = false;
|
packet.video_header.is_first_packet_in_frame = false;
|
||||||
packet.timesNacked = 1;
|
packet.timesNacked = 1;
|
||||||
packet_buffer_->InsertPacket(&packet);
|
packet_buffer_->InsertPacket(&packet);
|
||||||
|
|
||||||
@ -180,7 +180,7 @@ TEST_F(TestPacketBuffer, NackCount) {
|
|||||||
packet_buffer_->InsertPacket(&packet);
|
packet_buffer_->InsertPacket(&packet);
|
||||||
|
|
||||||
packet.seqNum++;
|
packet.seqNum++;
|
||||||
packet.is_last_packet_in_frame = true;
|
packet.video_header.is_last_packet_in_frame = true;
|
||||||
packet.timesNacked = 1;
|
packet.timesNacked = 1;
|
||||||
packet_buffer_->InsertPacket(&packet);
|
packet_buffer_->InsertPacket(&packet);
|
||||||
|
|
||||||
@ -547,7 +547,7 @@ class TestPacketBufferH264 : public TestPacketBuffer {
|
|||||||
int data_size = 0, // size of data
|
int data_size = 0, // size of data
|
||||||
uint8_t* data = nullptr) { // data pointer
|
uint8_t* data = nullptr) { // data pointer
|
||||||
VCMPacket packet;
|
VCMPacket packet;
|
||||||
packet.codec = kVideoCodecH264;
|
packet.video_header.codec = kVideoCodecH264;
|
||||||
auto& h264_header =
|
auto& h264_header =
|
||||||
packet.video_header.video_type_header.emplace<RTPVideoHeaderH264>();
|
packet.video_header.video_type_header.emplace<RTPVideoHeaderH264>();
|
||||||
packet.seqNum = seq_num;
|
packet.seqNum = seq_num;
|
||||||
@ -563,8 +563,8 @@ class TestPacketBufferH264 : public TestPacketBuffer {
|
|||||||
h264_header.nalus_length = 1;
|
h264_header.nalus_length = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
packet.is_first_packet_in_frame = first == kFirst;
|
packet.video_header.is_first_packet_in_frame = first == kFirst;
|
||||||
packet.is_last_packet_in_frame = last == kLast;
|
packet.video_header.is_last_packet_in_frame = last == kLast;
|
||||||
packet.sizeBytes = data_size;
|
packet.sizeBytes = data_size;
|
||||||
packet.dataPtr = data;
|
packet.dataPtr = data;
|
||||||
|
|
||||||
@ -634,12 +634,12 @@ TEST_P(TestPacketBufferH264Parameterized, GetBitstreamBufferPadding) {
|
|||||||
h264_header.nalus[0].type = H264::NaluType::kIdr;
|
h264_header.nalus[0].type = H264::NaluType::kIdr;
|
||||||
h264_header.packetization_type = kH264SingleNalu;
|
h264_header.packetization_type = kH264SingleNalu;
|
||||||
packet.seqNum = seq_num;
|
packet.seqNum = seq_num;
|
||||||
packet.codec = kVideoCodecH264;
|
packet.video_header.codec = kVideoCodecH264;
|
||||||
packet.insertStartCode = true;
|
packet.insertStartCode = true;
|
||||||
packet.dataPtr = data;
|
packet.dataPtr = data;
|
||||||
packet.sizeBytes = sizeof(data_data);
|
packet.sizeBytes = sizeof(data_data);
|
||||||
packet.is_first_packet_in_frame = true;
|
packet.video_header.is_first_packet_in_frame = true;
|
||||||
packet.is_last_packet_in_frame = true;
|
packet.video_header.is_last_packet_in_frame = true;
|
||||||
packet_buffer_->InsertPacket(&packet);
|
packet_buffer_->InsertPacket(&packet);
|
||||||
|
|
||||||
ASSERT_EQ(1UL, frames_from_callback_.size());
|
ASSERT_EQ(1UL, frames_from_callback_.size());
|
||||||
@ -779,18 +779,19 @@ TEST_F(TestPacketBuffer, PacketTimestamps) {
|
|||||||
|
|
||||||
TEST_F(TestPacketBuffer, IncomingCodecChange) {
|
TEST_F(TestPacketBuffer, IncomingCodecChange) {
|
||||||
VCMPacket packet;
|
VCMPacket packet;
|
||||||
packet.is_first_packet_in_frame = true;
|
packet.video_header.is_first_packet_in_frame = true;
|
||||||
packet.is_last_packet_in_frame = true;
|
packet.video_header.is_last_packet_in_frame = true;
|
||||||
packet.sizeBytes = 0;
|
packet.sizeBytes = 0;
|
||||||
packet.dataPtr = nullptr;
|
packet.dataPtr = nullptr;
|
||||||
|
|
||||||
packet.codec = kVideoCodecVP8;
|
packet.video_header.codec = kVideoCodecVP8;
|
||||||
|
packet.video_header.video_type_header.emplace<RTPVideoHeaderVP8>();
|
||||||
packet.timestamp = 1;
|
packet.timestamp = 1;
|
||||||
packet.seqNum = 1;
|
packet.seqNum = 1;
|
||||||
packet.frameType = kVideoFrameKey;
|
packet.frameType = kVideoFrameKey;
|
||||||
EXPECT_TRUE(packet_buffer_->InsertPacket(&packet));
|
EXPECT_TRUE(packet_buffer_->InsertPacket(&packet));
|
||||||
|
|
||||||
packet.codec = kVideoCodecH264;
|
packet.video_header.codec = kVideoCodecH264;
|
||||||
auto& h264_header =
|
auto& h264_header =
|
||||||
packet.video_header.video_type_header.emplace<RTPVideoHeaderH264>();
|
packet.video_header.video_type_header.emplace<RTPVideoHeaderH264>();
|
||||||
h264_header.nalus_length = 1;
|
h264_header.nalus_length = 1;
|
||||||
@ -798,7 +799,8 @@ TEST_F(TestPacketBuffer, IncomingCodecChange) {
|
|||||||
packet.seqNum = 3;
|
packet.seqNum = 3;
|
||||||
EXPECT_TRUE(packet_buffer_->InsertPacket(&packet));
|
EXPECT_TRUE(packet_buffer_->InsertPacket(&packet));
|
||||||
|
|
||||||
packet.codec = kVideoCodecVP8;
|
packet.video_header.codec = kVideoCodecVP8;
|
||||||
|
packet.video_header.video_type_header.emplace<RTPVideoHeaderVP8>();
|
||||||
packet.timestamp = 2;
|
packet.timestamp = 2;
|
||||||
packet.seqNum = 2;
|
packet.seqNum = 2;
|
||||||
packet.frameType = kVideoFrameDelta;
|
packet.frameType = kVideoFrameDelta;
|
||||||
@ -810,12 +812,12 @@ TEST_F(TestPacketBuffer, IncomingCodecChange) {
|
|||||||
|
|
||||||
TEST_F(TestPacketBuffer, TooManyNalusInPacket) {
|
TEST_F(TestPacketBuffer, TooManyNalusInPacket) {
|
||||||
VCMPacket packet;
|
VCMPacket packet;
|
||||||
packet.codec = kVideoCodecH264;
|
packet.video_header.codec = kVideoCodecH264;
|
||||||
packet.timestamp = 1;
|
packet.timestamp = 1;
|
||||||
packet.seqNum = 1;
|
packet.seqNum = 1;
|
||||||
packet.frameType = kVideoFrameKey;
|
packet.frameType = kVideoFrameKey;
|
||||||
packet.is_first_packet_in_frame = true;
|
packet.video_header.is_first_packet_in_frame = true;
|
||||||
packet.is_last_packet_in_frame = true;
|
packet.video_header.is_last_packet_in_frame = true;
|
||||||
auto& h264_header =
|
auto& h264_header =
|
||||||
packet.video_header.video_type_header.emplace<RTPVideoHeaderH264>();
|
packet.video_header.video_type_header.emplace<RTPVideoHeaderH264>();
|
||||||
h264_header.nalus_length = kMaxNalusPerPacket;
|
h264_header.nalus_length = kMaxNalusPerPacket;
|
||||||
@ -895,11 +897,11 @@ class TestPacketBufferH264XIsKeyframe : public TestPacketBufferH264 {
|
|||||||
|
|
||||||
explicit TestPacketBufferH264XIsKeyframe(bool sps_pps_idr_is_keyframe)
|
explicit TestPacketBufferH264XIsKeyframe(bool sps_pps_idr_is_keyframe)
|
||||||
: TestPacketBufferH264(sps_pps_idr_is_keyframe) {
|
: TestPacketBufferH264(sps_pps_idr_is_keyframe) {
|
||||||
packet_.codec = kVideoCodecH264;
|
packet_.video_header.codec = kVideoCodecH264;
|
||||||
packet_.seqNum = kSeqNum;
|
packet_.seqNum = kSeqNum;
|
||||||
|
|
||||||
packet_.is_first_packet_in_frame = true;
|
packet_.video_header.is_first_packet_in_frame = true;
|
||||||
packet_.is_last_packet_in_frame = true;
|
packet_.video_header.is_last_packet_in_frame = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
VCMPacket packet_;
|
VCMPacket packet_;
|
||||||
|
|||||||
@ -80,7 +80,20 @@ class FuzzyPacketBuffer : public video_coding::PacketBuffer {
|
|||||||
return &packet_it->second;
|
return &packet_it->second;
|
||||||
|
|
||||||
VCMPacket* packet = &packets[seq_num];
|
VCMPacket* packet = &packets[seq_num];
|
||||||
packet->codec = codec;
|
packet->video_header.codec = codec;
|
||||||
|
switch (codec) {
|
||||||
|
case kVideoCodecVP8:
|
||||||
|
packet->video_header.video_type_header.emplace<RTPVideoHeaderVP8>();
|
||||||
|
break;
|
||||||
|
case kVideoCodecVP9:
|
||||||
|
packet->video_header.video_type_header.emplace<RTPVideoHeaderVP9>();
|
||||||
|
break;
|
||||||
|
case kVideoCodecH264:
|
||||||
|
packet->video_header.video_type_header.emplace<RTPVideoHeaderH264>();
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
RTC_NOTREACHED();
|
||||||
|
}
|
||||||
packet->markerBit = true;
|
packet->markerBit = true;
|
||||||
reader->CopyTo(packet, sizeof(packet));
|
reader->CopyTo(packet, sizeof(packet));
|
||||||
return packet;
|
return packet;
|
||||||
|
|||||||
@ -79,13 +79,13 @@ class BufferedFrameDecryptorTest
|
|||||||
seq_num_++;
|
seq_num_++;
|
||||||
|
|
||||||
VCMPacket packet;
|
VCMPacket packet;
|
||||||
packet.codec = kVideoCodecGeneric;
|
packet.video_header.codec = kVideoCodecGeneric;
|
||||||
packet.seqNum = seq_num_;
|
packet.seqNum = seq_num_;
|
||||||
packet.frameType = key_frame ? kVideoFrameKey : kVideoFrameDelta;
|
packet.frameType = key_frame ? kVideoFrameKey : kVideoFrameDelta;
|
||||||
packet.generic_descriptor = RtpGenericFrameDescriptor();
|
packet.generic_descriptor = RtpGenericFrameDescriptor();
|
||||||
fake_packet_buffer_->InsertPacket(&packet);
|
fake_packet_buffer_->InsertPacket(&packet);
|
||||||
packet.seqNum = seq_num_;
|
packet.seqNum = seq_num_;
|
||||||
packet.is_last_packet_in_frame = true;
|
packet.video_header.is_last_packet_in_frame = true;
|
||||||
fake_packet_buffer_->InsertPacket(&packet);
|
fake_packet_buffer_->InsertPacket(&packet);
|
||||||
|
|
||||||
return std::unique_ptr<video_coding::RtpFrameObject>(
|
return std::unique_ptr<video_coding::RtpFrameObject>(
|
||||||
|
|||||||
@ -252,7 +252,7 @@ int32_t RtpVideoStreamReceiver::OnReceivedPayloadData(
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (packet.codec == kVideoCodecH264) {
|
if (packet.codec() == kVideoCodecH264) {
|
||||||
// Only when we start to receive packets will we know what payload type
|
// Only when we start to receive packets will we know what payload type
|
||||||
// that will be used. When we know the payload type insert the correct
|
// that will be used. When we know the payload type insert the correct
|
||||||
// sps/pps into the tracker.
|
// sps/pps into the tracker.
|
||||||
|
|||||||
Reference in New Issue
Block a user