Move frame_type member from RtpDepacketizer::ParsedPayload to RTPVideoHeader

The latter is also a member of the former. This cleanup is also
a preparation for dropping WebRtcRTPHeader::frameType (or deleting
WebRtcRTPHeader right away), now that it's a video-specific member.


Tbr: kwiberg@webrtc.org # Comment change in modules/include/
Bug: None
Change-Id: I5c1f3f981f0d750713fc9b9b145278150fe32b5d
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/133024
Commit-Queue: Niels Moller <nisse@webrtc.org>
Reviewed-by: Åsa Persson <asapersson@webrtc.org>
Reviewed-by: Danil Chapovalov <danilchap@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#27740}
This commit is contained in:
Niels Möller
2019-04-24 09:41:16 +02:00
committed by Commit Bot
parent a1e4fbb253
commit abbc50e9b2
31 changed files with 200 additions and 187 deletions

View File

@ -37,7 +37,7 @@ TEST(TestDecodingState, FrameContinuity) {
packet.video_header.is_first_packet_in_frame = true;
packet.timestamp = 1;
packet.seqNum = 0xffff;
packet.frameType = VideoFrameType::kVideoFrameDelta;
packet.video_header.frame_type = VideoFrameType::kVideoFrameDelta;
packet.video_header.codec = kVideoCodecVP8;
auto& vp8_header =
packet.video_header.video_type_header.emplace<RTPVideoHeaderVP8>();
@ -49,12 +49,12 @@ TEST(TestDecodingState, FrameContinuity) {
// Always start with a key frame.
dec_state.Reset();
EXPECT_FALSE(dec_state.ContinuousFrame(&frame));
packet.frameType = VideoFrameType::kVideoFrameKey;
packet.video_header.frame_type = VideoFrameType::kVideoFrameKey;
EXPECT_LE(0, frame_key.InsertPacket(packet, 0, frame_data));
EXPECT_TRUE(dec_state.ContinuousFrame(&frame_key));
dec_state.SetState(&frame);
frame.Reset();
packet.frameType = VideoFrameType::kVideoFrameDelta;
packet.video_header.frame_type = VideoFrameType::kVideoFrameDelta;
// Use pictureId
packet.video_header.is_first_packet_in_frame = false;
vp8_header.pictureId = 0x0002;
@ -170,7 +170,7 @@ TEST(TestDecodingState, UpdateOldPacket) {
VCMPacket packet;
packet.timestamp = 1;
packet.seqNum = 1;
packet.frameType = VideoFrameType::kVideoFrameDelta;
packet.video_header.frame_type = VideoFrameType::kVideoFrameDelta;
FrameData frame_data;
frame_data.rtt_ms = 0;
frame_data.rolling_average_packets_per_frame = -1;
@ -185,14 +185,14 @@ TEST(TestDecodingState, UpdateOldPacket) {
// Now insert empty packet belonging to the same frame.
packet.timestamp = 1;
packet.seqNum = 2;
packet.frameType = VideoFrameType::kEmptyFrame;
packet.video_header.frame_type = VideoFrameType::kEmptyFrame;
packet.sizeBytes = 0;
dec_state.UpdateOldPacket(&packet);
EXPECT_EQ(dec_state.sequence_num(), 2);
// Now insert delta packet belonging to the same frame.
packet.timestamp = 1;
packet.seqNum = 3;
packet.frameType = VideoFrameType::kVideoFrameDelta;
packet.video_header.frame_type = VideoFrameType::kVideoFrameDelta;
packet.sizeBytes = 1400;
dec_state.UpdateOldPacket(&packet);
EXPECT_EQ(dec_state.sequence_num(), 3);
@ -200,7 +200,7 @@ TEST(TestDecodingState, UpdateOldPacket) {
// sequence number.
packet.timestamp = 0;
packet.seqNum = 4;
packet.frameType = VideoFrameType::kEmptyFrame;
packet.video_header.frame_type = VideoFrameType::kEmptyFrame;
packet.sizeBytes = 0;
dec_state.UpdateOldPacket(&packet);
EXPECT_EQ(dec_state.sequence_num(), 3);
@ -214,7 +214,7 @@ TEST(TestDecodingState, MultiLayerBehavior) {
// tl0PicIdx 0, temporal id 0.
VCMFrameBuffer frame;
VCMPacket packet;
packet.frameType = VideoFrameType::kVideoFrameDelta;
packet.video_header.frame_type = VideoFrameType::kVideoFrameDelta;
packet.video_header.codec = kVideoCodecVP8;
packet.timestamp = 0;
packet.seqNum = 0;
@ -265,7 +265,7 @@ TEST(TestDecodingState, MultiLayerBehavior) {
// Insert key frame - should update sync value.
// A key frame is always a base layer.
frame.Reset();
packet.frameType = VideoFrameType::kVideoFrameKey;
packet.video_header.frame_type = VideoFrameType::kVideoFrameKey;
packet.video_header.is_first_packet_in_frame = true;
packet.timestamp = 5;
packet.seqNum = 5;
@ -279,7 +279,7 @@ TEST(TestDecodingState, MultiLayerBehavior) {
// After sync, a continuous PictureId is required
// (continuous base layer is not enough )
frame.Reset();
packet.frameType = VideoFrameType::kVideoFrameDelta;
packet.video_header.frame_type = VideoFrameType::kVideoFrameDelta;
packet.timestamp = 6;
packet.seqNum = 6;
vp8_header.tl0PicIdx = 3;
@ -289,7 +289,7 @@ TEST(TestDecodingState, MultiLayerBehavior) {
EXPECT_TRUE(dec_state.ContinuousFrame(&frame));
EXPECT_TRUE(dec_state.full_sync());
frame.Reset();
packet.frameType = VideoFrameType::kVideoFrameDelta;
packet.video_header.frame_type = VideoFrameType::kVideoFrameDelta;
packet.video_header.is_first_packet_in_frame = true;
packet.timestamp = 8;
packet.seqNum = 8;
@ -304,7 +304,7 @@ TEST(TestDecodingState, MultiLayerBehavior) {
// Insert a non-ref frame - should update sync value.
frame.Reset();
packet.frameType = VideoFrameType::kVideoFrameDelta;
packet.video_header.frame_type = VideoFrameType::kVideoFrameDelta;
packet.video_header.is_first_packet_in_frame = true;
packet.timestamp = 9;
packet.seqNum = 9;
@ -324,7 +324,7 @@ TEST(TestDecodingState, MultiLayerBehavior) {
// Base layer.
frame.Reset();
dec_state.Reset();
packet.frameType = VideoFrameType::kVideoFrameDelta;
packet.video_header.frame_type = VideoFrameType::kVideoFrameDelta;
packet.video_header.is_first_packet_in_frame = true;
packet.markerBit = 1;
packet.timestamp = 0;
@ -338,7 +338,7 @@ TEST(TestDecodingState, MultiLayerBehavior) {
EXPECT_TRUE(dec_state.full_sync());
// Layer 2 - 2 packets (insert one, lose one).
frame.Reset();
packet.frameType = VideoFrameType::kVideoFrameDelta;
packet.video_header.frame_type = VideoFrameType::kVideoFrameDelta;
packet.video_header.is_first_packet_in_frame = true;
packet.markerBit = 0;
packet.timestamp = 1;
@ -351,7 +351,7 @@ TEST(TestDecodingState, MultiLayerBehavior) {
EXPECT_TRUE(dec_state.ContinuousFrame(&frame));
// Layer 1
frame.Reset();
packet.frameType = VideoFrameType::kVideoFrameDelta;
packet.video_header.frame_type = VideoFrameType::kVideoFrameDelta;
packet.video_header.is_first_packet_in_frame = true;
packet.markerBit = 1;
packet.timestamp = 2;
@ -370,7 +370,7 @@ TEST(TestDecodingState, DiscontinuousPicIdContinuousSeqNum) {
VCMFrameBuffer frame;
VCMPacket packet;
frame.Reset();
packet.frameType = VideoFrameType::kVideoFrameKey;
packet.video_header.frame_type = VideoFrameType::kVideoFrameKey;
packet.video_header.codec = kVideoCodecVP8;
packet.timestamp = 0;
packet.seqNum = 0;
@ -389,7 +389,7 @@ TEST(TestDecodingState, DiscontinuousPicIdContinuousSeqNum) {
// Continuous sequence number but discontinuous picture id. This implies a
// a loss and we have to fall back to only decoding the base layer.
frame.Reset();
packet.frameType = VideoFrameType::kVideoFrameDelta;
packet.video_header.frame_type = VideoFrameType::kVideoFrameDelta;
packet.timestamp += 3000;
++packet.seqNum;
vp8_header.temporalIdx = 1;
@ -425,7 +425,7 @@ TEST(TestDecodingState, PictureIdRepeat) {
VCMDecodingState dec_state;
VCMFrameBuffer frame;
VCMPacket packet;
packet.frameType = VideoFrameType::kVideoFrameDelta;
packet.video_header.frame_type = VideoFrameType::kVideoFrameDelta;
packet.video_header.codec = kVideoCodecVP8;
packet.timestamp = 0;
packet.seqNum = 0;
@ -478,7 +478,7 @@ TEST(TestDecodingState, FrameContinuityFlexibleModeKeyFrame) {
frame_data.rolling_average_packets_per_frame = -1;
// Key frame as first frame
packet.frameType = VideoFrameType::kVideoFrameKey;
packet.video_header.frame_type = VideoFrameType::kVideoFrameKey;
EXPECT_LE(0, frame.InsertPacket(packet, 0, frame_data));
EXPECT_TRUE(dec_state.ContinuousFrame(&frame));
dec_state.SetState(&frame);
@ -492,7 +492,7 @@ TEST(TestDecodingState, FrameContinuityFlexibleModeKeyFrame) {
// Ref to 11, continuous
frame.Reset();
packet.frameType = VideoFrameType::kVideoFrameDelta;
packet.video_header.frame_type = VideoFrameType::kVideoFrameDelta;
vp9_hdr.picture_id = 12;
vp9_hdr.num_ref_pics = 1;
vp9_hdr.pid_diff[0] = 1;
@ -522,14 +522,14 @@ TEST(TestDecodingState, FrameContinuityFlexibleModeOutOfOrderFrames) {
frame_data.rolling_average_packets_per_frame = -1;
// Key frame as first frame
packet.frameType = VideoFrameType::kVideoFrameKey;
packet.video_header.frame_type = VideoFrameType::kVideoFrameKey;
EXPECT_LE(0, frame.InsertPacket(packet, 0, frame_data));
EXPECT_TRUE(dec_state.ContinuousFrame(&frame));
dec_state.SetState(&frame);
// Ref to 10, continuous
frame.Reset();
packet.frameType = VideoFrameType::kVideoFrameDelta;
packet.video_header.frame_type = VideoFrameType::kVideoFrameDelta;
vp9_hdr.picture_id = 15;
vp9_hdr.num_ref_pics = 1;
vp9_hdr.pid_diff[0] = 5;
@ -578,23 +578,23 @@ TEST(TestDecodingState, FrameContinuityFlexibleModeGeneral) {
frame_data.rolling_average_packets_per_frame = -1;
// Key frame as first frame
packet.frameType = VideoFrameType::kVideoFrameKey;
packet.video_header.frame_type = VideoFrameType::kVideoFrameKey;
EXPECT_LE(0, frame.InsertPacket(packet, 0, frame_data));
EXPECT_TRUE(dec_state.ContinuousFrame(&frame));
// Delta frame as first frame
frame.Reset();
packet.frameType = VideoFrameType::kVideoFrameDelta;
packet.video_header.frame_type = VideoFrameType::kVideoFrameDelta;
EXPECT_LE(0, frame.InsertPacket(packet, 0, frame_data));
EXPECT_FALSE(dec_state.ContinuousFrame(&frame));
// Key frame then delta frame
frame.Reset();
packet.frameType = VideoFrameType::kVideoFrameKey;
packet.video_header.frame_type = VideoFrameType::kVideoFrameKey;
EXPECT_LE(0, frame.InsertPacket(packet, 0, frame_data));
dec_state.SetState(&frame);
frame.Reset();
packet.frameType = VideoFrameType::kVideoFrameDelta;
packet.video_header.frame_type = VideoFrameType::kVideoFrameDelta;
vp9_hdr.num_ref_pics = 1;
vp9_hdr.picture_id = 15;
vp9_hdr.pid_diff[0] = 5;
@ -638,7 +638,7 @@ TEST(TestDecodingState, FrameContinuityFlexibleModeGeneral) {
// Key Frame, continuous
frame.Reset();
packet.frameType = VideoFrameType::kVideoFrameKey;
packet.video_header.frame_type = VideoFrameType::kVideoFrameKey;
vp9_hdr.picture_id = VCMDecodingState::kFrameDecodedLength - 2;
vp9_hdr.num_ref_pics = 0;
EXPECT_LE(0, frame.InsertPacket(packet, 0, frame_data));
@ -647,7 +647,7 @@ TEST(TestDecodingState, FrameContinuityFlexibleModeGeneral) {
// Frame at last index, ref to KF, continuous
frame.Reset();
packet.frameType = VideoFrameType::kVideoFrameDelta;
packet.video_header.frame_type = VideoFrameType::kVideoFrameDelta;
vp9_hdr.picture_id = VCMDecodingState::kFrameDecodedLength - 1;
vp9_hdr.num_ref_pics = 1;
vp9_hdr.pid_diff[0] = 1;
@ -683,7 +683,7 @@ TEST(TestDecodingState, FrameContinuityFlexibleModeGeneral) {
// Key frame, continuous
frame.Reset();
packet.frameType = VideoFrameType::kVideoFrameKey;
packet.video_header.frame_type = VideoFrameType::kVideoFrameKey;
vp9_hdr.picture_id = 25;
vp9_hdr.num_ref_pics = 0;
EXPECT_LE(0, frame.InsertPacket(packet, 0, frame_data));
@ -692,7 +692,7 @@ TEST(TestDecodingState, FrameContinuityFlexibleModeGeneral) {
// Ref to KF, continuous
frame.Reset();
packet.frameType = VideoFrameType::kVideoFrameDelta;
packet.video_header.frame_type = VideoFrameType::kVideoFrameDelta;
vp9_hdr.picture_id = 26;
vp9_hdr.num_ref_pics = 1;
vp9_hdr.pid_diff[0] = 1;